summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Smith <danms@us.ibm.com>2012-12-12 13:06:30 -0800
committerDan Smith <danms@us.ibm.com>2012-12-15 08:08:33 -0800
commit20f0c601fe5bd59c2a2f07a8be428ddca995afc5 (patch)
tree546d0ad030f38cfd1bff3f06472841ab334f07f3
parent20811e9298e11d99f9d4b5f48abad32d8736ccdc (diff)
downloadnova-20f0c601fe5bd59c2a2f07a8be428ddca995afc5.tar.gz
nova-20f0c601fe5bd59c2a2f07a8be428ddca995afc5.tar.xz
nova-20f0c601fe5bd59c2a2f07a8be428ddca995afc5.zip
Move provider_fw_rule_get_all to conductor
This patch moves the compute/manager's use of the provider_fw_rule_get_all() method to the conductor. Related to blueprint no-db-compute-manager Change-Id: I963fc65046d29b6eb92b82d559593a64ff775632
-rw-r--r--nova/compute/manager.py2
-rw-r--r--nova/conductor/api.py6
-rw-r--r--nova/conductor/manager.py6
-rw-r--r--nova/conductor/rpcapi.py5
-rw-r--r--nova/tests/compute/test_virtapi.py4
-rw-r--r--nova/tests/conductor/test_conductor.py8
6 files changed, 27 insertions, 4 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 9e494df56..66e605477 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -289,7 +289,7 @@ class ComputeVirtAPI(virtapi.VirtAPI):
security_group))
def provider_fw_rule_get_all(self, context):
- return self._compute.db.provider_fw_rule_get_all(context)
+ return self._compute.conductor_api.provider_fw_rule_get_all(context)
def agent_build_get_by_triple(self, context, hypervisor, os, architecture):
return self._compute.db.agent_build_get_by_triple(context,
diff --git a/nova/conductor/api.py b/nova/conductor/api.py
index bbce1bb5c..afbf24e3f 100644
--- a/nova/conductor/api.py
+++ b/nova/conductor/api.py
@@ -125,6 +125,9 @@ class LocalAPI(object):
return self._manager.security_group_rule_get_by_security_group(
context, secgroup)
+ def provider_fw_rule_get_all(self, context):
+ return self._manager.provider_fw_rule_get_all(context)
+
class API(object):
"""Conductor API that does updates via RPC to the ConductorManager"""
@@ -198,3 +201,6 @@ class API(object):
def security_group_rule_get_by_security_group(self, context, secgroup):
return self.conductor_rpcapi.security_group_rule_get_by_security_group(
context, secgroup)
+
+ def provider_fw_rule_get_all(self, context):
+ return self.conductor_rpcapi.provider_fw_rule_get_all(context)
diff --git a/nova/conductor/manager.py b/nova/conductor/manager.py
index bee730884..bbe36013f 100644
--- a/nova/conductor/manager.py
+++ b/nova/conductor/manager.py
@@ -43,7 +43,7 @@ datetime_fields = ['launched_at', 'terminated_at']
class ConductorManager(manager.SchedulerDependentManager):
"""Mission: TBD"""
- RPC_API_VERSION = '1.8'
+ RPC_API_VERSION = '1.9'
def __init__(self, *args, **kwargs):
super(ConductorManager, self).__init__(service_name='conductor',
@@ -140,3 +140,7 @@ class ConductorManager(manager.SchedulerDependentManager):
rule = self.db.security_group_rule_get_by_security_group(
context, secgroup['id'])
return jsonutils.to_primitive(rule)
+
+ def provider_fw_rule_get_all(self, context):
+ rules = self.db.provider_fw_rule_get_all(context)
+ return jsonutils.to_primitive(rules)
diff --git a/nova/conductor/rpcapi.py b/nova/conductor/rpcapi.py
index 89880081c..4f9fa9818 100644
--- a/nova/conductor/rpcapi.py
+++ b/nova/conductor/rpcapi.py
@@ -37,6 +37,7 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy):
and aggregate_metadata_delete
1.8 - Added security_group_get_by_instance and
security_group_rule_get_by_security_group
+ 1.9 - Added provider_fw_rule_get_all
"""
BASE_RPC_API_VERSION = '1.0'
@@ -128,3 +129,7 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy):
msg = self.make_msg('security_group_rule_get_by_security_group',
secgroup=secgroup_p)
return self.call(context, msg, version='1.8')
+
+ def provider_fw_rule_get_all(self, context):
+ msg = self.make_msg('provider_fw_rule_get_all')
+ return self.call(context, msg, version='1.9')
diff --git a/nova/tests/compute/test_virtapi.py b/nova/tests/compute/test_virtapi.py
index 22ddd8ca5..ceeacbc9d 100644
--- a/nova/tests/compute/test_virtapi.py
+++ b/nova/tests/compute/test_virtapi.py
@@ -140,9 +140,9 @@ class ComputeVirtAPITest(VirtAPIBaseTest):
'aggregate_metadata_delete',
'security_group_get_by_instance',
'security_group_rule_get_by_security_group',
+ 'provider_fw_rule_get_all',
]
- self.db_methods = ['provider_fw_rule_get_all',
- 'agent_build_get_by_triple',
+ self.db_methods = ['agent_build_get_by_triple',
]
def assertExpected(self, method, *args, **kwargs):
diff --git a/nova/tests/conductor/test_conductor.py b/nova/tests/conductor/test_conductor.py
index 8d811e27c..6acbe7ef6 100644
--- a/nova/tests/conductor/test_conductor.py
+++ b/nova/tests/conductor/test_conductor.py
@@ -243,6 +243,14 @@ class _BaseTestCase(object):
self.context, fake_secgroup)
self.assertEqual(result, 'it worked')
+ def test_provider_fw_rule_get_all(self):
+ fake_rules = ['a', 'b', 'c']
+ self.mox.StubOutWithMock(db, 'provider_fw_rule_get_all')
+ db.provider_fw_rule_get_all(self.context).AndReturn(fake_rules)
+ self.mox.ReplayAll()
+ result = self.conductor.provider_fw_rule_get_all(self.context)
+ self.assertEqual(result, fake_rules)
+
class ConductorTestCase(_BaseTestCase, test.TestCase):
"""Conductor Manager Tests"""