diff --git a/tripleo_common/actions/baremetal.py b/tripleo_common/actions/baremetal.py index 4c0a93268..dc73355ec 100644 --- a/tripleo_common/actions/baremetal.py +++ b/tripleo_common/actions/baremetal.py @@ -256,7 +256,7 @@ class ConfigureRootDeviceAction(base.TripleOAction): {'strategy': strategy, 'node': node.uuid}) hint = None - for hint_name in ('wwn', 'serial'): + for hint_name in ('wwn_with_extension', 'wwn', 'serial'): if root_device.get(hint_name): hint = {hint_name: root_device[hint_name]} break diff --git a/tripleo_common/tests/actions/test_baremetal.py b/tripleo_common/tests/actions/test_baremetal.py index 6d2079a5f..5f313397d 100644 --- a/tripleo_common/tests/actions/test_baremetal.py +++ b/tripleo_common/tests/actions/test_baremetal.py @@ -202,6 +202,21 @@ class TestConfigureRootDeviceAction(base.TestCase): self.assertEqual(mock.call('ABCDEFGH', expected_patch), root_device_args) + def test_smallest_with_ext(self): + self.disks[2]['wwn_with_extension'] = 'wwnext' + action = baremetal.ConfigureRootDeviceAction(node_uuid='MOCK_UUID', + root_device='smallest') + action.run(self.context) + + self.assertEqual(self.ironic.node.update.call_count, 1) + root_device_args = self.ironic.node.update.call_args_list[0] + expected_patch = [{'op': 'add', 'path': '/properties/root_device', + 'value': {'wwn_with_extension': 'wwnext'}}, + {'op': 'add', 'path': '/properties/local_gb', + 'value': 4}] + self.assertEqual(mock.call('ABCDEFGH', expected_patch), + root_device_args) + def test_largest(self): action = baremetal.ConfigureRootDeviceAction(node_uuid='MOCK_UUID', root_device='largest') @@ -216,6 +231,21 @@ class TestConfigureRootDeviceAction(base.TestCase): self.assertEqual(mock.call('ABCDEFGH', expected_patch), root_device_args) + def test_largest_with_ext(self): + self.disks[3]['wwn_with_extension'] = 'wwnext' + action = baremetal.ConfigureRootDeviceAction(node_uuid='MOCK_UUID', + root_device='largest') + action.run(self.context) + + self.assertEqual(self.ironic.node.update.call_count, 1) + root_device_args = self.ironic.node.update.call_args_list[0] + expected_patch = [{'op': 'add', 'path': '/properties/root_device', + 'value': {'wwn_with_extension': 'wwnext'}}, + {'op': 'add', 'path': '/properties/local_gb', + 'value': 20}] + self.assertEqual(mock.call('ABCDEFGH', expected_patch), + root_device_args) + def test_no_overwrite(self): self.node.properties['root_device'] = {'foo': 'bar'}