diff --git a/nova/conductor/manager.py b/nova/conductor/manager.py index 4f3a92b..290867e 100644 --- a/nova/conductor/manager.py +++ b/nova/conductor/manager.py @@ -575,8 +575,12 @@ class ComputeTaskManager(base.Base): return for (instance, host) in six.moves.zip(instances, hosts): + instance.availability_zone = ( + availability_zones.get_host_availability_zone(context, host)) try: - instance.refresh() + # NOTE(danms): This saves the az change above, refreshes our + # instance, and tells us if it has been deleted underneath us + instance.save() except (exception.InstanceNotFound, exception.InstanceInfoCacheNotFound): LOG.debug('Instance deleted during build', instance=instance) @@ -946,6 +950,9 @@ class ComputeTaskManager(base.Base): 'was already deleted.', instance=instance) continue else: + instance.availability_zone = ( + availability_zones.get_host_availability_zone( + context, instance.host)) with obj_target_cell(instance, cell): instance.create()