Merge "Remove all references to the "cpus" property"

This commit is contained in:
Zuul 2023-04-27 23:10:00 +00:00 committed by Gerrit Code Review
commit c42c2efe95
19 changed files with 48 additions and 130 deletions

View File

@ -24,7 +24,6 @@
"52:54:00:90:35:d6" "52:54:00:90:35:d6"
], ],
"local_gb":10, "local_gb":10,
"cpus":1,
"cpu_arch":"x86_64", "cpu_arch":"x86_64",
"memory_mb":2048 "memory_mb":2048
} }

View File

@ -250,7 +250,6 @@ without affecting the operation of the system being inspected.
The inspection discovers the following properties: The inspection discovers the following properties:
* ``cpu_arch``: cpu architecture * ``cpu_arch``: cpu architecture
* ``cpus``: number of cpus
* ``local_gb``: disk size in gigabytes * ``local_gb``: disk size in gigabytes
* ``memory_mb``: memory size in megabytes * ``memory_mb``: memory size in megabytes

View File

@ -908,13 +908,10 @@ The hardware type ``ilo`` supports hardware inspection.
* ``snmp_auth_priv_protocol`` : The Privacy protocol. The valid * ``snmp_auth_priv_protocol`` : The Privacy protocol. The valid
values are "AES" and "DES". The iLO default value is "DES". values are "AES" and "DES". The iLO default value is "DES".
The inspection process will discover the following essential properties The inspection process will discover the following properties:
(properties required for scheduling deployment):
* ``memory_mb``: memory size * ``memory_mb``: memory size
* ``cpus``: number of cpus
* ``cpu_arch``: cpu architecture * ``cpu_arch``: cpu architecture
* ``local_gb``: disk size * ``local_gb``: disk size

View File

@ -465,13 +465,10 @@ configuration:
Supported properties Supported properties
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
The inspection process will discover the following essential properties The inspection process will discover the following properties:
(properties required for scheduling deployment):
* ``memory_mb``: memory size * ``memory_mb``: memory size
* ``cpus``: number of cpus
* ``cpu_arch``: cpu architecture * ``cpu_arch``: cpu architecture
* ``local_gb``: disk size * ``local_gb``: disk size

View File

@ -104,23 +104,6 @@ A few things should be checked in this case:
``True``; make sure the target nodes are in ``available`` and ``True``; make sure the target nodes are in ``available`` and
``maintenance`` is ``False``; ``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 <IRONIC NODE> --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 #. The Nova flavor that you are using does not match any properties of the
available Ironic nodes. Use available Ironic nodes. Use
:: ::

View File

@ -285,12 +285,13 @@ Adding scheduling information
This is not required for standalone deployments, only for those using This is not required for standalone deployments, only for those using
the Compute service for provisioning bare metal instances. 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 .. code-block:: console
$ baremetal node set $NODE_UUID \ $ baremetal node set $NODE_UUID \
--property cpus=$CPU_COUNT \
--property memory_mb=$RAM_MB \ --property memory_mb=$RAM_MB \
--property local_gb=$DISK_GB --property local_gb=$DISK_GB
@ -303,14 +304,13 @@ Adding scheduling information
--driver-info ipmi_username=$USER \ --driver-info ipmi_username=$USER \
--driver-info ipmi_password=$PASS \ --driver-info ipmi_password=$PASS \
--driver-info ipmi_address=$ADDRESS \ --driver-info ipmi_address=$ADDRESS \
--property cpus=$CPU_COUNT \
--property memory_mb=$RAM_MB \ --property memory_mb=$RAM_MB \
--property local_gb=$DISK_GB --property local_gb=$DISK_GB
These values can also be discovered during `Hardware Inspection`_. These values can also be discovered during `Hardware Inspection`_.
.. warning:: .. note::
The value provided for the ``local_gb`` property must match the size of The value provided for the ``local_gb`` property should match the size of
the root device you're going to deploy on. By default the root device you're going to deploy on. By default
**ironic-python-agent** picks the smallest disk which is not smaller **ironic-python-agent** picks the smallest disk which is not smaller
than 4 GiB. than 4 GiB.

View File

@ -87,9 +87,7 @@ Enrolling nodes
#. As in case of Compute service, you can also provide ``capabilities`` to node #. 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, 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``, boot mode).
``cpus`` etc. as Bare Metal service will require UUID of a node you're
going to deploy.
#. Then create a port to inform Bare Metal service of the network interface #. 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 cards which are part of the node by creating a port with each NIC's MAC

View File

@ -33,8 +33,7 @@ service and Bare Metal service::
| Property | Value | | Property | Value |
+------------------------+----------------------------------------------------------------------+ +------------------------+----------------------------------------------------------------------+
| instance_uuid | None | | instance_uuid | None |
| properties | {u'memory_mb': u'1024', u'cpu_arch': u'x86_64', u'local_gb': u'10', | | properties | {u'memory_mb': u'1024', u'cpu_arch': u'x86_64', u'local_gb': u'10'} |
| | u'cpus': u'1'} |
| maintenance | False | | maintenance | False |
| driver_info | { [SNIP] } | | driver_info | { [SNIP] } |
| extra | {} | | extra | {} |

View File

@ -1224,7 +1224,7 @@ class InspectInterface(BaseInterface):
"""Interface for inspection-related actions.""" """Interface for inspection-related actions."""
interface_type = 'inspect' 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.""" """The properties required by scheduler/deploy."""
@abc.abstractmethod @abc.abstractmethod

View File

@ -176,8 +176,6 @@ class DracWSManInspect(base.InspectInterface):
[memory.size_mb for memory in client.list_memory()]) [memory.size_mb for memory in client.list_memory()])
cpus = client.list_cpus() cpus = client.list_cpus()
if 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' properties['cpu_arch'] = 'x86_64' if cpus[0].arch64 else 'x86'
bios_settings = client.list_bios_settings() bios_settings = client.list_bios_settings()
@ -264,18 +262,6 @@ class DracWSManInspect(base.InspectInterface):
if disk.size_mb >= min_size_required_mb: if disk.size_mb >= min_size_required_mb:
return disk 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): def _calculate_gpus(self, video_controllers):
"""Find actual GPU count. """Find actual GPU count.

View File

@ -108,9 +108,7 @@ class RedfishInspect(base.InspectInterface):
system.memory_summary.size_gib * units.Ki) system.memory_summary.size_gib * units.Ki)
if system.processors and system.processors.summary: if system.processors and system.processors.summary:
cpus, arch = system.processors.summary arch = system.processors.summary[1]
if cpus:
inspected_properties['cpus'] = cpus
if arch: if arch:
try: try:

View File

@ -29,7 +29,7 @@ from ironic.objects import base
from ironic.objects import fields as object_fields from ironic.objects import fields as object_fields
from ironic.objects import notification from ironic.objects import notification
REQUIRED_INT_PROPERTIES = ['local_gb', 'cpus', 'memory_mb'] REQUIRED_INT_PROPERTIES = ['local_gb', 'memory_mb']
CONF = cfg.CONF CONF = cfg.CONF
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
@ -191,7 +191,7 @@ class Node(base.IronicObject, object_base.VersionedObjectDictCompat):
return d return d
def _validate_property_values(self, properties): 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. :param properties: a dict contains the node's information.
""" """

View File

@ -165,7 +165,6 @@ def get_test_snmp_info(**kw):
def get_test_node(**kw): def get_test_node(**kw):
properties = { properties = {
"cpu_arch": "x86_64", "cpu_arch": "x86_64",
"cpus": "8",
"local_gb": "10", "local_gb": "10",
"memory_mb": "4096", "memory_mb": "4096",
} }
@ -509,7 +508,6 @@ def create_test_node_tag(**kw):
def get_test_xclarity_properties(): def get_test_xclarity_properties():
return { return {
"cpu_arch": "x86_64", "cpu_arch": "x86_64",
"cpus": "8",
"local_gb": "10", "local_gb": "10",
"memory_mb": "4096", "memory_mb": "4096",
} }

View File

@ -185,7 +185,6 @@ class DracInspectionTestCase(test_utils.BaseDracTest):
expected_node_properties = { expected_node_properties = {
'memory_mb': 32768, 'memory_mb': 32768,
'local_gb': 1116, 'local_gb': 1116,
'cpus': 18,
'cpu_arch': 'x86_64', 'cpu_arch': 'x86_64',
'capabilities': 'boot_mode:uefi,pci_gpu_devices:1'} 'capabilities': 'boot_mode:uefi,pci_gpu_devices:1'}
mock_client = mock.Mock() mock_client = mock.Mock()
@ -235,7 +234,6 @@ class DracInspectionTestCase(test_utils.BaseDracTest):
expected_node_properties = { expected_node_properties = {
'memory_mb': 32768, 'memory_mb': 32768,
'local_gb': 279, 'local_gb': 279,
'cpus': 18,
'cpu_arch': 'x86_64', 'cpu_arch': 'x86_64',
'capabilities': 'boot_mode:uefi,pci_gpu_devices:1'} 'capabilities': 'boot_mode:uefi,pci_gpu_devices:1'}
mock_client = mock.Mock() mock_client = mock.Mock()
@ -305,7 +303,6 @@ class DracInspectionTestCase(test_utils.BaseDracTest):
expected_node_properties = { expected_node_properties = {
'memory_mb': 32768, 'memory_mb': 32768,
'local_gb': 279, 'local_gb': 279,
'cpus': 18,
'cpu_arch': 'x86_64', 'cpu_arch': 'x86_64',
'capabilities': 'boot_mode:uefi,pci_gpu_devices:0'} 'capabilities': 'boot_mode:uefi,pci_gpu_devices:0'}
mock_client = mock.Mock() mock_client = mock.Mock()
@ -355,7 +352,6 @@ class DracInspectionTestCase(test_utils.BaseDracTest):
expected_node_properties = { expected_node_properties = {
'memory_mb': 32768, 'memory_mb': 32768,
'local_gb': 279, 'local_gb': 279,
'cpus': 18,
'cpu_arch': 'x86_64', 'cpu_arch': 'x86_64',
'capabilities': 'boot_mode:uefi,pci_gpu_devices:2'} 'capabilities': 'boot_mode:uefi,pci_gpu_devices:2'}
mock_client = mock.Mock() mock_client = mock.Mock()
@ -387,7 +383,6 @@ class DracInspectionTestCase(test_utils.BaseDracTest):
expected_node_properties = { expected_node_properties = {
'memory_mb': 32768, 'memory_mb': 32768,
'local_gb': 279, 'local_gb': 279,
'cpus': 18,
'cpu_arch': 'x86_64', 'cpu_arch': 'x86_64',
'capabilities': 'boot_mode:uefi,pci_gpu_devices:0'} 'capabilities': 'boot_mode:uefi,pci_gpu_devices:0'}
mock_client = mock.Mock() mock_client = mock.Mock()
@ -417,7 +412,6 @@ class DracInspectionTestCase(test_utils.BaseDracTest):
expected_node_properties = { expected_node_properties = {
'memory_mb': 32768, 'memory_mb': 32768,
'local_gb': 1116, 'local_gb': 1116,
'cpus': 18,
'cpu_arch': 'x86_64', 'cpu_arch': 'x86_64',
'capabilities': 'boot_mode:uefi,pci_gpu_devices:1'} 'capabilities': 'boot_mode:uefi,pci_gpu_devices:1'}
mock_client = mock.Mock() mock_client = mock.Mock()
@ -449,22 +443,6 @@ class DracInspectionTestCase(test_utils.BaseDracTest):
self.assertEqual(285888, root_disk.size_mb) 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, @mock.patch.object(drac_common, 'get_drac_client', spec_set=True,
autospec=True) autospec=True)
def test__get_pxe_dev_nics_with_UEFI_boot_mode(self, mock_get_drac_client): def test__get_pxe_dev_nics_with_UEFI_boot_mode(self, mock_get_drac_client):

View File

@ -65,7 +65,7 @@ class IloInspectTestCase(test_common.BaseIloTest):
get_capabilities_mock): get_capabilities_mock):
ilo_object_mock = get_ilo_object_mock.return_value ilo_object_mock = get_ilo_object_mock.return_value
properties = {'memory_mb': '512', 'local_gb': '10', 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'} macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'}
capabilities = {} capabilities = {}
result = {'properties': properties, 'macs': macs} result = {'properties': properties, 'macs': macs}
@ -103,8 +103,7 @@ class IloInspectTestCase(test_common.BaseIloTest):
get_capabilities_mock, get_capabilities_mock,
log_mock): log_mock):
ilo_object_mock = get_ilo_object_mock.return_value ilo_object_mock = get_ilo_object_mock.return_value
properties = {'memory_mb': '512', 'local_gb': 0, properties = {'memory_mb': '512', 'local_gb': 0, 'cpu_arch': 'x86_64'}
'cpus': '1', 'cpu_arch': 'x86_64'}
macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'} macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'}
capabilities = {} capabilities = {}
result = {'properties': properties, 'macs': macs} result = {'properties': properties, 'macs': macs}
@ -118,7 +117,7 @@ class IloInspectTestCase(test_common.BaseIloTest):
task.node.properties = properties task.node.properties = properties
task.node.save() task.node.save()
expected_properties = {'memory_mb': '512', 'local_gb': 10, expected_properties = {'memory_mb': '512', 'local_gb': 10,
'cpus': '1', 'cpu_arch': 'x86_64'} 'cpu_arch': 'x86_64'}
task.driver.inspect.inspect_hardware(task) task.driver.inspect.inspect_hardware(task)
self.assertEqual(expected_properties, task.node.properties) self.assertEqual(expected_properties, task.node.properties)
power_mock.assert_called_once_with(mock.ANY, task) power_mock.assert_called_once_with(mock.ANY, task)
@ -149,8 +148,7 @@ class IloInspectTestCase(test_common.BaseIloTest):
get_capabilities_mock, get_capabilities_mock,
log_mock): log_mock):
ilo_object_mock = get_ilo_object_mock.return_value ilo_object_mock = get_ilo_object_mock.return_value
properties = {'memory_mb': '512', 'local_gb': 10, properties = {'memory_mb': '512', 'local_gb': 10, 'cpu_arch': 'x86_64'}
'cpus': '1', 'cpu_arch': 'x86_64'}
macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'} macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'}
capabilities = {'server_model': 'Gen8'} capabilities = {'server_model': 'Gen8'}
result = {'properties': properties, 'macs': macs} result = {'properties': properties, 'macs': macs}
@ -160,7 +158,7 @@ class IloInspectTestCase(test_common.BaseIloTest):
with task_manager.acquire(self.context, self.node.uuid, with task_manager.acquire(self.context, self.node.uuid,
shared=False) as task: shared=False) as task:
expected_properties = {'memory_mb': '512', 'local_gb': 10, expected_properties = {'memory_mb': '512', 'local_gb': 10,
'cpus': '1', 'cpu_arch': 'x86_64', 'cpu_arch': 'x86_64',
'capabilities': 'server_model:Gen8'} 'capabilities': 'server_model:Gen8'}
task.driver.inspect.inspect_hardware(task) task.driver.inspect.inspect_hardware(task)
self.assertEqual(expected_properties, task.node.properties) self.assertEqual(expected_properties, task.node.properties)
@ -195,8 +193,7 @@ class IloInspectTestCase(test_common.BaseIloTest):
get_security_params_mock, get_security_params_mock,
log_mock): log_mock):
ilo_object_mock = get_ilo_object_mock.return_value ilo_object_mock = get_ilo_object_mock.return_value
properties = {'memory_mb': '512', 'local_gb': 10, properties = {'memory_mb': '512', 'local_gb': 10, 'cpu_arch': 'x86_64'}
'cpus': '1', 'cpu_arch': 'x86_64'}
macs = {'NIC.LOM.1.1': 'aa:aa:aa:aa:aa:aa'} macs = {'NIC.LOM.1.1': 'aa:aa:aa:aa:aa:aa'}
capabilities = {'server_model': 'Gen10'} capabilities = {'server_model': 'Gen10'}
security_params = ( security_params = (
@ -209,7 +206,7 @@ class IloInspectTestCase(test_common.BaseIloTest):
with task_manager.acquire(self.context, self.node.uuid, with task_manager.acquire(self.context, self.node.uuid,
shared=False) as task: shared=False) as task:
expected_properties = { expected_properties = {
'memory_mb': '512', 'local_gb': 10, 'cpus': '1', 'memory_mb': '512', 'local_gb': 10,
'cpu_arch': 'x86_64', 'capabilities': 'server_model:Gen10', 'cpu_arch': 'x86_64', 'capabilities': 'server_model:Gen10',
'security_parameters': {'Password Complexity': 'ok'}} 'security_parameters': {'Password Complexity': 'ok'}}
task.driver.inspect.inspect_hardware(task) task.driver.inspect.inspect_hardware(task)
@ -243,7 +240,7 @@ class IloInspectTestCase(test_common.BaseIloTest):
get_capabilities_mock): get_capabilities_mock):
ilo_object_mock = get_ilo_object_mock.return_value ilo_object_mock = get_ilo_object_mock.return_value
properties = {'memory_mb': '512', 'local_gb': '10', 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'} macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'}
capabilities = {} capabilities = {}
result = {'properties': properties, 'macs': macs} result = {'properties': properties, 'macs': macs}
@ -280,7 +277,7 @@ class IloInspectTestCase(test_common.BaseIloTest):
get_capabilities_mock): get_capabilities_mock):
ilo_object_mock = get_ilo_object_mock.return_value ilo_object_mock = get_ilo_object_mock.return_value
properties = {'memory_mb': '512', 'local_gb': '10', 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'} macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'}
capability_str = 'sriov_enabled:true' capability_str = 'sriov_enabled:true'
capabilities = {'sriov_enabled': 'true'} capabilities = {'sriov_enabled': 'true'}
@ -292,7 +289,7 @@ class IloInspectTestCase(test_common.BaseIloTest):
shared=False) as task: shared=False) as task:
task.driver.inspect.inspect_hardware(task) task.driver.inspect.inspect_hardware(task)
expected_properties = {'memory_mb': '512', 'local_gb': '10', expected_properties = {'memory_mb': '512', 'local_gb': '10',
'cpus': '1', 'cpu_arch': 'x86_64', 'cpu_arch': 'x86_64',
'capabilities': capability_str} 'capabilities': capability_str}
self.assertEqual(expected_properties, task.node.properties) self.assertEqual(expected_properties, task.node.properties)
power_mock.assert_called_once_with(mock.ANY, task) power_mock.assert_called_once_with(mock.ANY, task)
@ -320,8 +317,7 @@ class IloInspectTestCase(test_common.BaseIloTest):
get_capabilities_mock): get_capabilities_mock):
ilo_object_mock = get_ilo_object_mock.return_value ilo_object_mock = get_ilo_object_mock.return_value
properties = {'memory_mb': '512', 'local_gb': '10', properties = {'memory_mb': '512', 'local_gb': '10',
'cpus': '1', 'cpu_arch': 'x86_64', 'cpu_arch': 'x86_64', 'somekey': 'somevalue'}
'somekey': 'somevalue'}
macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'} macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'}
result = {'properties': properties, 'macs': macs} result = {'properties': properties, 'macs': macs}
capabilities = {'sriov_enabled': 'true'} capabilities = {'sriov_enabled': 'true'}
@ -339,7 +335,7 @@ class IloInspectTestCase(test_common.BaseIloTest):
set2 = set(end_capabilities.split(',')) set2 = set(end_capabilities.split(','))
self.assertEqual(set1, set2) self.assertEqual(set1, set2)
expected_properties = {'memory_mb': '512', 'local_gb': '10', expected_properties = {'memory_mb': '512', 'local_gb': '10',
'cpus': '1', 'cpu_arch': 'x86_64', 'cpu_arch': 'x86_64',
'capabilities': end_capabilities} 'capabilities': end_capabilities}
power_mock.assert_called_once_with(mock.ANY, task) power_mock.assert_called_once_with(mock.ANY, task)
self.assertEqual(task.node.properties, expected_properties) self.assertEqual(task.node.properties, expected_properties)
@ -356,7 +352,7 @@ class TestInspectPrivateMethods(test_common.BaseIloTest):
def test__get_essential_properties_ok(self): def test__get_essential_properties_ok(self):
ilo_mock = mock.MagicMock(spec=['get_essential_properties']) ilo_mock = mock.MagicMock(spec=['get_essential_properties'])
properties = {'memory_mb': '512', 'local_gb': '10', 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'} macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'}
result = {'properties': properties, 'macs': macs} result = {'properties': properties, 'macs': macs}
ilo_mock.get_essential_properties.return_value = result ilo_mock.get_essential_properties.return_value = result
@ -368,8 +364,7 @@ class TestInspectPrivateMethods(test_common.BaseIloTest):
ilo_mock = mock.MagicMock( ilo_mock = mock.MagicMock(
spec=['get_additional_capabilities', 'get_essential_properties']) spec=['get_additional_capabilities', 'get_essential_properties'])
# Missing key: cpu_arch # Missing key: cpu_arch
properties = {'memory_mb': '512', 'local_gb': '10', properties = {'memory_mb': '512', 'local_gb': '10'}
'cpus': '1'}
macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'} macs = {'Port 1': 'aa:aa:aa:aa:aa:aa', 'Port 2': 'bb:bb:bb:bb:bb:bb'}
result = {'properties': properties, 'macs': macs} result = {'properties': properties, 'macs': macs}
ilo_mock.get_essential_properties.return_value = result ilo_mock.get_essential_properties.return_value = result
@ -386,8 +381,7 @@ class TestInspectPrivateMethods(test_common.BaseIloTest):
ilo_mock = mock.MagicMock( ilo_mock = mock.MagicMock(
spec=['get_additional_capabilities', 'get_essential_properties']) spec=['get_additional_capabilities', 'get_essential_properties'])
# Not a dict # Not a dict
properties = ['memory_mb', '512', 'local_gb', '10', properties = ['memory_mb', '512', 'local_gb', '10']
'cpus', '1']
macs = ['aa:aa:aa:aa:aa:aa', 'bb:bb:bb:bb:bb:bb'] macs = ['aa:aa:aa:aa:aa:aa', 'bb:bb:bb:bb:bb:bb']
capabilities = '' capabilities = ''
result = {'properties': properties, 'macs': macs} result = {'properties': properties, 'macs': macs}
@ -400,7 +394,7 @@ class TestInspectPrivateMethods(test_common.BaseIloTest):
def test__get_essential_properties_fail_mac_invalid_format(self): def test__get_essential_properties_fail_mac_invalid_format(self):
ilo_mock = mock.MagicMock(spec=['get_essential_properties']) ilo_mock = mock.MagicMock(spec=['get_essential_properties'])
properties = {'memory_mb': '512', 'local_gb': '10', properties = {'memory_mb': '512', 'local_gb': '10',
'cpus': '1', 'cpu_arch': 'x86_64'} 'cpu_arch': 'x86_64'}
# Not a dict # Not a dict
macs = 'aa:aa:aa:aa:aa:aa' macs = 'aa:aa:aa:aa:aa:aa'
result = {'properties': properties, 'macs': macs} result = {'properties': properties, 'macs': macs}
@ -413,7 +407,7 @@ class TestInspectPrivateMethods(test_common.BaseIloTest):
ilo_mock = mock.MagicMock( ilo_mock = mock.MagicMock(
spec=['get_additional_capabilities', 'get_essential_properties']) spec=['get_additional_capabilities', 'get_essential_properties'])
properties = {'memory_mb': '512', 'local_gb': '10', properties = {'memory_mb': '512', 'local_gb': '10',
'cpus': '1', 'cpu_arch': 'x86_64'} 'cpu_arch': 'x86_64'}
# Not a dictionary # Not a dictionary
macs = None macs = None
result = {'properties': properties, 'macs': macs} result = {'properties': properties, 'macs': macs}
@ -427,7 +421,7 @@ class TestInspectPrivateMethods(test_common.BaseIloTest):
def test__get_essential_properties_hardware_port_not_dict(self): def test__get_essential_properties_hardware_port_not_dict(self):
ilo_mock = mock.MagicMock(spec=['get_essential_properties']) ilo_mock = mock.MagicMock(spec=['get_essential_properties'])
properties = {'memory_mb': '512', 'local_gb': '10', properties = {'memory_mb': '512', 'local_gb': '10',
'cpus': '1', 'cpu_arch': 'x86_64'} 'cpu_arch': 'x86_64'}
# Not a dict # Not a dict
macs = 'aa:bb:cc:dd:ee:ff' macs = 'aa:bb:cc:dd:ee:ff'
result = {'properties': properties, 'macs': macs} result = {'properties': properties, 'macs': macs}
@ -447,7 +441,7 @@ class TestInspectPrivateMethods(test_common.BaseIloTest):
def test__validate_ok(self): def test__validate_ok(self):
properties = {'memory_mb': '512', 'local_gb': '10', 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'} macs = {'Port 1': 'aa:aa:aa:aa:aa:aa'}
data = {'properties': properties, 'macs': macs} data = {'properties': properties, 'macs': macs}
valid_keys = ilo_inspect.IloInspect.ESSENTIAL_PROPERTIES valid_keys = ilo_inspect.IloInspect.ESSENTIAL_PROPERTIES
@ -455,8 +449,7 @@ class TestInspectPrivateMethods(test_common.BaseIloTest):
self.assertEqual(sorted(set(properties)), sorted(valid_keys)) self.assertEqual(sorted(set(properties)), sorted(valid_keys))
def test__validate_essential_keys_fail_missing_key(self): def test__validate_essential_keys_fail_missing_key(self):
properties = {'memory_mb': '512', 'local_gb': '10', properties = {'memory_mb': '512', 'local_gb': '10'}
'cpus': '1'}
macs = {'Port 1': 'aa:aa:aa:aa:aa:aa'} macs = {'Port 1': 'aa:aa:aa:aa:aa:aa'}
data = {'properties': properties, 'macs': macs} data = {'properties': properties, 'macs': macs}
self.assertRaises(exception.HardwareInspectionFailure, self.assertRaises(exception.HardwareInspectionFailure,

View File

@ -83,7 +83,6 @@ class IRMCInspectInternalMethodsTestCase(test_common.BaseIRMCTest):
inspected_props = { inspected_props = {
'memory_mb': '1024', 'memory_mb': '1024',
'local_gb': 10, 'local_gb': 10,
'cpus': 2,
'cpu_arch': 'x86_64'} 'cpu_arch': 'x86_64'}
inspected_capabilities = { inspected_capabilities = {
'irmc_firmware_version': 'iRMC S4-7.82F', 'irmc_firmware_version': 'iRMC S4-7.82F',
@ -142,7 +141,6 @@ class IRMCInspectInternalMethodsTestCase(test_common.BaseIRMCTest):
inspected_props = { inspected_props = {
'memory_mb': '1024', 'memory_mb': '1024',
'local_gb': 10, 'local_gb': 10,
'cpus': 2,
'cpu_arch': 'x86_64'} 'cpu_arch': 'x86_64'}
inspected_capabilities = { inspected_capabilities = {
'irmc_firmware_version': 'iRMC S6-2.00S', 'irmc_firmware_version': 'iRMC S6-2.00S',
@ -260,7 +258,6 @@ class IRMCInspectTestCase(test_common.BaseIRMCTest):
inspected_props = { inspected_props = {
'memory_mb': '1024', 'memory_mb': '1024',
'local_gb': 10, 'local_gb': 10,
'cpus': 2,
'cpu_arch': 'x86_64'} 'cpu_arch': 'x86_64'}
inspected_macs = ['aa:aa:aa:aa:aa:aa', 'bb:bb:bb:bb:bb:bb'] inspected_macs = ['aa:aa:aa:aa:aa:aa', 'bb:bb:bb:bb:bb:bb']
new_traits = ['CUSTOM_CPU_FPGA'] new_traits = ['CUSTOM_CPU_FPGA']
@ -318,7 +315,6 @@ class IRMCInspectTestCase(test_common.BaseIRMCTest):
inspected_props = { inspected_props = {
'memory_mb': '1024', 'memory_mb': '1024',
'local_gb': 10, 'local_gb': 10,
'cpus': 2,
'cpu_arch': 'x86_64'} 'cpu_arch': 'x86_64'}
inspected_macs = ['aa:aa:aa:aa:aa:aa', 'bb:bb:bb:bb:bb:bb'] inspected_macs = ['aa:aa:aa:aa:aa:aa', 'bb:bb:bb:bb:bb:bb']
new_traits = ['CUSTOM_CPU_FPGA'] new_traits = ['CUSTOM_CPU_FPGA']
@ -398,7 +394,6 @@ class IRMCInspectTestCase(test_common.BaseIRMCTest):
inspected_props = { inspected_props = {
'memory_mb': '1024', 'memory_mb': '1024',
'local_gb': 10, 'local_gb': 10,
'cpus': 2,
'cpu_arch': 'x86_64'} 'cpu_arch': 'x86_64'}
inspected_macs = ['aa:aa:aa:aa:aa:aa', 'bb:bb:bb:bb:bb:bb'] inspected_macs = ['aa:aa:aa:aa:aa:aa', 'bb:bb:bb:bb:bb:bb']
existing_traits = ['CUSTOM_CPU_FPGA'] existing_traits = ['CUSTOM_CPU_FPGA']
@ -459,7 +454,6 @@ class IRMCInspectTestCase(test_common.BaseIRMCTest):
inspected_props = { inspected_props = {
'memory_mb': '1024', 'memory_mb': '1024',
'local_gb': 10, 'local_gb': 10,
'cpus': 2,
'cpu_arch': 'x86_64'} 'cpu_arch': 'x86_64'}
inspected_macs = ['aa:aa:aa:aa:aa:aa', 'bb:bb:bb:bb:bb:bb'] inspected_macs = ['aa:aa:aa:aa:aa:aa', 'bb:bb:bb:bb:bb:bb']

View File

@ -93,8 +93,7 @@ class RedfishInspectTestCase(db_base.DbTestCase):
mock_get_system): mock_get_system):
expected_properties = { expected_properties = {
'capabilities': 'boot_mode:uefi', 'capabilities': 'boot_mode:uefi',
'cpu_arch': 'mips', 'cpus': '8', 'cpu_arch': 'mips', 'local_gb': '3', 'memory_mb': '2048'
'local_gb': '3', 'memory_mb': '2048'
} }
self.init_system_mock(mock_get_system.return_value) self.init_system_mock(mock_get_system.return_value)
@ -140,8 +139,7 @@ class RedfishInspectTestCase(db_base.DbTestCase):
shared=True) as task: shared=True) as task:
expected_properties = { expected_properties = {
'capabilities': 'boot_mode:uefi', 'capabilities': 'boot_mode:uefi',
'cpu_arch': 'x86_64', 'cpus': '8', 'cpu_arch': 'x86_64', 'local_gb': '3', 'memory_mb': '2048'
'local_gb': '3', 'memory_mb': '2048'
} }
task.driver.inspect.inspect_hardware(task) task.driver.inspect.inspect_hardware(task)
self.assertEqual(expected_properties, task.node.properties) self.assertEqual(expected_properties, task.node.properties)
@ -156,8 +154,7 @@ class RedfishInspectTestCase(db_base.DbTestCase):
shared=True) as task: shared=True) as task:
expected_properties = { expected_properties = {
'capabilities': 'boot_mode:uefi', 'capabilities': 'boot_mode:uefi',
'cpu_arch': 'mips', 'cpus': '8', 'cpu_arch': 'mips', 'local_gb': '0', 'memory_mb': '2048'
'local_gb': '0', 'memory_mb': '2048'
} }
task.driver.inspect.inspect_hardware(task) task.driver.inspect.inspect_hardware(task)
self.assertEqual(expected_properties, task.node.properties) self.assertEqual(expected_properties, task.node.properties)
@ -182,8 +179,7 @@ class RedfishInspectTestCase(db_base.DbTestCase):
shared=True) as task: shared=True) as task:
expected_properties = { expected_properties = {
'capabilities': 'boot_mode:uefi', 'capabilities': 'boot_mode:uefi',
'cpu_arch': 'mips', 'cpus': '8', 'cpu_arch': 'mips', 'local_gb': '3', 'memory_mb': '4096'
'local_gb': '3', 'memory_mb': '4096'
} }
task.driver.inspect.inspect_hardware(task) task.driver.inspect.inspect_hardware(task)
self.assertEqual(expected_properties, task.node.properties) self.assertEqual(expected_properties, task.node.properties)
@ -212,8 +208,7 @@ class RedfishInspectTestCase(db_base.DbTestCase):
} }
expected_properties = { expected_properties = {
'capabilities': 'boot_mode:bios', 'capabilities': 'boot_mode:bios',
'cpu_arch': 'mips', 'cpus': '8', 'cpu_arch': 'mips', 'local_gb': '3', 'memory_mb': '2048'
'local_gb': '3', 'memory_mb': '2048'
} }
task.driver.inspect.inspect_hardware(task) task.driver.inspect.inspect_hardware(task)
self.assertEqual(expected_properties, task.node.properties) 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, with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task: shared=True) as task:
expected_properties = { expected_properties = {
'cpu_arch': 'mips', 'cpus': '8', 'cpu_arch': 'mips', 'local_gb': '3', 'memory_mb': '2048'
'local_gb': '3', 'memory_mb': '2048'
} }
task.driver.inspect.inspect_hardware(task) task.driver.inspect.inspect_hardware(task)
self.assertEqual(expected_properties, task.node.properties) self.assertEqual(expected_properties, task.node.properties)

View File

@ -534,10 +534,10 @@ class TestNodeObject(db_base.DbTestCase, obj_utils.SchemasTestMixIn):
autospec=True) as mock_get_node: autospec=True) as mock_get_node:
mock_get_node.return_value = self.fake_node mock_get_node.return_value = self.fake_node
node = objects.Node.get(self.context, uuid) node = objects.Node.get(self.context, uuid)
node.properties = {"local_gb": "5G", "memory_mb": "5", node.properties = {"local_gb": "5G", "memory_mb": "-5",
'cpus': '-1', 'cpu_arch': 'x86_64'} 'cpu_arch': 'x86_64'}
self.assertRaisesRegex(exception.InvalidParameterValue, 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) mock_get_node.assert_called_once_with(uuid)
def test__validate_property_values_success(self): def test__validate_property_values_success(self):
@ -549,7 +549,6 @@ class TestNodeObject(db_base.DbTestCase, obj_utils.SchemasTestMixIn):
values = self.fake_node values = self.fake_node
expect = { expect = {
'cpu_arch': 'x86_64', 'cpu_arch': 'x86_64',
"cpus": '8',
"local_gb": '10', "local_gb": '10',
"memory_mb": '4096', "memory_mb": '4096',
} }

View File

@ -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.