From 3e21560bf70e5e6b529d9a2d37a2897461076395 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Thu, 23 Mar 2023 15:45:31 +0100 Subject: Remove all references to the "cpus" property Unused by Nova and unlike memory_mb/local_gb also by Ironic (actually, our usage of local_gb is worth double-checking as well, but at the very least it's referenced by inspection implementations). Change-Id: Ie8b0d9f58f4dcd102c183c30ae7f5acf68a5e4c3 --- .../source/samples/node-inventory-response.json | 1 - doc/source/admin/drivers/idrac.rst | 1 - doc/source/admin/drivers/ilo.rst | 5 +-- doc/source/admin/drivers/irmc.rst | 5 +-- doc/source/admin/troubleshooting.rst | 17 -------- doc/source/install/enrollment.rst | 10 ++--- doc/source/install/standalone/enrollment.rst | 4 +- doc/source/install/troubleshooting.rst | 3 +- ironic/drivers/base.py | 2 +- ironic/drivers/modules/drac/inspect.py | 14 ------- ironic/drivers/modules/redfish/inspect.py | 4 +- ironic/objects/node.py | 4 +- ironic/tests/unit/db/utils.py | 2 - .../unit/drivers/modules/drac/test_inspect.py | 22 ---------- .../tests/unit/drivers/modules/ilo/test_inspect.py | 47 +++++++++------------- .../unit/drivers/modules/irmc/test_inspect.py | 6 --- .../unit/drivers/modules/redfish/test_inspect.py | 18 +++------ ironic/tests/unit/objects/test_node.py | 7 ++-- releasenotes/notes/no-cpus-c79717303470bf3c.yaml | 6 +++ 19 files changed, 48 insertions(+), 130 deletions(-) create mode 100644 releasenotes/notes/no-cpus-c79717303470bf3c.yaml diff --git a/api-ref/source/samples/node-inventory-response.json b/api-ref/source/samples/node-inventory-response.json index 7916f6717..9355bcf1b 100644 --- a/api-ref/source/samples/node-inventory-response.json +++ b/api-ref/source/samples/node-inventory-response.json @@ -24,7 +24,6 @@ "52:54:00:90:35:d6" ], "local_gb":10, - "cpus":1, "cpu_arch":"x86_64", "memory_mb":2048 } diff --git a/doc/source/admin/drivers/idrac.rst b/doc/source/admin/drivers/idrac.rst index a8d157ec8..41e17761e 100644 --- a/doc/source/admin/drivers/idrac.rst +++ b/doc/source/admin/drivers/idrac.rst @@ -250,7 +250,6 @@ without affecting the operation of the system being inspected. The inspection discovers the following properties: * ``cpu_arch``: cpu architecture -* ``cpus``: number of cpus * ``local_gb``: disk size in gigabytes * ``memory_mb``: memory size in megabytes diff --git a/doc/source/admin/drivers/ilo.rst b/doc/source/admin/drivers/ilo.rst index b6825fc40..34401db0f 100644 --- a/doc/source/admin/drivers/ilo.rst +++ b/doc/source/admin/drivers/ilo.rst @@ -908,13 +908,10 @@ The hardware type ``ilo`` supports hardware inspection. * ``snmp_auth_priv_protocol`` : The Privacy protocol. The valid values are "AES" and "DES". The iLO default value is "DES". -The inspection process will discover the following essential properties -(properties required for scheduling deployment): +The inspection process will discover the following properties: * ``memory_mb``: memory size -* ``cpus``: number of cpus - * ``cpu_arch``: cpu architecture * ``local_gb``: disk size diff --git a/doc/source/admin/drivers/irmc.rst b/doc/source/admin/drivers/irmc.rst index 9ddfa3b3d..6bc6a1248 100644 --- a/doc/source/admin/drivers/irmc.rst +++ b/doc/source/admin/drivers/irmc.rst @@ -465,13 +465,10 @@ configuration: Supported properties ~~~~~~~~~~~~~~~~~~~~ -The inspection process will discover the following essential properties -(properties required for scheduling deployment): +The inspection process will discover the following properties: * ``memory_mb``: memory size -* ``cpus``: number of cpus - * ``cpu_arch``: cpu architecture * ``local_gb``: disk size diff --git a/doc/source/admin/troubleshooting.rst b/doc/source/admin/troubleshooting.rst index 72e969b6e..eef51cbf3 100644 --- a/doc/source/admin/troubleshooting.rst +++ b/doc/source/admin/troubleshooting.rst @@ -104,23 +104,6 @@ A few things should be checked in this case: ``True``; make sure the target nodes are in ``available`` and ``maintenance`` is ``False``; -#. If you do not use scheduling based on resource classes, then the node's - properties must have been set either manually or via inspection. - For each node with ``available`` state check that the ``properties`` - JSON field has valid values for the keys ``cpus``, ``cpu_arch``, - ``memory_mb`` and ``local_gb``. Example of valid properties:: - - $ baremetal node show --fields properties - +------------+------------------------------------------------------------------------------------+ - | Property | Value | - +------------+------------------------------------------------------------------------------------+ - | properties | {u'memory_mb': u'8192', u'cpu_arch': u'x86_64', u'local_gb': u'41', u'cpus': u'4'} | - +------------+------------------------------------------------------------------------------------+ - - .. warning:: - If you're using exact match filters in the Nova Scheduler, make sure - the flavor and the node properties match exactly. - #. The Nova flavor that you are using does not match any properties of the available Ironic nodes. Use :: diff --git a/doc/source/install/enrollment.rst b/doc/source/install/enrollment.rst index 9f9355d75..2a4f23a9a 100644 --- a/doc/source/install/enrollment.rst +++ b/doc/source/install/enrollment.rst @@ -292,12 +292,13 @@ Adding scheduling information This is not required for standalone deployments, only for those using the Compute service for provisioning bare metal instances. -#. Update the node's properties to match the actual hardware of the node: +#. Update the node's properties to match the actual hardware of the node. + These are optional. When provided, ``memory_mb`` can be used for checking + if the instance image fits into the node's memory: .. code-block:: console $ baremetal node set $NODE_UUID \ - --property cpus=$CPU_COUNT \ --property memory_mb=$RAM_MB \ --property local_gb=$DISK_GB @@ -310,14 +311,13 @@ Adding scheduling information --driver-info ipmi_username=$USER \ --driver-info ipmi_password=$PASS \ --driver-info ipmi_address=$ADDRESS \ - --property cpus=$CPU_COUNT \ --property memory_mb=$RAM_MB \ --property local_gb=$DISK_GB These values can also be discovered during `Hardware Inspection`_. - .. warning:: - The value provided for the ``local_gb`` property must match the size of + .. note:: + The value provided for the ``local_gb`` property should match the size of the root device you're going to deploy on. By default **ironic-python-agent** picks the smallest disk which is not smaller than 4 GiB. diff --git a/doc/source/install/standalone/enrollment.rst b/doc/source/install/standalone/enrollment.rst index 305091070..4fd9ebb48 100644 --- a/doc/source/install/standalone/enrollment.rst +++ b/doc/source/install/standalone/enrollment.rst @@ -87,9 +87,7 @@ Enrolling nodes #. As in case of Compute service, you can also provide ``capabilities`` to node properties, but they will be used only by Bare Metal service (for example, - boot mode). Although you don't need to add properties like ``memory_mb``, - ``cpus`` etc. as Bare Metal service will require UUID of a node you're - going to deploy. + boot mode). #. Then create a port to inform Bare Metal service of the network interface cards which are part of the node by creating a port with each NIC's MAC diff --git a/doc/source/install/troubleshooting.rst b/doc/source/install/troubleshooting.rst index 75f19c729..a40c19efd 100644 --- a/doc/source/install/troubleshooting.rst +++ b/doc/source/install/troubleshooting.rst @@ -33,8 +33,7 @@ service and Bare Metal service:: | Property | Value | +------------------------+----------------------------------------------------------------------+ | instance_uuid | None | - | properties | {u'memory_mb': u'1024', u'cpu_arch': u'x86_64', u'local_gb': u'10', | - | | u'cpus': u'1'} | + | properties | {u'memory_mb': u'1024', u'cpu_arch': u'x86_64', u'local_gb': u'10'} | | maintenance | False | | driver_info | { [SNIP] } | | extra | {} | diff --git a/ironic/drivers/base.py b/ironic/drivers/base.py index bdd017b91..4e2928907 100644 --- a/ironic/drivers/base.py +++ b/ironic/drivers/base.py @@ -1224,7 +1224,7 @@ class InspectInterface(BaseInterface): """Interface for inspection-related actions.""" interface_type = 'inspect' - ESSENTIAL_PROPERTIES = {'memory_mb', 'local_gb', 'cpus', 'cpu_arch'} + ESSENTIAL_PROPERTIES = {'memory_mb', 'local_gb', 'cpu_arch'} """The properties required by scheduler/deploy.""" @abc.abstractmethod diff --git a/ironic/drivers/modules/drac/inspect.py b/ironic/drivers/modules/drac/inspect.py index 8ba0be088..c9c58fbe9 100644 --- a/ironic/drivers/modules/drac/inspect.py +++ b/ironic/drivers/modules/drac/inspect.py @@ -176,8 +176,6 @@ class DracWSManInspect(base.InspectInterface): [memory.size_mb for memory in client.list_memory()]) cpus = client.list_cpus() if cpus: - properties['cpus'] = sum( - [self._calculate_cpus(cpu) for cpu in cpus]) properties['cpu_arch'] = 'x86_64' if cpus[0].arch64 else 'x86' bios_settings = client.list_bios_settings() @@ -264,18 +262,6 @@ class DracWSManInspect(base.InspectInterface): if disk.size_mb >= min_size_required_mb: return disk - def _calculate_cpus(self, cpu): - """Find actual CPU count. - - :param cpu: Pass cpu. - - :returns: returns total cpu count. - """ - if cpu.ht_enabled: - return cpu.cores * 2 - else: - return cpu.cores - def _calculate_gpus(self, video_controllers): """Find actual GPU count. diff --git a/ironic/drivers/modules/redfish/inspect.py b/ironic/drivers/modules/redfish/inspect.py index 4c5f7c344..c514df4fe 100644 --- a/ironic/drivers/modules/redfish/inspect.py +++ b/ironic/drivers/modules/redfish/inspect.py @@ -108,9 +108,7 @@ class RedfishInspect(base.InspectInterface): system.memory_summary.size_gib * units.Ki) if system.processors and system.processors.summary: - cpus, arch = system.processors.summary - if cpus: - inspected_properties['cpus'] = cpus + arch = system.processors.summary[1] if arch: try: diff --git a/ironic/objects/node.py b/ironic/objects/node.py index 93df5b3c1..b680ac60a 100644 --- a/ironic/objects/node.py +++ b/ironic/objects/node.py @@ -29,7 +29,7 @@ from ironic.objects import base from ironic.objects import fields as object_fields from ironic.objects import notification -REQUIRED_INT_PROPERTIES = ['local_gb', 'cpus', 'memory_mb'] +REQUIRED_INT_PROPERTIES = ['local_gb', 'memory_mb'] CONF = cfg.CONF LOG = log.getLogger(__name__) @@ -191,7 +191,7 @@ class Node(base.IronicObject, object_base.VersionedObjectDictCompat): return d def _validate_property_values(self, properties): - """Check if the input of local_gb, cpus and memory_mb are valid. + """Check if the input of local_gb and memory_mb are valid. :param properties: a dict contains the node's information. """ diff --git a/ironic/tests/unit/db/utils.py b/ironic/tests/unit/db/utils.py index 10055d829..fc5bee226 100644 --- a/ironic/tests/unit/db/utils.py +++ b/ironic/tests/unit/db/utils.py @@ -165,7 +165,6 @@ def get_test_snmp_info(**kw): def get_test_node(**kw): properties = { "cpu_arch": "x86_64", - "cpus": "8", "local_gb": "10", "memory_mb": "4096", } @@ -509,7 +508,6 @@ def create_test_node_tag(**kw): def get_test_xclarity_properties(): return { "cpu_arch": "x86_64", - "cpus": "8", "local_gb": "10", "memory_mb": "4096", } diff --git a/ironic/tests/unit/drivers/modules/drac/test_inspect.py b/ironic/tests/unit/drivers/modules/drac/test_inspect.py index d12adba34..0c04ad887 100644 --- a/ironic/tests/unit/drivers/modules/drac/test_inspect.py +++ b/ironic/tests/unit/drivers/modules/drac/test_inspect.py @@ -185,7 +185,6 @@ class DracInspectionTestCase(test_utils.BaseDracTest): expected_node_properties = { 'memory_mb': 32768, 'local_gb': 1116, - 'cpus': 18, 'cpu_arch': 'x86_64', 'capabilities': 'boot_mode:uefi,pci_gpu_devices:1'} mock_client = mock.Mock() @@ -235,7 +234,6 @@ class DracInspectionTestCase(test_utils.BaseDracTest): expected_node_properties = { 'memory_mb': 32768, 'local_gb': 279, - 'cpus': 18, 'cpu_arch': 'x86_64', 'capabilities': 'boot_mode:uefi,pci_gpu_devices:1'} mock_client = mock.Mock() @@ -305,7 +303,6 @@ class DracInspectionTestCase(test_utils.BaseDracTest): expected_node_properties = { 'memory_mb': 32768, 'local_gb': 279, - 'cpus': 18, 'cpu_arch': 'x86_64', 'capabilities': 'boot_mode:uefi,pci_gpu_devices:0'} mock_client = mock.Mock() @@ -355,7 +352,6 @@ class DracInspectionTestCase(test_utils.BaseDracTest): expected_node_properties = { 'memory_mb': 32768, 'local_gb': 279, - 'cpus': 18, 'cpu_arch': 'x86_64', 'capabilities': 'boot_mode:uefi,pci_gpu_devices:2'} mock_client = mock.Mock() @@ -387,7 +383,6 @@ class DracInspectionTestCase(test_utils.BaseDracTest): expected_node_properties = { 'memory_mb': 32768, 'local_gb': 279, - 'cpus': 18, 'cpu_arch': 'x86_64', 'capabilities': 'boot_mode:uefi,pci_gpu_devices:0'} mock_client = mock.Mock() @@ -417,7 +412,6 @@ class DracInspectionTestCase(test_utils.BaseDracTest): expected_node_properties = { 'memory_mb': 32768, 'local_gb': 1116, - 'cpus': 18, 'cpu_arch': 'x86_64', 'capabilities': 'boot_mode:uefi,pci_gpu_devices:1'} mock_client = mock.Mock() @@ -449,22 +443,6 @@ class DracInspectionTestCase(test_utils.BaseDracTest): self.assertEqual(285888, root_disk.size_mb) - def test__calculate_cpus(self): - with task_manager.acquire(self.context, self.node.uuid, - shared=True) as task: - cpu = task.driver.inspect._calculate_cpus( - self.cpus[0]) - - self.assertEqual(12, cpu) - - def test__calculate_cpus_without_ht_enabled(self): - with task_manager.acquire(self.context, self.node.uuid, - shared=True) as task: - cpu = task.driver.inspect._calculate_cpus( - self.cpus[1]) - - self.assertEqual(6, cpu) - @mock.patch.object(drac_common, 'get_drac_client', spec_set=True, autospec=True) def test__get_pxe_dev_nics_with_UEFI_boot_mode(self, mock_get_drac_client): diff --git a/ironic/tests/unit/drivers/modules/ilo/test_inspect.py b/ironic/tests/unit/drivers/modules/ilo/test_inspect.py index 1a85d5b28..af262c0d0 100644 --- a/ironic/tests/unit/drivers/modules/ilo/test_inspect.py +++ b/ironic/tests/unit/drivers/modules/ilo/test_inspect.py @@ -65,7 +65,7 @@ class IloInspectTestCase(test_common.BaseIloTest): get_capabilities_mock): ilo_object_mock = get_ilo_object_mock.return_value properties = {'memory_mb': '512', 'local_gb': '10', - 'cpus': '1', 'cpu_arch': 'x86_64'} + 'cpu_arch': 'x86_64'} macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'} capabilities = {} result = {'properties': properties, 'macs': macs} @@ -103,8 +103,7 @@ class IloInspectTestCase(test_common.BaseIloTest): get_capabilities_mock, log_mock): ilo_object_mock = get_ilo_object_mock.return_value - properties = {'memory_mb': '512', 'local_gb': 0, - 'cpus': '1', 'cpu_arch': 'x86_64'} + properties = {'memory_mb': '512', 'local_gb': 0, 'cpu_arch': 'x86_64'} macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'} capabilities = {} result = {'properties': properties, 'macs': macs} @@ -118,7 +117,7 @@ class IloInspectTestCase(test_common.BaseIloTest): task.node.properties = properties task.node.save() expected_properties = {'memory_mb': '512', 'local_gb': 10, - 'cpus': '1', 'cpu_arch': 'x86_64'} + 'cpu_arch': 'x86_64'} task.driver.inspect.inspect_hardware(task) self.assertEqual(expected_properties, task.node.properties) power_mock.assert_called_once_with(mock.ANY, task) @@ -149,8 +148,7 @@ class IloInspectTestCase(test_common.BaseIloTest): get_capabilities_mock, log_mock): ilo_object_mock = get_ilo_object_mock.return_value - properties = {'memory_mb': '512', 'local_gb': 10, - 'cpus': '1', 'cpu_arch': 'x86_64'} + properties = {'memory_mb': '512', 'local_gb': 10, 'cpu_arch': 'x86_64'} macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'} capabilities = {'server_model': 'Gen8'} result = {'properties': properties, 'macs': macs} @@ -160,7 +158,7 @@ class IloInspectTestCase(test_common.BaseIloTest): with task_manager.acquire(self.context, self.node.uuid, shared=False) as task: expected_properties = {'memory_mb': '512', 'local_gb': 10, - 'cpus': '1', 'cpu_arch': 'x86_64', + 'cpu_arch': 'x86_64', 'capabilities': 'server_model:Gen8'} task.driver.inspect.inspect_hardware(task) self.assertEqual(expected_properties, task.node.properties) @@ -195,8 +193,7 @@ class IloInspectTestCase(test_common.BaseIloTest): get_security_params_mock, log_mock): ilo_object_mock = get_ilo_object_mock.return_value - properties = {'memory_mb': '512', 'local_gb': 10, - 'cpus': '1', 'cpu_arch': 'x86_64'} + properties = {'memory_mb': '512', 'local_gb': 10, 'cpu_arch': 'x86_64'} macs = {'NIC.LOM.1.1': 'aa:aa:aa:aa:aa:aa'} capabilities = {'server_model': 'Gen10'} security_params = ( @@ -209,7 +206,7 @@ class IloInspectTestCase(test_common.BaseIloTest): with task_manager.acquire(self.context, self.node.uuid, shared=False) as task: expected_properties = { - 'memory_mb': '512', 'local_gb': 10, 'cpus': '1', + 'memory_mb': '512', 'local_gb': 10, 'cpu_arch': 'x86_64', 'capabilities': 'server_model:Gen10', 'security_parameters': {'Password Complexity': 'ok'}} task.driver.inspect.inspect_hardware(task) @@ -243,7 +240,7 @@ class IloInspectTestCase(test_common.BaseIloTest): get_capabilities_mock): ilo_object_mock = get_ilo_object_mock.return_value properties = {'memory_mb': '512', 'local_gb': '10', - 'cpus': '1', 'cpu_arch': 'x86_64'} + 'cpu_arch': 'x86_64'} macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'} capabilities = {} result = {'properties': properties, 'macs': macs} @@ -280,7 +277,7 @@ class IloInspectTestCase(test_common.BaseIloTest): get_capabilities_mock): ilo_object_mock = get_ilo_object_mock.return_value properties = {'memory_mb': '512', 'local_gb': '10', - 'cpus': '1', 'cpu_arch': 'x86_64'} + 'cpu_arch': 'x86_64'} macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'} capability_str = 'sriov_enabled:true' capabilities = {'sriov_enabled': 'true'} @@ -292,7 +289,7 @@ class IloInspectTestCase(test_common.BaseIloTest): shared=False) as task: task.driver.inspect.inspect_hardware(task) expected_properties = {'memory_mb': '512', 'local_gb': '10', - 'cpus': '1', 'cpu_arch': 'x86_64', + 'cpu_arch': 'x86_64', 'capabilities': capability_str} self.assertEqual(expected_properties, task.node.properties) power_mock.assert_called_once_with(mock.ANY, task) @@ -320,8 +317,7 @@ class IloInspectTestCase(test_common.BaseIloTest): get_capabilities_mock): ilo_object_mock = get_ilo_object_mock.return_value properties = {'memory_mb': '512', 'local_gb': '10', - 'cpus': '1', 'cpu_arch': 'x86_64', - 'somekey': 'somevalue'} + 'cpu_arch': 'x86_64', 'somekey': 'somevalue'} macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'} result = {'properties': properties, 'macs': macs} capabilities = {'sriov_enabled': 'true'} @@ -339,7 +335,7 @@ class IloInspectTestCase(test_common.BaseIloTest): set2 = set(end_capabilities.split(',')) self.assertEqual(set1, set2) expected_properties = {'memory_mb': '512', 'local_gb': '10', - 'cpus': '1', 'cpu_arch': 'x86_64', + 'cpu_arch': 'x86_64', 'capabilities': end_capabilities} power_mock.assert_called_once_with(mock.ANY, task) self.assertEqual(task.node.properties, expected_properties) @@ -356,7 +352,7 @@ class TestInspectPrivateMethods(test_common.BaseIloTest): def test__get_essential_properties_ok(self): ilo_mock = mock.MagicMock(spec=['get_essential_properties']) properties = {'memory_mb': '512', 'local_gb': '10', - 'cpus': '1', 'cpu_arch': 'x86_64'} + 'cpu_arch': 'x86_64'} macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'} result = {'properties': properties, 'macs': macs} ilo_mock.get_essential_properties.return_value = result @@ -368,8 +364,7 @@ class TestInspectPrivateMethods(test_common.BaseIloTest): ilo_mock = mock.MagicMock( spec=['get_additional_capabilities', 'get_essential_properties']) # Missing key: cpu_arch - properties = {'memory_mb': '512', 'local_gb': '10', - 'cpus': '1'} + properties = {'memory_mb': '512', 'local_gb': '10'} macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'} result = {'properties': properties, 'macs': macs} ilo_mock.get_essential_properties.return_value = result @@ -386,8 +381,7 @@ class TestInspectPrivateMethods(test_common.BaseIloTest): ilo_mock = mock.MagicMock( spec=['get_additional_capabilities', 'get_essential_properties']) # Not a dict - properties = ['memory_mb', '512', 'local_gb', '10', - 'cpus', '1'] + properties = ['memory_mb', '512', 'local_gb', '10'] macs = ['aa:aa:aa:aa:aa:aa', 'bb:bb:bb:bb:bb:bb'] capabilities = '' result = {'properties': properties, 'macs': macs} @@ -400,7 +394,7 @@ class TestInspectPrivateMethods(test_common.BaseIloTest): def test__get_essential_properties_fail_mac_invalid_format(self): ilo_mock = mock.MagicMock(spec=['get_essential_properties']) properties = {'memory_mb': '512', 'local_gb': '10', - 'cpus': '1', 'cpu_arch': 'x86_64'} + 'cpu_arch': 'x86_64'} # Not a dict macs = 'aa:aa:aa:aa:aa:aa' result = {'properties': properties, 'macs': macs} @@ -413,7 +407,7 @@ class TestInspectPrivateMethods(test_common.BaseIloTest): ilo_mock = mock.MagicMock( spec=['get_additional_capabilities', 'get_essential_properties']) properties = {'memory_mb': '512', 'local_gb': '10', - 'cpus': '1', 'cpu_arch': 'x86_64'} + 'cpu_arch': 'x86_64'} # Not a dictionary macs = None result = {'properties': properties, 'macs': macs} @@ -427,7 +421,7 @@ class TestInspectPrivateMethods(test_common.BaseIloTest): def test__get_essential_properties_hardware_port_not_dict(self): ilo_mock = mock.MagicMock(spec=['get_essential_properties']) properties = {'memory_mb': '512', 'local_gb': '10', - 'cpus': '1', 'cpu_arch': 'x86_64'} + 'cpu_arch': 'x86_64'} # Not a dict macs = 'aa:bb:cc:dd:ee:ff' result = {'properties': properties, 'macs': macs} @@ -447,7 +441,7 @@ class TestInspectPrivateMethods(test_common.BaseIloTest): def test__validate_ok(self): properties = {'memory_mb': '512', 'local_gb': '10', - 'cpus': '2', 'cpu_arch': 'x86_arch'} + 'cpu_arch': 'x86_arch'} macs = {'Port 1': 'aa:aa:aa:aa:aa:aa'} data = {'properties': properties, 'macs': macs} valid_keys = ilo_inspect.IloInspect.ESSENTIAL_PROPERTIES @@ -455,8 +449,7 @@ class TestInspectPrivateMethods(test_common.BaseIloTest): self.assertEqual(sorted(set(properties)), sorted(valid_keys)) def test__validate_essential_keys_fail_missing_key(self): - properties = {'memory_mb': '512', 'local_gb': '10', - 'cpus': '1'} + properties = {'memory_mb': '512', 'local_gb': '10'} macs = {'Port 1': 'aa:aa:aa:aa:aa:aa'} data = {'properties': properties, 'macs': macs} self.assertRaises(exception.HardwareInspectionFailure, diff --git a/ironic/tests/unit/drivers/modules/irmc/test_inspect.py b/ironic/tests/unit/drivers/modules/irmc/test_inspect.py index 2cec2429f..e8762391f 100644 --- a/ironic/tests/unit/drivers/modules/irmc/test_inspect.py +++ b/ironic/tests/unit/drivers/modules/irmc/test_inspect.py @@ -83,7 +83,6 @@ class IRMCInspectInternalMethodsTestCase(test_common.BaseIRMCTest): inspected_props = { 'memory_mb': '1024', 'local_gb': 10, - 'cpus': 2, 'cpu_arch': 'x86_64'} inspected_capabilities = { 'irmc_firmware_version': 'iRMC S4-7.82F', @@ -142,7 +141,6 @@ class IRMCInspectInternalMethodsTestCase(test_common.BaseIRMCTest): inspected_props = { 'memory_mb': '1024', 'local_gb': 10, - 'cpus': 2, 'cpu_arch': 'x86_64'} inspected_capabilities = { 'irmc_firmware_version': 'iRMC S6-2.00S', @@ -260,7 +258,6 @@ class IRMCInspectTestCase(test_common.BaseIRMCTest): inspected_props = { 'memory_mb': '1024', 'local_gb': 10, - 'cpus': 2, 'cpu_arch': 'x86_64'} inspected_macs = ['aa:aa:aa:aa:aa:aa', 'bb:bb:bb:bb:bb:bb'] new_traits = ['CUSTOM_CPU_FPGA'] @@ -318,7 +315,6 @@ class IRMCInspectTestCase(test_common.BaseIRMCTest): inspected_props = { 'memory_mb': '1024', 'local_gb': 10, - 'cpus': 2, 'cpu_arch': 'x86_64'} inspected_macs = ['aa:aa:aa:aa:aa:aa', 'bb:bb:bb:bb:bb:bb'] new_traits = ['CUSTOM_CPU_FPGA'] @@ -398,7 +394,6 @@ class IRMCInspectTestCase(test_common.BaseIRMCTest): inspected_props = { 'memory_mb': '1024', 'local_gb': 10, - 'cpus': 2, 'cpu_arch': 'x86_64'} inspected_macs = ['aa:aa:aa:aa:aa:aa', 'bb:bb:bb:bb:bb:bb'] existing_traits = ['CUSTOM_CPU_FPGA'] @@ -459,7 +454,6 @@ class IRMCInspectTestCase(test_common.BaseIRMCTest): inspected_props = { 'memory_mb': '1024', 'local_gb': 10, - 'cpus': 2, 'cpu_arch': 'x86_64'} inspected_macs = ['aa:aa:aa:aa:aa:aa', 'bb:bb:bb:bb:bb:bb'] diff --git a/ironic/tests/unit/drivers/modules/redfish/test_inspect.py b/ironic/tests/unit/drivers/modules/redfish/test_inspect.py index dc1ffff4d..995dbb6d9 100644 --- a/ironic/tests/unit/drivers/modules/redfish/test_inspect.py +++ b/ironic/tests/unit/drivers/modules/redfish/test_inspect.py @@ -93,8 +93,7 @@ class RedfishInspectTestCase(db_base.DbTestCase): mock_get_system): expected_properties = { 'capabilities': 'boot_mode:uefi', - 'cpu_arch': 'mips', 'cpus': '8', - 'local_gb': '3', 'memory_mb': '2048' + 'cpu_arch': 'mips', 'local_gb': '3', 'memory_mb': '2048' } self.init_system_mock(mock_get_system.return_value) @@ -140,8 +139,7 @@ class RedfishInspectTestCase(db_base.DbTestCase): shared=True) as task: expected_properties = { 'capabilities': 'boot_mode:uefi', - 'cpu_arch': 'x86_64', 'cpus': '8', - 'local_gb': '3', 'memory_mb': '2048' + 'cpu_arch': 'x86_64', 'local_gb': '3', 'memory_mb': '2048' } task.driver.inspect.inspect_hardware(task) self.assertEqual(expected_properties, task.node.properties) @@ -156,8 +154,7 @@ class RedfishInspectTestCase(db_base.DbTestCase): shared=True) as task: expected_properties = { 'capabilities': 'boot_mode:uefi', - 'cpu_arch': 'mips', 'cpus': '8', - 'local_gb': '0', 'memory_mb': '2048' + 'cpu_arch': 'mips', 'local_gb': '0', 'memory_mb': '2048' } task.driver.inspect.inspect_hardware(task) self.assertEqual(expected_properties, task.node.properties) @@ -182,8 +179,7 @@ class RedfishInspectTestCase(db_base.DbTestCase): shared=True) as task: expected_properties = { 'capabilities': 'boot_mode:uefi', - 'cpu_arch': 'mips', 'cpus': '8', - 'local_gb': '3', 'memory_mb': '4096' + 'cpu_arch': 'mips', 'local_gb': '3', 'memory_mb': '4096' } task.driver.inspect.inspect_hardware(task) self.assertEqual(expected_properties, task.node.properties) @@ -212,8 +208,7 @@ class RedfishInspectTestCase(db_base.DbTestCase): } expected_properties = { 'capabilities': 'boot_mode:bios', - 'cpu_arch': 'mips', 'cpus': '8', - 'local_gb': '3', 'memory_mb': '2048' + 'cpu_arch': 'mips', 'local_gb': '3', 'memory_mb': '2048' } task.driver.inspect.inspect_hardware(task) self.assertEqual(expected_properties, task.node.properties) @@ -226,8 +221,7 @@ class RedfishInspectTestCase(db_base.DbTestCase): with task_manager.acquire(self.context, self.node.uuid, shared=True) as task: expected_properties = { - 'cpu_arch': 'mips', 'cpus': '8', - 'local_gb': '3', 'memory_mb': '2048' + 'cpu_arch': 'mips', 'local_gb': '3', 'memory_mb': '2048' } task.driver.inspect.inspect_hardware(task) self.assertEqual(expected_properties, task.node.properties) diff --git a/ironic/tests/unit/objects/test_node.py b/ironic/tests/unit/objects/test_node.py index 146120644..5ba823a89 100644 --- a/ironic/tests/unit/objects/test_node.py +++ b/ironic/tests/unit/objects/test_node.py @@ -534,10 +534,10 @@ class TestNodeObject(db_base.DbTestCase, obj_utils.SchemasTestMixIn): autospec=True) as mock_get_node: mock_get_node.return_value = self.fake_node node = objects.Node.get(self.context, uuid) - node.properties = {"local_gb": "5G", "memory_mb": "5", - 'cpus': '-1', 'cpu_arch': 'x86_64'} + node.properties = {"local_gb": "5G", "memory_mb": "-5", + 'cpu_arch': 'x86_64'} self.assertRaisesRegex(exception.InvalidParameterValue, - ".*local_gb=5G, cpus=-1$", node.save) + ".*local_gb=5G, memory_mb=-5$", node.save) mock_get_node.assert_called_once_with(uuid) def test__validate_property_values_success(self): @@ -549,7 +549,6 @@ class TestNodeObject(db_base.DbTestCase, obj_utils.SchemasTestMixIn): values = self.fake_node expect = { 'cpu_arch': 'x86_64', - "cpus": '8', "local_gb": '10', "memory_mb": '4096', } diff --git a/releasenotes/notes/no-cpus-c79717303470bf3c.yaml b/releasenotes/notes/no-cpus-c79717303470bf3c.yaml new file mode 100644 index 000000000..4f264e79b --- /dev/null +++ b/releasenotes/notes/no-cpus-c79717303470bf3c.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - | + Fully removes the ``cpus`` property from the documentation and inspect + interface implementations. It was never used internally by Ironic, + and is no longer used by Nova. -- cgit v1.2.1