# persistent root volume
base_disk_index = ord("a")
image_id = ""
+ # use existing persistent root volume
if disk.get("vim_volume_id"):
-
- # use existing persistent root volume
block_device_mapping["vd" + chr(base_disk_index)] = disk[
"vim_volume_id"
]
existing_vim_volumes.append({"id": disk["vim_volume_id"]})
-
+ # use existing persistent root volume
+ elif disk.get("vim_id"):
+ block_device_mapping["vd" + chr(base_disk_index)] = disk[
+ "vim_id"
+ ]
+ existing_vim_volumes.append({"id": disk["vim_id"]})
else:
# create persistent root volume
volume = self.cinder.volumes.create(
] = volume.id
else:
# non-root persistent volume
- if disk.get("vim_volume_id"):
-
+ key_id = (
+ "vim_volume_id"
+ if "vim_volume_id" in disk.keys()
+ else "vim_id"
+ )
+ if disk.get(key_id):
# use existing persistent volume
block_device_mapping["vd" + chr(base_disk_index)] = disk[
- "vim_volume_id"
+ key_id
]
- existing_vim_volumes.append({"id": disk["vim_volume_id"]})
-
+ existing_vim_volumes.append({"id": disk[key_id]})
else:
-
# create persistent volume
volume = self.cinder.volumes.create(
size=disk["size"],
--- /dev/null
+#######################################################################################
+# Copyright ETSI Contributors and Others.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#######################################################################################
+---
+fixes:
+ - |
+ Find the existing persistent volume by vim_id keyword. It's possible to find an
+ existing disk id searching with vim_id or vim_volume_id depend on situation.
+ vim_id is added in the search key list.
+
+