Log compute node uuid when the record is created

The ResourceTracker is logging when a compute node record
is created but does not include the UUID. This change adds
that information for context when tracing requests to the
Placement service after the compute node record is created
since the resource provider for the compute node is keyed
off the same UUID.

Change-Id: I1e26d7227ca866c0ab5c0b474efc293606c92a17
This commit is contained in:
Matt Riedemann 2017-07-17 14:30:02 -04:00
parent 56c4d684bf
commit db58e9253e
2 changed files with 6 additions and 4 deletions

View File

@ -528,9 +528,9 @@ class ResourceTracker(object):
self._copy_resources(cn, resources)
self.compute_nodes[nodename] = cn
cn.create()
LOG.info('Compute_service record created for '
'%(host)s:%(node)s',
{'host': self.host, 'node': nodename})
LOG.info('Compute node record created for '
'%(host)s:%(node)s with uuid: %(uuid)s',
{'host': self.host, 'node': nodename, 'uuid': cn.uuid})
self._setup_pci_tracker(context, cn, resources)
self._update(context, cn)

View File

@ -1067,7 +1067,8 @@ class TestInitComputeNode(BaseTestCase):
cpu_allocation_ratio=1.0,
disk_allocation_ratio=1.0,
stats={},
pci_device_pools=objects.PciDevicePoolList(objects=[])
pci_device_pools=objects.PciDevicePoolList(objects=[]),
uuid=uuids.compute_node_uuid
)
def set_cn_id():
@ -1076,6 +1077,7 @@ class TestInitComputeNode(BaseTestCase):
# 'id' in base class error
cn = self.rt.compute_nodes[_NODENAME]
cn.id = 42 # Has to be a number, not a mock
cn.uuid = uuids.compute_node_uuid
create_mock.side_effect = set_cn_id
self.rt._init_compute_node(mock.sentinel.ctx, resources)