Comment 1 for bug 1688599

Revision history for this message
Chris Friesen (cbf123) wrote : Re: resource audit races against evacuating instance

Even after updating _instance_in_resize_state() to account for rebuilds from vm_states.ERROR, I think there is a further race condition. Down towards the end of _do_rebuild_instance() we call:

        self._update_instance_after_spawn(context, instance)
        instance.save(expected_task_state=[task_states.REBUILD_SPAWNING])

This sets the task_state to "None", but the new instance host doesn't get updated until a bit later down at the bottom of rebuild_instance(). During that window, the newly-rebuilt instance will not get accounted for in either _update_usage_from_instances() or _update_usage_from_migrations().