check instance state for instance.update
In the process of creating an instance, Nova will emit an instance.update notification with 'building' state. This will cause a KeyError exception because this instance isn't in Watcher datamodel. So we should ignore the notification instance.update with 'building' state. Closes-Bug: #1832154 Change-Id: I950eec50d2cee38bd22c47a70ae6f88bbf049080
This commit is contained in:
@@ -216,7 +216,12 @@ class VersionedNotification(NovaNotification):
|
||||
def instance_updated(self, payload):
|
||||
instance_data = payload['nova_object.data']
|
||||
instance_uuid = instance_data['uuid']
|
||||
instance_state = instance_data['state']
|
||||
node_uuid = instance_data.get('host')
|
||||
# if instance state is building, don't update data model
|
||||
if instance_state == 'building':
|
||||
return
|
||||
|
||||
instance = self.get_or_create_instance(instance_uuid, node_uuid)
|
||||
|
||||
self.update_instance(instance, payload)
|
||||
|
||||
Reference in New Issue
Block a user