summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMonsyne Dragon <mdragon@rackspace.com>2012-02-17 22:11:46 +0000
committerMonsyne Dragon <mdragon@rackspace.com>2012-02-17 22:25:49 +0000
commit13789e970beaf932add81f71a2ab528aa309a231 (patch)
tree3bffa46266de469cd775d6471657265277824a56
parent24716297334bccee029de62151bada216d896a3f (diff)
Fix traceback running instance-usage-audit
There were two errors here: 1 was a missed joinload that was causing an error pulling info_cache. 2 the exception listed in the bug, which was caused by tring to load data for a deleted instance. This fixes bug 934539 Change-Id: Ifffb6a35c1f7bf8caa6f57d33b29b58d0dbe10b3
-rw-r--r--nova/compute/utils.py2
-rw-r--r--nova/db/sqlalchemy/api.py4
2 files changed, 4 insertions, 2 deletions
diff --git a/nova/compute/utils.py b/nova/compute/utils.py
index 1ecc1c217..d0c986b84 100644
--- a/nova/compute/utils.py
+++ b/nova/compute/utils.py
@@ -37,7 +37,7 @@ def notify_usage_exists(instance_ref, current_period=False):
Generates usage for last completed period, unless 'current_period'
is True."""
- admin_context = context.get_admin_context()
+ admin_context = context.get_admin_context(read_deleted='yes')
begin, end = utils.current_audit_period()
bw = {}
if current_period:
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index b3e558bf9..ebd392ec7 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -1610,7 +1610,9 @@ def instance_get_active_by_window_joined(context, begin, end=None,
session = get_session()
query = session.query(models.Instance)
- query = query.options(joinedload('security_groups')).\
+ query = query.options(joinedload('info_cache')).\
+ options(joinedload('security_groups')).\
+ options(joinedload('metadata')).\
options(joinedload('instance_type')).\
filter(or_(models.Instance.terminated_at == None,
models.Instance.terminated_at > begin))