Skip to content

Commit 0cc493e

Browse files
Malar2703Pon-Karuppasamy
authored andcommitted
Update the database only without dedicate the FCP while creating the
instance Signed-off-by: Malar2703 <ponmalarkaruppasamy@gmail.com>
1 parent d6cb69e commit 0cc493e

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

zvmsdk/volumeop.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2108,7 +2108,7 @@ def _rollback_added_disks(self, fcp_list, assigner_id, target_wwpns, target_lun,
21082108

21092109
def _do_attach(self, fcp_list, assigner_id, target_wwpns, target_lun,
21102110
multipath, os_version, mount_point, is_root_volume,
2111-
fcp_template_id, do_rollback=True):
2111+
fcp_template_id, update_connections_only, do_rollback=True):
21122112
"""Attach a volume
21132113
21142114
:param do_rollback (Bool)
@@ -2149,11 +2149,16 @@ def _do_attach(self, fcp_list, assigner_id, target_wwpns, target_lun,
21492149
self._rollback_reserved_fcp_devices(fcp_list)
21502150
raise
21512151

2152-
if is_root_volume:
2153-
LOG.info("We are attaching root volume, dedicating FCP devices %s "
2154-
"to virtual machine %s has been done by refresh_bootmap; "
2155-
"skip the remain steps of volume attachment."
2156-
% (fcp_list, assigner_id))
2152+
if is_root_volume or update_connections_only:
2153+
if update_connections_only:
2154+
LOG.info("Update connections only, dedicating FCP devices %s "
2155+
"from virtual machine %s has been done; skip the remain "
2156+
"steps of volume attachment" % (fcp_list, assigner_id))
2157+
else:
2158+
LOG.info("We are attaching root volume, dedicating FCP devices %s "
2159+
"to virtual machine %s has been done by refresh_bootmap; "
2160+
"skip the remain steps of volume attachment."
2161+
% (fcp_list, assigner_id))
21572162
return []
21582163

21592164
# Operation on z/VM: dedicate FCP devices to the assigner_id in z/VM
@@ -2164,6 +2169,10 @@ def _do_attach(self, fcp_list, assigner_id, target_wwpns, target_lun,
21642169
# otherwise the FCP device has been dedicated already.
21652170
# if _dedicate_fcp() raise exception for an FCP device, we must stop
21662171
# the whole attachment to go to except-block to do rollback operations.
2172+
2173+
# If update_connections set to True, means upper layer want
2174+
# to update database record only. For example, try to create
2175+
# the instance, then no need to dedicate the FCP device.
21672176
if fcp_connections[fcp] == 1:
21682177
LOG.info("Start to dedicate FCP %s to "
21692178
"%s in z/VM." % (fcp, assigner_id))
@@ -2327,6 +2336,8 @@ def attach(self, connection_info):
23272336
is_root_volume = connection_info.get('is_root_volume', False)
23282337
fcp_template_id = connection_info['fcp_template_id']
23292338
do_rollback = connection_info.get('do_rollback', True)
2339+
update_connections_only = connection_info.get(
2340+
'update_connections_only', False)
23302341
LOG.info("attach with do_rollback as {}".format(do_rollback))
23312342

23322343
if is_root_volume is False and \
@@ -2343,7 +2354,7 @@ def attach(self, connection_info):
23432354
target_wwpns, target_lun,
23442355
multipath, os_version,
23452356
mount_point, is_root_volume,
2346-
fcp_template_id, do_rollback=do_rollback)
2357+
fcp_template_id, update_connections_only, do_rollback=do_rollback)
23472358
except Exception:
23482359
for fcp in fcp_list:
23492360
with zvmutils.ignore_errors():

0 commit comments

Comments
 (0)