Extend root device hints for different types of WWN
This patch is extending the root device hints to also look at ID_WWN_WITH_EXTENSION and ID_WWN_VENDOR_EXTENSION from udev. Prior to this patch the IPA ramdisk only cared about ID_WWN but in some systems in some platforms with a RAID controller, this ID can be same even if they are different disks (see bug 1516641). Closes-Bug: #1516641 Change-Id: Ic3e9a1111dfcc99702190c173562a0dccf5f94c4
This commit is contained in:
@@ -102,7 +102,9 @@ def list_all_block_devices(block_type='disk'):
|
||||
# ID_SERIAL_SHORT here to keep compatibility with the
|
||||
# bash deploy ramdisk
|
||||
extra = {key: udev.get('ID_%s' % udev_key) for key, udev_key in
|
||||
[('wwn', 'WWN'), ('serial', 'SERIAL_SHORT')]}
|
||||
[('wwn', 'WWN'), ('serial', 'SERIAL_SHORT'),
|
||||
('wwn_with_extension', 'WWN_WITH_EXTENSION'),
|
||||
('wwn_vendor_extension', 'WWN_VENDOR_EXTENSION')]}
|
||||
|
||||
devices.append(BlockDevice(name=name,
|
||||
model=device['MODEL'],
|
||||
@@ -139,7 +141,8 @@ class BlockDevice(encoding.SerializableComparable):
|
||||
'wwn', 'serial', 'vendor')
|
||||
|
||||
def __init__(self, name, model, size, rotational, wwn=None, serial=None,
|
||||
vendor=None):
|
||||
vendor=None, wwn_with_extension=None,
|
||||
wwn_vendor_extension=None):
|
||||
self.name = name
|
||||
self.model = model
|
||||
self.size = size
|
||||
@@ -147,6 +150,8 @@ class BlockDevice(encoding.SerializableComparable):
|
||||
self.wwn = wwn
|
||||
self.serial = serial
|
||||
self.vendor = vendor
|
||||
self.wwn_with_extension = wwn_with_extension
|
||||
self.wwn_vendor_extension = wwn_vendor_extension
|
||||
|
||||
|
||||
class NetworkInterface(encoding.SerializableComparable):
|
||||
@@ -445,7 +450,8 @@ class GenericHardwareManager(HardwareManager):
|
||||
return True
|
||||
|
||||
def check_device_attrs(device):
|
||||
for key in ('model', 'wwn', 'serial', 'vendor'):
|
||||
for key in ('model', 'wwn', 'serial', 'vendor',
|
||||
'wwn_with_extension', 'wwn_vendor_extension'):
|
||||
if key not in root_device_hints:
|
||||
continue
|
||||
|
||||
|
@@ -498,7 +498,9 @@ class TestGenericHardwareManager(test_base.BaseTestCase):
|
||||
mocked_dev_vendor):
|
||||
mocked_execute.return_value = (BLK_DEVICE_TEMPLATE, '')
|
||||
mocked_udev.side_effect = iter([
|
||||
{'ID_WWN': 'wwn%d' % i, 'ID_SERIAL_SHORT': 'serial%d' % i}
|
||||
{'ID_WWN': 'wwn%d' % i, 'ID_SERIAL_SHORT': 'serial%d' % i,
|
||||
'ID_WWN_WITH_EXTENSION': 'wwn-ext%d' % i,
|
||||
'ID_WWN_VENDOR_EXTENSION': 'wwn-vendor-ext%d' % i}
|
||||
for i in range(4)
|
||||
])
|
||||
mocked_dev_vendor.return_value = 'Super Vendor'
|
||||
@@ -510,6 +512,8 @@ class TestGenericHardwareManager(test_base.BaseTestCase):
|
||||
rotational=False,
|
||||
vendor='Super Vendor',
|
||||
wwn='wwn0',
|
||||
wwn_with_extension='wwn-ext0',
|
||||
wwn_vendor_extension='wwn-vendor-ext0',
|
||||
serial='serial0'),
|
||||
hardware.BlockDevice(name='/dev/sdb',
|
||||
model='Fastable SD131 7',
|
||||
@@ -517,6 +521,8 @@ class TestGenericHardwareManager(test_base.BaseTestCase):
|
||||
rotational=False,
|
||||
vendor='Super Vendor',
|
||||
wwn='wwn1',
|
||||
wwn_with_extension='wwn-ext1',
|
||||
wwn_vendor_extension='wwn-vendor-ext1',
|
||||
serial='serial1'),
|
||||
hardware.BlockDevice(name='/dev/sdc',
|
||||
model='NWD-BLP4-1600',
|
||||
@@ -524,6 +530,8 @@ class TestGenericHardwareManager(test_base.BaseTestCase):
|
||||
rotational=False,
|
||||
vendor='Super Vendor',
|
||||
wwn='wwn2',
|
||||
wwn_with_extension='wwn-ext2',
|
||||
wwn_vendor_extension='wwn-vendor-ext2',
|
||||
serial='serial2'),
|
||||
hardware.BlockDevice(name='/dev/sdd',
|
||||
model='NWD-BLP4-1600',
|
||||
@@ -531,6 +539,8 @@ class TestGenericHardwareManager(test_base.BaseTestCase):
|
||||
rotational=False,
|
||||
vendor='Super Vendor',
|
||||
wwn='wwn3',
|
||||
wwn_with_extension='wwn-ext3',
|
||||
wwn_vendor_extension='wwn-vendor-ext3',
|
||||
serial='serial3')
|
||||
]
|
||||
|
||||
@@ -538,7 +548,8 @@ class TestGenericHardwareManager(test_base.BaseTestCase):
|
||||
for expected, device in zip(expected_devices, devices):
|
||||
# Compare all attrs of the objects
|
||||
for attr in ['name', 'model', 'size', 'rotational',
|
||||
'wwn', 'vendor', 'serial']:
|
||||
'wwn', 'vendor', 'serial', 'wwn_with_extension',
|
||||
'wwn_vendor_extension']:
|
||||
self.assertEqual(getattr(expected, attr),
|
||||
getattr(device, attr))
|
||||
|
||||
|
Reference in New Issue
Block a user