Skip to content

Commit

Permalink
Merge branch 'ZSTAC-64980@@3' into '5.1.0'
Browse files Browse the repository at this point in the history
<fix>[bm-instance-agent]: add detach volume for expon volume

See merge request zstackio/zstack-utility!4713
  • Loading branch information
PandaWuu committed Apr 26, 2024
2 parents 98063a7 + 9ab64d1 commit b2d2382
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions bm-instance-agent/bm_instance_agent/systems/linux/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@
rr_weight priorities
no_path_retry fail
}
device {
vendor "ET"
product "ET_WDS"
hardware_handler "0"
path_grouping_policy "multibus"
path_selector "queue-length 0"
failback immediate
path_checker tur
prio const
no_path_retry fail
fast_io_fail_tmo 120
}
}
"""

Expand Down Expand Up @@ -100,18 +112,6 @@ def rescan_sids_target_name(target_name):
LOG.info("iscsiadm -m session -r %s --rescan fail, because %s" % (session_id, stderr))


def rescan_for_detach(volume_obj):
volume_iqn = volume_obj.iscsi_path.replace('iscsi://', '').split("/")[1].strip()
if volume_iqn:
LOG.info("skip rescan for detach")
return

stdout, stderr = processutils.trycmd("timeout 30 iscsiadm -m session -R", shell=True)
if stderr:
LOG.info("timeout 30 iscsiadm -m session -R failed, because %s" % stderr)
return


class LinuxDriver(base.SystemDriverBase):
driver_name = 'linux'

Expand Down Expand Up @@ -255,14 +255,11 @@ def detach_volume(self, instance_obj, volume_obj, volume_access_path_gateway_ips
"""
for volume_access_path_gateway_ip in volume_access_path_gateway_ips:
self.detach_volume_for_target_ip(instance_obj, volume_obj, volume_access_path_gateway_ip)
rescan_for_detach(volume_obj)

def detach_volume_for_target_ip(self, instance_obj, volume_obj, target_ip):
# Get the session id
sid = None
volume_iqn = volume_obj.iscsi_path.replace('iscsi://', '').split("/")[1]
if not volume_iqn:
return
if instance_obj.custom_iqn:
iqn = instance_obj.custom_iqn
elif volume_iqn:
Expand Down

0 comments on commit b2d2382

Please sign in to comment.