summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorTrey Morris <trey.morris@rackspace.com>2011-06-10 16:55:27 -0500
committerTrey Morris <trey.morris@rackspace.com>2011-06-10 16:55:27 -0500
commit878468db557b4498528d57804a1808388d7993ec (patch)
treea580f0884e465e6e687f77330ccf4b4f66692055 /nova
parenta442e9d3fb00b9a39b39586f1d3752b4f96dee8a (diff)
floating ips can now move around the network hosts
Diffstat (limited to 'nova')
-rw-r--r--nova/db/sqlalchemy/api.py4
-rw-r--r--nova/network/manager.py2
2 files changed, 5 insertions, 1 deletions
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index e2996ba87..076f7ba67 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -433,7 +433,7 @@ def certificate_update(context, certificate_id, values):
@require_context
-def floating_ip_allocate_address(context, project_id):
+def floating_ip_allocate_address(context, host, project_id):
authorize_project_context(context, project_id)
session = get_session()
with session.begin():
@@ -448,6 +448,7 @@ def floating_ip_allocate_address(context, project_id):
if not floating_ip_ref:
raise db.NoMoreAddresses()
floating_ip_ref['project_id'] = project_id
+ floating_ip_ref['host'] = host
session.add(floating_ip_ref)
return floating_ip_ref['address']
@@ -496,6 +497,7 @@ def floating_ip_deallocate(context, address):
address,
session=session)
floating_ip_ref['project_id'] = None
+ floating_ip_ref['host'] = None
floating_ip_ref['auto_assigned'] = False
floating_ip_ref.save(session=session)
diff --git a/nova/network/manager.py b/nova/network/manager.py
index 889cfa59c..ea37989ce 100644
--- a/nova/network/manager.py
+++ b/nova/network/manager.py
@@ -232,6 +232,7 @@ class FloatingIP(object):
def allocate_floating_ip(self, context, project_id):
"""Gets an floating ip from the pool."""
+ # NOTE(tr3buchet): all networks hosts in zone now use the same pool
LOG.debug("QUOTA: %s" % quota.allowed_floating_ips(context, 1))
if quota.allowed_floating_ips(context, 1) < 1:
LOG.warn(_('Quota exceeeded for %s, tried to allocate '
@@ -241,6 +242,7 @@ class FloatingIP(object):
'allocate any more addresses'))
# TODO(vish): add floating ips through manage command
return self.db.floating_ip_allocate_address(context,
+ self.host
project_id)
def associate_floating_ip(self, context, floating_address, fixed_address):