diff options
author | Mauro S. M. Rodrigues <maurosr@linux.vnet.ibm.com> | 2013-01-21 12:39:47 -0500 |
---|---|---|
committer | Mauro S. M. Rodrigues <maurosr@linux.vnet.ibm.com> | 2013-01-21 18:00:19 -0500 |
commit | 93516a528d83d4802421cfb3ee0695f06bdd5f8b (patch) | |
tree | 6dfb2c4f164aa9a353bb0222c8b3a6cdc116f1d8 | |
parent | 8fddd6ad445586dc2c59ace0b292ff9da7048561 (diff) | |
download | nova-93516a528d83d4802421cfb3ee0695f06bdd5f8b.tar.gz nova-93516a528d83d4802421cfb3ee0695f06bdd5f8b.tar.xz nova-93516a528d83d4802421cfb3ee0695f06bdd5f8b.zip |
Fix get Floating ip pools action name to match with its policy
Get Floating IP Pools is always responding 403 (Forbidden) cause its method
name, which is also being used as action name, doesn't match with the name in
policy.json file.
I opted for this approach cause it also fixes the different names between the
extension (which is named floating **ip** pools instead of floating pools) and
the backend.
Another good practice would be change the default_floating_pool option to
default_float_ip_pool, but that would require change the conf file and possibly
break some compatibility.
Fixes bug 1091668
Change-Id: I2627e8b0f45c5c39bbbf1a4a12b448e1992fa4b4
-rw-r--r-- | nova/network/api.py | 2 | ||||
-rw-r--r-- | nova/network/manager.py | 14 | ||||
-rw-r--r-- | nova/network/rpcapi.py | 6 | ||||
-rw-r--r-- | nova/tests/network/test_rpcapi.py | 5 |
4 files changed, 22 insertions, 5 deletions
diff --git a/nova/network/api.py b/nova/network/api.py index 976be93ed..5e3762e89 100644 --- a/nova/network/api.py +++ b/nova/network/api.py @@ -111,7 +111,7 @@ class API(base.Base): return self.network_rpcapi.get_floating_ip(context, id) def get_floating_ip_pools(self, context): - return self.network_rpcapi.get_floating_pools(context) + return self.network_rpcapi.get_floating_ip_pools(context) def get_floating_ip_by_address(self, context, address): return self.network_rpcapi.get_floating_ip_by_address(context, address) diff --git a/nova/network/manager.py b/nova/network/manager.py index ccdac6f60..1933b552e 100644 --- a/nova/network/manager.py +++ b/nova/network/manager.py @@ -710,6 +710,13 @@ class FloatingIP(object): @wrap_check_policy def get_floating_pools(self, context): """Returns list of floating pools.""" + # NOTE(maurosr) This method should be removed in future, replaced by + # get_floating_ip_pools. See bug #1091668 + return self.get_floating_ip_pools(context) + + @wrap_check_policy + def get_floating_ip_pools(self, context): + """Returns list of floating ip pools.""" pools = self.db.floating_ip_get_pools(context) return [dict(pool.iteritems()) for pool in pools] @@ -2077,6 +2084,13 @@ class FlatManager(NetworkManager): @wrap_check_policy def get_floating_pools(self, context): """Returns list of floating pools.""" + # NOTE(maurosr) This method should be removed in future, replaced by + # get_floating_ip_pools. See bug #1091668 + return {} + + @wrap_check_policy + def get_floating_ip_pools(self, context): + """Returns list of floating ip pools.""" return {} @wrap_check_policy diff --git a/nova/network/rpcapi.py b/nova/network/rpcapi.py index 2f52add57..a7bffe17a 100644 --- a/nova/network/rpcapi.py +++ b/nova/network/rpcapi.py @@ -45,6 +45,7 @@ class NetworkAPI(rpc_proxy.RpcProxy): 1.4 - Add get_backdoor_port() 1.5 - Adds associate 1.6 - Adds instance_uuid to _{dis,}associate_floating_ip + 1.7 - Adds method get_floating_ip_pools to replace get_floating_pools ''' # @@ -94,8 +95,9 @@ class NetworkAPI(rpc_proxy.RpcProxy): def get_floating_ip(self, ctxt, id): return self.call(ctxt, self.make_msg('get_floating_ip', id=id)) - def get_floating_pools(self, ctxt): - return self.call(ctxt, self.make_msg('get_floating_pools')) + def get_floating_ip_pools(self, ctxt): + return self.call(ctxt, self.make_msg('get_floating_ip_pools'), + version="1.7") def get_floating_ip_by_address(self, ctxt, address): return self.call(ctxt, self.make_msg('get_floating_ip_by_address', diff --git a/nova/tests/network/test_rpcapi.py b/nova/tests/network/test_rpcapi.py index 90bffeeaf..5ba7459fb 100644 --- a/nova/tests/network/test_rpcapi.py +++ b/nova/tests/network/test_rpcapi.py @@ -108,8 +108,9 @@ class NetworkRpcAPITestCase(test.TestCase): def test_get_floating_ip(self): self._test_network_api('get_floating_ip', rpc_method='call', id='id') - def test_get_floating_pools(self): - self._test_network_api('get_floating_pools', rpc_method='call') + def test_get_floating_ip_pools(self): + self._test_network_api('get_floating_ip_pools', rpc_method='call', + version="1.7") def test_get_floating_ip_by_address(self): self._test_network_api('get_floating_ip_by_address', rpc_method='call', |