summaryrefslogtreecommitdiff
path: root/nova/objects
diff options
context:
space:
mode:
authorMatt Riedemann <mriedem.os@gmail.com>2018-10-16 16:23:54 -0400
committerMatt Riedemann <mriedem.os@gmail.com>2018-10-16 16:23:54 -0400
commit498413074d1f11688123b6b592d5c204dc7b5ef2 (patch)
treec390643913ad89a23c66da0dd6db138fbe6cf385 /nova/objects
parenta53e46a75936b55c93face840764a67f2186cb11 (diff)
downloadnova-498413074d1f11688123b6b592d5c204dc7b5ef2.tar.gz
Ignore uuid if already set in ComputeNode.update_from_virt_driver
Change Ia69fabce8e7fd7de101e291fe133c6f5f5f7056a sets the ComputeNode.uuid to whatever the virt driver reports if the virt driver reports a uuid, like in the case of ironic. However, that breaks upgrades for any pre-existing compute node records which have a random uuid since ComputeNode.uuid is a read-only field once set. This change simply ignores the uuid from the virt driver resources dict if the ComputeNode.uuid is already set. The bug actually shows up in the ironic grenade CI job logs in stable/rocky but didn't fail the nova-compute startup because ComputeManager._update_available_resource_for_node() catches and just logs the error, but it doesn't kill the service. Change-Id: Id02f501feefca358d36f39b24d426537685e425c Closes-Bug: #1798172
Diffstat (limited to 'nova/objects')
-rw-r--r--nova/objects/compute_node.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/nova/objects/compute_node.py b/nova/objects/compute_node.py
index 702081cfc8..aa01b5e79f 100644
--- a/nova/objects/compute_node.py
+++ b/nova/objects/compute_node.py
@@ -351,6 +351,11 @@ class ComputeNode(base.NovaPersistentObject, base.NovaObject):
"disk_available_least", "host_ip", "uuid"]
for key in keys:
if key in resources:
+ # The uuid field is read-only so it should only be set when
+ # creating the compute node record for the first time. Ignore
+ # it otherwise.
+ if key == 'uuid' and 'uuid' in self:
+ continue
setattr(self, key, resources[key])
# supported_instances has a different name in compute_node