summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@gmail.com>2012-07-03 14:50:11 -0700
committerVishvananda Ishaya <vishvananda@gmail.com>2012-07-09 17:25:39 -0700
commit2ef0dcfac78468551aac8492269ad856c312dcb5 (patch)
tree180a4ffa37bb110b0334df5a59c2081c6166ba97
parenta8f92deedc296a4b979b0036d4141462166b8072 (diff)
Avoid lazy-loading errors on instance_type
When instances are launched with a source group, the instance_type is not lazy_loaded in properly. The issue is intermittent because if another query has already loaded the instance with a joined instance_type or the instance has not yet been expunged from the session, then the load succeeds. Therefore this failure only appears under heavy load. Adding an explicit joindload fixes the issue. Change-Id: I450c598c31c416c7be341cbb8cd14e33c6bb2aec
-rw-r--r--nova/db/sqlalchemy/api.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index e6d7f88c7..93bce01c5 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -3538,9 +3538,9 @@ def security_group_rule_get(context, security_group_rule_id, session=None):
def security_group_rule_get_by_security_group(context, security_group_id,
session=None):
return _security_group_rule_get_query(context, session=session).\
- filter_by(parent_group_id=security_group_id).\
- options(joinedload_all('grantee_group.instances')).\
- all()
+ filter_by(parent_group_id=security_group_id).\
+ options(joinedload_all('grantee_group.instances.instance_type')).\
+ all()
@require_context