summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2012-07-23 12:54:21 +0100
committerMark McLoughlin <markmc@redhat.com>2012-07-23 12:54:21 +0100
commitd8e39cb775a872c46d067bee8febc40dee799369 (patch)
tree11001b814c14b3c66f331104fe87ff813c209f6b
parentc94cbe223fffa57969d91219538bc3576e9893da (diff)
downloadnova-d8e39cb775a872c46d067bee8febc40dee799369.tar.gz
nova-d8e39cb775a872c46d067bee8febc40dee799369.tar.xz
nova-d8e39cb775a872c46d067bee8febc40dee799369.zip
Remove unused add_network_to_project() method
This method was added here: https://code.launchpad.net/~tr3buchet/nova/multi_nic/+merge/64767 but appears never to have been used. We can safely remove it and the 'force' parameter to network_associate() which only it uses. This removal from the network service RPC API would not warrant a major version number bump since nothing ever used this part of the API. Change-Id: Iba3cf7b61b629ba513a58a38886c9322818accb5
-rw-r--r--etc/nova/policy.json1
-rw-r--r--nova/db/sqlalchemy/api.py21
-rw-r--r--nova/network/api.py6
-rw-r--r--nova/network/manager.py5
-rw-r--r--nova/network/quantumv2/api.py4
-rw-r--r--nova/tests/policy.json1
6 files changed, 5 insertions, 33 deletions
diff --git a/etc/nova/policy.json b/etc/nova/policy.json
index 3970ce96a..dc8ed5b8f 100644
--- a/etc/nova/policy.json
+++ b/etc/nova/policy.json
@@ -96,7 +96,6 @@
"network:get_fixed_ip": [],
"network:add_fixed_ip_to_instance": [],
"network:remove_fixed_ip_from_instance": [],
- "network:add_network_to_project": [],
"network:get_instance_nw_info": [],
"network:get_dns_domains": [],
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index a33fa9953..f3bcb5c1e 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -1938,20 +1938,12 @@ def key_pair_count_by_user(context, user_id):
@require_admin_context
-def network_associate(context, project_id, force=False):
+def network_associate(context, project_id):
"""Associate a project with a network.
called by project_get_networks under certain conditions
- and network manager add_network_to_project()
only associate if the project doesn't already have a network
- or if force is True
-
- force solves race condition where a fresh project has multiple instance
- builds simultaneously picked up by multiple network hosts which attempt
- to associate the project with multiple networks
- force should only be used as a direct consequence of user request
- all automated requests should not use force
"""
session = get_session()
with session.begin():
@@ -1963,13 +1955,10 @@ def network_associate(context, project_id, force=False):
with_lockmode('update').\
first()
- if not force:
- # find out if project has a network
- network_ref = network_query(project_id)
-
- if force or not network_ref:
- # in force mode or project doesn't have a network so associate
- # with a new network
+ # find out if project has a network
+ network_ref = network_query(project_id)
+ if not network_ref:
+ # project doesn't have a network so associate with a new network
# get new network
network_ref = network_query(None)
diff --git a/nova/network/api.py b/nova/network/api.py
index ec30f54ca..bbc8b2c79 100644
--- a/nova/network/api.py
+++ b/nova/network/api.py
@@ -259,12 +259,6 @@ class API(base.Base):
{'method': 'remove_fixed_ip_from_instance',
'args': args})
- def add_network_to_project(self, context, project_id):
- """Force adds another network to a project."""
- rpc.call(context, FLAGS.network_topic,
- {'method': 'add_network_to_project',
- 'args': {'project_id': project_id}})
-
@refresh_cache
def get_instance_nw_info(self, context, instance):
"""Returns all network info related to an instance."""
diff --git a/nova/network/manager.py b/nova/network/manager.py
index c0fb2312b..9463562f8 100644
--- a/nova/network/manager.py
+++ b/nova/network/manager.py
@@ -1873,11 +1873,6 @@ class VlanManager(RPCAllocateFixedIP, FloatingIP, NetworkManager):
self._setup_network_on_host(context, network)
return address
- @wrap_check_policy
- def add_network_to_project(self, context, project_id):
- """Force adds another network to a project."""
- self.db.network_associate(context, project_id, force=True)
-
def _get_networks_for_instance(self, context, instance_id, project_id,
requested_networks=None):
"""Determine which networks an instance should connect to."""
diff --git a/nova/network/quantumv2/api.py b/nova/network/quantumv2/api.py
index 1e4f3e662..de3533983 100644
--- a/nova/network/quantumv2/api.py
+++ b/nova/network/quantumv2/api.py
@@ -241,10 +241,6 @@ class API(base.Base):
it is associated with."""
raise NotImplementedError()
- def add_network_to_project(self, context, project_id):
- """Force add a network to the project."""
- raise NotImplementedError()
-
def _build_network_info_model(self, context, instance, networks=None):
search_opts = {'tenant_id': instance['project_id'],
'device_id': instance['uuid'], }
diff --git a/nova/tests/policy.json b/nova/tests/policy.json
index bed66a7df..eec7df112 100644
--- a/nova/tests/policy.json
+++ b/nova/tests/policy.json
@@ -168,7 +168,6 @@
"network:get_fixed_ip": [],
"network:add_fixed_ip_to_instance": [],
"network:remove_fixed_ip_from_instance": [],
- "network:add_network_to_project": [],
"network:get_instance_nw_info": [],
"network:get_dns_domains": [],