remove id field from CDM

There are 3 related fields(id, uuid and hostname) in ComputeNode[1].
according to [2], after nova api 2.53, the id of the hypervisor as a UUID.
and service.host is equal to hypervisor name for compute node.
so we can remove id and only keep uuid then set uuid to node.id

[1]:https://github.com/openstack/watcher/blob/master/watcher/decision_engine/model/collector/nova.py#L306
[2]:https://developer.openstack.org/api-ref/compute/?expanded=list-hypervisors-details-detail#list-hypervisors-details

Change-Id: Ie1d1ad56808270d936ec25186061f7f12cc49fdc
Closes-Bug: #1835192
Depends-on: I752fbfa560313e28e87d83e46431c283b4db4f23
Depends-on: I0975500f359de92b6d6fdea2e01614cf0ba73f05
This commit is contained in:
licanwei
2019-07-04 15:44:06 +08:00
parent 3d741d05aa
commit 4b83bf33e2
28 changed files with 172 additions and 157 deletions

View File

@@ -78,7 +78,7 @@ class TestNovaClusterDataModelCollector(base.TestCase):
disabled_reason='',
)
minimal_node = dict(
id=1337,
id='160a0e7b-8b0b-4854-8257-9c71dff4efcc',
hypervisor_hostname='test_hostname',
state='TEST_STATE',
status='TEST_STATUS',
@@ -149,7 +149,7 @@ class TestNovaClusterDataModelCollector(base.TestCase):
node = list(compute_nodes.values())[0]
instance = list(instances.values())[0]
self.assertEqual(node.uuid, 'test_hostname')
self.assertEqual(node.uuid, '160a0e7b-8b0b-4854-8257-9c71dff4efcc')
self.assertEqual(instance.uuid, 'ef500f7e-dac8-470f-960c-169486fce71b')
memory_total = node.memory - node.memory_mb_reserved