summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nova/db/sqlalchemy/api.py7
-rw-r--r--nova/network/manager.py8
2 files changed, 11 insertions, 4 deletions
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index c22ece068..8b7ab8cbd 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -1704,10 +1704,15 @@ def network_get_all_by_instance(_context, instance_id):
def network_get_all_by_host(context, host):
session = get_session()
with session.begin():
+ # NOTE(vish): return networks that have host set
+ # or that have a fixed ip with host set
+ host_filter = or_(models.Network.host == host,
+ models.FixedIp.host == host)
+
return session.query(models.Network).\
filter_by(deleted=False).\
join(models.Network.fixed_ips).\
- filter_by(host=host).\
+ filter(host_filter).\
filter_by(deleted=False).\
all()
diff --git a/nova/network/manager.py b/nova/network/manager.py
index 8ef9c9a33..dac42e7ec 100644
--- a/nova/network/manager.py
+++ b/nova/network/manager.py
@@ -307,6 +307,10 @@ class NetworkManager(manager.SchedulerDependentManager):
@utils.synchronized('get_dhcp')
def _get_dhcp_ip(self, context, network_ref, host=None):
"""Get the proper dhcp address to listen on."""
+ # NOTE(vish): this is for compatibility
+ if not network_ref['multi_host']:
+ return network_ref['gateway']
+
if not host:
host = self.host
network_id = network_ref['id']
@@ -317,11 +321,9 @@ class NetworkManager(manager.SchedulerDependentManager):
return fip['address']
except exception.FixedIpNotFoundForNetworkHost:
elevated = context.elevated()
- addr = self.db.fixed_ip_associate_pool(elevated,
+ return self.db.fixed_ip_associate_pool(elevated,
network_id,
host=host)
- return addr
-
def init_host(self):
"""Do any initialization that needs to be run if this is a