Merge "Ability to read deleted system metadata records."

This commit is contained in:
Jenkins
2012-06-29 21:31:56 +00:00
committed by Gerrit Code Review
2 changed files with 5 additions and 7 deletions

View File

@@ -761,12 +761,10 @@ class ComputeManager(manager.SchedulerDependentManager):
vm_state=vm_states.DELETED,
task_state=None,
terminated_at=timeutils.utcnow())
# Pull the system_metadata before we delete the instance, so we
# can pass it to delete.end notification, as it will not be able
# to look it up anymore, if it needs it.
system_meta = self.db.instance_system_metadata_get(context,
instance_uuid)
self.db.instance_destroy(context, instance_uuid)
with utils.temporary_mutation(context, read_deleted="yes"):
system_meta = self.db.instance_system_metadata_get(context,
instance_uuid)
self._notify_about_instance_usage(context, instance, "delete.end",
system_metadata=system_meta)

View File

@@ -4239,8 +4239,8 @@ def instance_metadata_update(context, instance_uuid, metadata, delete):
# System-owned metadata
def _instance_system_metadata_get_query(context, instance_uuid, session=None):
return model_query(context, models.InstanceSystemMetadata, session=session,
read_deleted="no").\
return model_query(context, models.InstanceSystemMetadata,
session=session).\
filter_by(instance_uuid=instance_uuid)