From df1fb2978c854beb58646406796c2bef2bfb047f Mon Sep 17 00:00:00 2001 From: Jian Wen Date: Fri, 21 Sep 2012 17:30:18 +0800 Subject: 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 --- nova/db/api.py | 5 +++++ nova/db/sqlalchemy/api.py | 13 +++++++++++++ 2 files changed, 18 insertions(+) (limited to 'nova/db') 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() - -- cgit