Skip to content

Commit d32c6cd

Browse files
committed
Update the database only without dedicate the FCP while creating the
instance Signed-off-by: Malar2703 <ponmalarkaruppasamy@gmail.com>
1 parent d6cb69e commit d32c6cd

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

zvmsdk/volumeop.py

Lines changed: 9 additions & 3 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)
@@ -2164,7 +2164,11 @@ def _do_attach(self, fcp_list, assigner_id, target_wwpns, target_lun,
21642164
# otherwise the FCP device has been dedicated already.
21652165
# if _dedicate_fcp() raise exception for an FCP device, we must stop
21662166
# the whole attachment to go to except-block to do rollback operations.
2167-
if fcp_connections[fcp] == 1:
2167+
2168+
# If update_connections set to True, means upper layer want
2169+
# to update database record only. For example, try to create
2170+
# the instance, then no need to dedicate the FCP device.
2171+
if fcp_connections[fcp] == 1 and not update_connections_only:
21682172
LOG.info("Start to dedicate FCP %s to "
21692173
"%s in z/VM." % (fcp, assigner_id))
21702174
# dedicate the FCP to the assigner in z/VM
@@ -2327,6 +2331,8 @@ def attach(self, connection_info):
23272331
is_root_volume = connection_info.get('is_root_volume', False)
23282332
fcp_template_id = connection_info['fcp_template_id']
23292333
do_rollback = connection_info.get('do_rollback', True)
2334+
update_connections_only = connection_info.get(
2335+
'update_connections_only', False)
23302336
LOG.info("attach with do_rollback as {}".format(do_rollback))
23312337

23322338
if is_root_volume is False and \
@@ -2343,7 +2349,7 @@ def attach(self, connection_info):
23432349
target_wwpns, target_lun,
23442350
multipath, os_version,
23452351
mount_point, is_root_volume,
2346-
fcp_template_id, do_rollback=do_rollback)
2352+
fcp_template_id, update_connections_only, do_rollback=do_rollback)
23472353
except Exception:
23482354
for fcp in fcp_list:
23492355
with zvmutils.ignore_errors():

0 commit comments

Comments
 (0)