diff options
| author | Alex Meade <alex.meade@rackspace.com> | 2012-07-05 14:27:33 -0400 |
|---|---|---|
| committer | Alex Meade <alex.meade@rackspace.com> | 2012-07-05 14:30:54 -0400 |
| commit | 4cdc30796c7c76068898cd9e9280e8d7a11a57cb (patch) | |
| tree | b5ef6bb8d1a0c35801de8a1bf2e97dd463207664 /nova/compute | |
| parent | e883e9756c779793ca071ee3f052f5d13610a9ac (diff) | |
Add checks for retrieving deleted instance metadata for notification events.
This enables metadata for a deleted instance to be reported in usage
notifications. However, deleted metadata for a nondeleted instance will
not be shown.
Fixes bug 1021430.
Change-Id: I7ce5c720c7705be34724679bb4ff99fb8ba37a27
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/utils.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/nova/compute/utils.py b/nova/compute/utils.py index f0bfe7646..81726105c 100644 --- a/nova/compute/utils.py +++ b/nova/compute/utils.py @@ -23,6 +23,7 @@ from nova.network import model as network_model from nova import notifications from nova.notifier import api as notifier_api from nova.openstack.common import log +from nova import utils FLAGS = flags.FLAGS @@ -55,8 +56,13 @@ def notify_usage_exists(context, instance_ref, current_period=False, if system_metadata is None: try: - system_metadata = db.instance_system_metadata_get( - context, instance_ref.uuid) + if instance_ref.get('deleted'): + with utils.temporary_mutation(context, read_deleted='yes'): + system_metadata = db.instance_system_metadata_get( + context, instance_ref.uuid) + else: + system_metadata = db.instance_system_metadata_get( + context, instance_ref.uuid) except exception.NotFound: system_metadata = {} |
