Fix baremetal node property keys
The baremetal_client is creating test nodes with property keys that
don't match what the nova os-baremetal-nodes extension is pulling out of
the node properties from the ironic client. This results in KeyErrors
when this test runs in parallel to other baremetal tests that were added
to Tempest on 2/16 with commit ac0879accd2a451c54ed935297a6f8e0a8aaf25a.
Closes-Bug: #1423427
Co-authored-by: Adam Gandelman <adamg@ubuntu.com>
Change-Id: I3593f58de5088d2442fddd52c6a11d055bb4f6a0
diff --git a/tempest/api/baremetal/admin/base.py b/tempest/api/baremetal/admin/base.py
index 4f5c6c8..c93dfb8 100644
--- a/tempest/api/baremetal/admin/base.py
+++ b/tempest/api/baremetal/admin/base.py
@@ -115,21 +115,22 @@
@classmethod
@creates('node')
- def create_node(cls, chassis_id, cpu_arch='x86', cpu_num=8, storage=1024,
- memory=4096):
+ def create_node(cls, chassis_id, cpu_arch='x86', cpus=8, local_gb=10,
+ memory_mb=4096):
"""
Wrapper utility for creating test baremetal nodes.
:param cpu_arch: CPU architecture of the node. Default: x86.
- :param cpu_num: Number of CPUs. Default: 8.
- :param storage: Disk size. Default: 1024.
- :param memory: Available RAM. Default: 4096.
+ :param cpus: Number of CPUs. Default: 8.
+ :param local_gb: Disk size. Default: 10.
+ :param memory_mb: Available RAM. Default: 4096.
:return: Created node.
"""
resp, body = cls.client.create_node(chassis_id, cpu_arch=cpu_arch,
- cpu_num=cpu_num, storage=storage,
- memory=memory, driver=cls.driver)
+ cpus=cpus, local_gb=local_gb,
+ memory_mb=memory_mb,
+ driver=cls.driver)
return resp, body
diff --git a/tempest/api/baremetal/admin/test_nodes.py b/tempest/api/baremetal/admin/test_nodes.py
index 96f4b43..1919223 100644
--- a/tempest/api/baremetal/admin/test_nodes.py
+++ b/tempest/api/baremetal/admin/test_nodes.py
@@ -49,9 +49,9 @@
@test.attr(type='smoke')
def test_create_node(self):
params = {'cpu_arch': 'x86_64',
- 'cpu_num': '12',
- 'storage': '10240',
- 'memory': '1024'}
+ 'cpus': '12',
+ 'local_gb': '10',
+ 'memory_mb': '1024'}
_, body = self.create_node(self.chassis['uuid'], **params)
self._assertExpected(params, body['properties'])
@@ -107,16 +107,16 @@
@test.attr(type='smoke')
def test_update_node(self):
props = {'cpu_arch': 'x86_64',
- 'cpu_num': '12',
- 'storage': '10',
- 'memory': '128'}
+ 'cpus': '12',
+ 'local_gb': '10',
+ 'memory_mb': '128'}
_, node = self.create_node(self.chassis['uuid'], **props)
new_p = {'cpu_arch': 'x86',
- 'cpu_num': '1',
- 'storage': '10000',
- 'memory': '12300'}
+ 'cpus': '1',
+ 'local_gb': '10000',
+ 'memory_mb': '12300'}
_, body = self.client.update_node(node['uuid'], properties=new_p)
_, node = self.client.show_node(node['uuid'])
diff --git a/tempest/services/baremetal/v1/json/baremetal_client.py b/tempest/services/baremetal/v1/json/baremetal_client.py
index 1c72a2b..09b6cd1 100644
--- a/tempest/services/baremetal/v1/json/baremetal_client.py
+++ b/tempest/services/baremetal/v1/json/baremetal_client.py
@@ -136,18 +136,18 @@
Create a baremetal node with the specified parameters.
:param cpu_arch: CPU architecture of the node. Default: x86_64.
- :param cpu_num: Number of CPUs. Default: 8.
- :param storage: Disk size. Default: 1024.
- :param memory: Available RAM. Default: 4096.
+ :param cpus: Number of CPUs. Default: 8.
+ :param local_gb: Disk size. Default: 1024.
+ :param memory_mb: Available RAM. Default: 4096.
:param driver: Driver name. Default: "fake"
:return: A tuple with the server response and the created node.
"""
node = {'chassis_uuid': chassis_id,
'properties': {'cpu_arch': kwargs.get('cpu_arch', 'x86_64'),
- 'cpu_num': kwargs.get('cpu_num', 8),
- 'storage': kwargs.get('storage', 1024),
- 'memory': kwargs.get('memory', 4096)},
+ 'cpus': kwargs.get('cpus', 8),
+ 'local_gb': kwargs.get('local_gb', 1024),
+ 'memory_mb': kwargs.get('memory_mb', 4096)},
'driver': kwargs.get('driver', 'fake')}
return self._create_request('nodes', node)
@@ -232,9 +232,9 @@
"""
node_attributes = ('properties/cpu_arch',
- 'properties/cpu_num',
- 'properties/storage',
- 'properties/memory',
+ 'properties/cpus',
+ 'properties/local_gb',
+ 'properties/memory_mb',
'driver',
'instance_uuid')