summaryrefslogtreecommitdiffstats
path: root/nova/db
diff options
context:
space:
mode:
authorÉdouard Thuleau <edouard.thuleau@orange.com>2012-11-27 17:15:34 +0100
committerÉdouard Thuleau <edouard.thuleau@orange.com>2012-12-07 18:13:22 +0100
commit40fcbcb8852cad03eec345106772292fa08b25dc (patch)
tree1f2d1991259a67e688033f685b1fd58797632317 /nova/db
parent87e609ca8e038c89de7853c2461088ebad645f9e (diff)
Remove unused bridge interfaces
If a network gateway of multi hosted network is unsed by any VM on the host, we tear down it. It is implemented only with the VLAN manager. Fixes LP bug #1084651 Change-Id: Ia7e399de5b8ddf6ec252d38dfbb8762c4f14e3a5
Diffstat (limited to 'nova/db')
-rw-r--r--nova/db/api.py4
-rw-r--r--nova/db/sqlalchemy/api.py5
2 files changed, 9 insertions, 0 deletions
diff --git a/nova/db/api.py b/nova/db/api.py
index cfa6a6487..67d8e7618 100644
--- a/nova/db/api.py
+++ b/nova/db/api.py
@@ -809,6 +809,10 @@ def network_get_all_by_uuids(context, network_uuids,
# pylint: disable=C0103
+def network_in_use_on_host(context, network_id, host=None):
+ """Indicates if a network is currently in use on host."""
+ return IMPL.network_in_use_on_host(context, network_id, host)
+
def network_get_associated_fixed_ips(context, network_id, host=None):
"""Get all network's ips that have been associated."""
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index 4155fdc3d..e1e2ede84 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -2236,6 +2236,11 @@ def network_get_associated_fixed_ips(context, network_id, host=None):
return data
+def network_in_use_on_host(context, network_id, host):
+ fixed_ips = network_get_associated_fixed_ips(context, network_id, host)
+ return len(fixed_ips) > 0
+
+
@require_admin_context
def _network_get_query(context, session=None):
return model_query(context, models.Network, session=session,