Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions zvmsdk/volumeop.py
Original file line number Diff line number Diff line change
Expand Up @@ -2108,7 +2108,7 @@ def _rollback_added_disks(self, fcp_list, assigner_id, target_wwpns, target_lun,

def _do_attach(self, fcp_list, assigner_id, target_wwpns, target_lun,
multipath, os_version, mount_point, is_root_volume,
fcp_template_id, do_rollback=True):
fcp_template_id, update_connections_only, do_rollback=True):
"""Attach a volume

:param do_rollback (Bool)
Expand Down Expand Up @@ -2149,11 +2149,19 @@ def _do_attach(self, fcp_list, assigner_id, target_wwpns, target_lun,
self._rollback_reserved_fcp_devices(fcp_list)
raise

if is_root_volume:
LOG.info("We are attaching root volume, dedicating FCP devices %s "
"to virtual machine %s has been done by refresh_bootmap; "
"skip the remain steps of volume attachment."
% (fcp_list, assigner_id))
# If update_connections set to True, means upper layer want
# to update database record only. For example, try to create
# the instance, then no need to dedicate the FCP device.
if is_root_volume or update_connections_only:
if update_connections_only:
LOG.info("Update connections only, dedicating FCP devices %s "
"from virtual machine %s has been done; skip the remain "
"steps of volume attachment" % (fcp_list, assigner_id))
else:
LOG.info("We are attaching root volume, dedicating FCP devices %s "
"to virtual machine %s has been done by refresh_bootmap; "
"skip the remain steps of volume attachment."
% (fcp_list, assigner_id))
return []

# Operation on z/VM: dedicate FCP devices to the assigner_id in z/VM
Expand Down Expand Up @@ -2327,6 +2335,8 @@ def attach(self, connection_info):
is_root_volume = connection_info.get('is_root_volume', False)
fcp_template_id = connection_info['fcp_template_id']
do_rollback = connection_info.get('do_rollback', True)
update_connections_only = connection_info.get(
'update_connections_only', False)
LOG.info("attach with do_rollback as {}".format(do_rollback))

if is_root_volume is False and \
Expand All @@ -2343,7 +2353,7 @@ def attach(self, connection_info):
target_wwpns, target_lun,
multipath, os_version,
mount_point, is_root_volume,
fcp_template_id, do_rollback=do_rollback)
fcp_template_id, update_connections_only, do_rollback=do_rollback)
except Exception:
for fcp in fcp_list:
with zvmutils.ignore_errors():
Expand Down