Handle different device outputs for multipath

In some cases the output of the multipath can differ
and we would return a wrong parent device.
Closes-Bug: 2043992
Change-Id: I848d7df798cc736bd5a55eed8fa46110caea1dc3
This commit is contained in:
Iury Gregory Melo Ferreira
2023年11月20日 22:38:48 -03:00
parent 845df338f8
commit 0a29206b8d

View File

@@ -273,11 +273,15 @@ def _get_multipath_parent_device(device):
# size=56G features='1 retain_attached_hw_handler' hwhandler='0' wp=rw
# `-+- policy='service-time 0' prio=1 status=active
# `- 0:0:0:0 sda 8:0 active ready running
# Other format:
# mpathat (wwid/alias) device_name vendor,product
try:
lines = out.splitlines()
mpath_device = lines[0].split('')[1]
# give back something like dm-0 so we can log it.
return mpath_device
mpath_device_out = lines[0].split('')
for mpath_device in mpath_device_out:
if mpath_device.startswith("dm"):
# give back something like dm-0 so we can log it.
return mpath_device
except IndexError:
# We didn't get any command output, so Nope.
pass

View File

@@ -1764,7 +1764,7 @@ MULTIPATH_VALID_PATH = '%s is a valid multipath device path'
MULTIPATH_INVALID_PATH = '%s is not a valid multipath device path'
MULTIPATH_LINKS_DM = (
'SUPER_FRIENDLY_NAME %s ATA,INTEL SSDSC2CT06\n'
'SUPER_FRIENDLY_NAME (12345) %s ATA,INTEL SSDSC2CT06\n'
'size=56G features=\'1 retain_attached_hw_handler\' hwhandler=\'0\' wp=rw\n' # noqa
' `-+- policy=\'service-time 0\' prio=1 status=active\n'
' `- 0:0:0:0 device s 8:0 active ready running\n'

View File

@@ -0,0 +1,5 @@
---
fixes:
- |
Fix the logic to detect the right parent device for a given multipath
device.
Reference in New Issue
openstack/ironic-python-agent
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.

The note is not visible to the blocked user.