@@ -758,9 +758,9 @@ def _delete_volume(self, volume, lun_id=None):
758758 if not lun_id :
759759 return
760760
761- lun_group_ids = self . client . get_lungroupids_by_lunid ( lun_id )
762- if lun_group_ids and len ( lun_group_ids ) == 1 :
763- self .client . remove_lun_from_lungroup ( lun_group_ids [ 0 ], lun_id )
761+ huawei_utils . remove_lun_from_lungroup (
762+ self . client , lun_id ,
763+ self .configuration . force_delete_volume )
764764
765765 self .client .delete_lun (lun_id )
766766
@@ -770,10 +770,9 @@ def _remove_remote_lun_from_lungroup(self, volume):
770770 if not rmt_lun_id :
771771 return
772772
773- lun_group_ids = self .rmt_client .get_lungroupids_by_lunid (rmt_lun_id )
774- if lun_group_ids and len (lun_group_ids ) == 1 :
775- self .rmt_client .remove_lun_from_lungroup (
776- lun_group_ids [0 ], rmt_lun_id )
773+ huawei_utils .remove_lun_from_lungroup (
774+ self .rmt_client , rmt_lun_id ,
775+ self .configuration .force_delete_volume )
777776
778777 def delete_volume (self , volume ):
779778 """Delete a volume.
@@ -2614,9 +2613,10 @@ class HuaweiISCSIDriver(HuaweiBaseDriver, driver.ISCSIDriver):
26142613 Cgsnapshot support
26152614 2.0.8 - Backup snapshot optimal path support
26162615 2.0.9 - Support reporting disk type of pool
2616+ 2.2.RC1 - Add force delete volume
26172617 """
26182618
2619- VERSION = "2.0.9 "
2619+ VERSION = "2.2.RC1 "
26202620
26212621 def __init__ (self , * args , ** kwargs ):
26222622 super (HuaweiISCSIDriver , self ).__init__ (* args , ** kwargs )
@@ -2822,17 +2822,14 @@ def _terminate_connection(self, volume, connector, local=True):
28222822 portgroup_id = None
28232823 view_id = None
28242824 left_lunnum = - 1
2825- portgroup = client .find_portgroup_info (
2826- initiator_name , host_name )
28272825
2828- if portgroup :
2829- portgroup_id = client .get_tgt_port_group (portgroup )
28302826 host_id = huawei_utils .get_host_id (client , host_name )
28312827 if host_id :
28322828 mapping_view_name = constants .MAPPING_VIEW_PREFIX + host_id
28332829 view_id = client .find_mapping_view (mapping_view_name )
28342830 if view_id :
28352831 lungroup_id = client .find_lungroup_from_map (view_id )
2832+ portgroup_id = client .get_portgroup_by_view (view_id )
28362833
28372834 # Remove lun from lungroup.
28382835 if lun_id and lungroup_id :
@@ -2897,9 +2894,10 @@ class HuaweiFCDriver(HuaweiBaseDriver, driver.FibreChannelDriver):
28972894 Cgsnapshot support
28982895 2.0.8 - Backup snapshot optimal path support
28992896 2.0.9 - Support reporting disk type of pool
2897+ 2.2.RC1 - Add force delete volume
29002898 """
29012899
2902- VERSION = "2.0.9 "
2900+ VERSION = "2.2.RC1 "
29032901
29042902 def __init__ (self , * args , ** kwargs ):
29052903 super (HuaweiFCDriver , self ).__init__ (* args , ** kwargs )
0 commit comments