From d26664e7f9f36e8935d4b38e1bc80c892bfcd6d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aija=20Jaunt=C4=93va?= Date: Mon, 20 Sep 2021 10:12:44 -0400 Subject: [PATCH] Fix virtual disks sharing same physical disks `StartingLBA` needs to be passed when creating virtual disks sharing same physicial disks. Otherwise, only the first virtual disk creation succeeds and iDRAC job has status "Completed with Errors". Change-Id: I985a714636fb2036cca038ffa281c1b1e01ffd52 --- dracclient/resources/raid.py | 11 +++++++++++ dracclient/tests/test_raid.py | 18 +++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/dracclient/resources/raid.py b/dracclient/resources/raid.py index 44cea69..7a23c91 100644 --- a/dracclient/resources/raid.py +++ b/dracclient/resources/raid.py @@ -97,6 +97,8 @@ VirtualDisk = collections.namedtuple( NO_FOREIGN_DRIVES = ["STOR058", "STOR018"] +_STARTING_LBA_AUTO_CALCULATE = '0xFFFFFFFFFFFFFFFF' + class RAIDAttribute(object): """Generic RAID attribute class""" @@ -672,6 +674,15 @@ class RAIDManagement(object): virtual_disk_prop_names.append('SpanLength') virtual_disk_prop_values.append(str(span_length)) + # Necessary when creating more than 1 VD on same physical disks. + # To keep things simple, passing this all the time as no harm to pass + # this when creating only 1 VD taking all physical disk space. + # Passed value '0xFFFFFFFFFFFFFFFF' instructs iDRAC to calculate the + # value programmatically on its side. For single or first VD that would + # be 0. + virtual_disk_prop_names.append('StartingLBA') + virtual_disk_prop_values.append(_STARTING_LBA_AUTO_CALCULATE) + if error_msgs: msg = ('The following errors were encountered while parsing ' 'the provided parameters: %r') % ','.join(error_msgs) diff --git a/dracclient/tests/test_raid.py b/dracclient/tests/test_raid.py index 7323511..7edc744 100644 --- a/dracclient/tests/test_raid.py +++ b/dracclient/tests/test_raid.py @@ -648,8 +648,11 @@ class ClientRAIDManagementTestCase(base.BaseTest): 'Name': 'DCIM:RAIDService'} expected_properties = {'Target': 'controller', 'PDArray': ['disk1', 'disk2'], - 'VDPropNameArray': ['Size', 'RAIDLevel'], - 'VDPropValueArray': ['42', '4']} + 'VDPropNameArray': [ + 'Size', 'RAIDLevel', 'StartingLBA'], + 'VDPropValueArray': [ + '42', '4', + raid._STARTING_LBA_AUTO_CALCULATE]} mock_invoke.return_value = lxml.etree.fromstring( test_utils.RAIDInvocations[uris.DCIM_RAIDService][ 'CreateVirtualDisk']['ok']) @@ -676,11 +679,12 @@ class ClientRAIDManagementTestCase(base.BaseTest): 'Name': 'DCIM:RAIDService'} expected_properties = {'Target': 'controller', 'PDArray': ['disk1', 'disk2'], - 'VDPropNameArray': ['Size', 'RAIDLevel', - 'VirtualDiskName', - 'SpanDepth', 'SpanLength'], - 'VDPropValueArray': ['42', '4', 'name', '3', - '2']} + 'VDPropNameArray': [ + 'Size', 'RAIDLevel', 'VirtualDiskName', + 'SpanDepth', 'SpanLength', 'StartingLBA'], + 'VDPropValueArray': [ + '42', '4', 'name', '3', '2', + raid._STARTING_LBA_AUTO_CALCULATE]} mock_invoke.return_value = lxml.etree.fromstring( test_utils.RAIDInvocations[uris.DCIM_RAIDService][ 'CreateVirtualDisk']['ok'])