Add _set_instance_obj_error_state() to compute manager

This provides an object-aware analog to the existing function,
which operates on an object instead of using a uuid and the
conductor instance update path.

Over time, we should be able to transition all existing uses to
this function, and then remove the old implementation.

Related to blueprint compute-api-objects

Change-Id: I781eadfb01a13bab9337ec05653a4780447731b8
This commit is contained in:
Dan Smith 2013-07-10 08:07:55 -07:00 committed by Chris Behrens
parent 207eda3b7e
commit e185c08ef7

View File

@ -412,6 +412,15 @@ class ComputeManager(manager.SchedulerDependentManager):
'trying to set it to ERROR'),
instance_uuid=instance_uuid)
def _set_instance_obj_error_state(self, context, instance):
try:
instance.vm_state = vm_states.ERROR
instance.save()
except exception.InstanceNotFound:
LOG.debug(_('Instance has been destroyed from under us while '
'trying to set it to ERROR'),
instance_uuid=instance.uuid)
def _get_instances_on_driver(self, context, filters=None,
columns_to_join=None):
"""Return a list of instance records for the instances found