Fix handling of source_groups with no-db-compute.
The moving of data around in no-db-compute broke source groups. This is a combination of a few errors. First, the instance_type data wasn't being retrieved from system_metadata. Second, the instance_type data was too deep in the heirarchy and being ignored. Finally, source groups require a nw info call which causes a db access by nova-compute. Fixes bug 1122316 Change-Id: Iccb6e5d336c0b2c8ba41c41ab2e046fc9617835a
This commit is contained in:
@@ -208,9 +208,9 @@ class ConductorManager(manager.SchedulerDependentManager):
|
||||
return jsonutils.to_primitive(group)
|
||||
|
||||
def security_group_rule_get_by_security_group(self, context, secgroup):
|
||||
rule = self.db.security_group_rule_get_by_security_group(
|
||||
rules = self.db.security_group_rule_get_by_security_group(
|
||||
context, secgroup['id'])
|
||||
return jsonutils.to_primitive(rule)
|
||||
return jsonutils.to_primitive(rules, max_depth=4)
|
||||
|
||||
def provider_fw_rule_get_all(self, context):
|
||||
rules = self.db.provider_fw_rule_get_all(context)
|
||||
|
||||
@@ -3203,7 +3203,8 @@ 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.instance_type')).\
|
||||
options(joinedload_all('grantee_group.instances.'
|
||||
'system_metadata')).\
|
||||
all()
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
import functools
|
||||
import inspect
|
||||
|
||||
from nova.compute import instance_types
|
||||
from nova.db import base
|
||||
from nova import exception
|
||||
from nova.network import floating_ips
|
||||
@@ -362,8 +363,9 @@ class API(base.Base):
|
||||
|
||||
def _get_instance_nw_info(self, context, instance):
|
||||
"""Returns all network info related to an instance."""
|
||||
instance_type = instance_types.extract_instance_type(instance)
|
||||
args = {'instance_id': instance['uuid'],
|
||||
'rxtx_factor': instance['instance_type']['rxtx_factor'],
|
||||
'rxtx_factor': instance_type['rxtx_factor'],
|
||||
'host': instance['host'],
|
||||
'project_id': instance['project_id']}
|
||||
nw_info = self.network_rpcapi.get_instance_nw_info(context, **args)
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from nova import conductor
|
||||
from nova import context
|
||||
from nova import network
|
||||
from nova.network import linux_net
|
||||
@@ -398,9 +399,11 @@ class IptablesFirewallDriver(FirewallDriver):
|
||||
# and should be the only one making
|
||||
# making rpc calls.
|
||||
nw_api = network.API()
|
||||
capi = conductor.API()
|
||||
for instance in rule['grantee_group']['instances']:
|
||||
nw_info = nw_api.get_instance_nw_info(ctxt,
|
||||
instance)
|
||||
instance,
|
||||
capi)
|
||||
|
||||
ips = [ip['address']
|
||||
for ip in nw_info.fixed_ips()
|
||||
|
||||
Reference in New Issue
Block a user