summaryrefslogtreecommitdiffstats
path: root/nova/db
diff options
context:
space:
mode:
authorJian Wen <wenjianhn@gmail.com>2012-09-21 17:30:18 +0800
committerJian Wen <wenjianhn@gmail.com>2012-10-24 10:22:53 +0800
commitdf1fb2978c854beb58646406796c2bef2bfb047f (patch)
tree64fa9d7d86fe49d46dbd69b26b824581a4ef807d /nova/db
parenta3d27d189258e2684581bf5e6a1961332e6d44bb (diff)
downloadnova-df1fb2978c854beb58646406796c2bef2bfb047f.tar.gz
nova-df1fb2978c854beb58646406796c2bef2bfb047f.tar.xz
nova-df1fb2978c854beb58646406796c2bef2bfb047f.zip
Migrate network of an instance
In multi_host mode, floating ip(s) addr and NAT rules are still on source node after resize/migrate instance. This patch fixes it up by adding new methods in network.api to moving them to the destination node. Also adds the new methods to network/quantumv2/api.py. They do nothing but pass for now. This patch updates network RPC API to version 1.1 Fixes bug 1053344 Change-Id: If9f30050d37831f108ac4a1c8a018d820818f3b6
Diffstat (limited to 'nova/db')
-rw-r--r--nova/db/api.py5
-rw-r--r--nova/db/sqlalchemy/api.py13
2 files changed, 18 insertions, 0 deletions
diff --git a/nova/db/api.py b/nova/db/api.py
index 4d91c5db9..82b7e895b 100644
--- a/nova/db/api.py
+++ b/nova/db/api.py
@@ -641,6 +641,11 @@ def instance_get_floating_address(context, instance_id):
return IMPL.instance_get_floating_address(context, instance_id)
+def instance_floating_address_get_all(context, instance_uuid):
+ """Get all floating ip addresses of an instance"""
+ return IMPL.instance_floating_address_get_all(context, instance_uuid)
+
+
def instance_get_all_hung_in_rebooting(context, reboot_window):
"""Get all instances stuck in a rebooting state."""
return IMPL.instance_get_all_hung_in_rebooting(context, reboot_window)
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index 0946d0b19..a70488bd8 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -1738,6 +1738,19 @@ def instance_get_floating_address(context, instance_id):
return floating_ips[0]['address']
+@require_context
+def instance_floating_address_get_all(context, instance_uuid):
+ fixed_ips = fixed_ip_get_by_instance(context, instance_uuid)
+
+ floating_ips = []
+ for fixed_ip in fixed_ips:
+ _floating_ips = floating_ip_get_by_fixed_ip_id(context,
+ fixed_ip['id'])
+ floating_ips += _floating_ips
+
+ return floating_ips
+
+
@require_admin_context
def instance_get_all_hung_in_rebooting(context, reboot_window, session=None):
reboot_window = (timeutils.utcnow() -