@@ -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,19 @@ 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 update_connections set to True, means upper layer want
2153+ # to update database record only. For example, try to create
2154+ # the instance, then no need to dedicate the FCP device.
2155+ if is_root_volume or update_connections_only :
2156+ if update_connections_only :
2157+ LOG .info ("Update connections only, dedicating FCP devices %s "
2158+ "from virtual machine %s has been done; skip the remain "
2159+ "steps of volume attachment" % (fcp_list , assigner_id ))
2160+ else :
2161+ LOG .info ("We are attaching root volume, dedicating FCP devices %s "
2162+ "to virtual machine %s has been done by refresh_bootmap; "
2163+ "skip the remain steps of volume attachment."
2164+ % (fcp_list , assigner_id ))
21572165 return []
21582166
21592167 # Operation on z/VM: dedicate FCP devices to the assigner_id in z/VM
@@ -2327,6 +2335,8 @@ def attach(self, connection_info):
23272335 is_root_volume = connection_info .get ('is_root_volume' , False )
23282336 fcp_template_id = connection_info ['fcp_template_id' ]
23292337 do_rollback = connection_info .get ('do_rollback' , True )
2338+ update_connections_only = connection_info .get (
2339+ 'update_connections_only' , False )
23302340 LOG .info ("attach with do_rollback as {}" .format (do_rollback ))
23312341
23322342 if is_root_volume is False and \
@@ -2343,7 +2353,7 @@ def attach(self, connection_info):
23432353 target_wwpns , target_lun ,
23442354 multipath , os_version ,
23452355 mount_point , is_root_volume ,
2346- fcp_template_id , do_rollback = do_rollback )
2356+ fcp_template_id , update_connections_only , do_rollback = do_rollback )
23472357 except Exception :
23482358 for fcp in fcp_list :
23492359 with zvmutils .ignore_errors ():
0 commit comments