From d89fe544bd5b119ab6fe24d6a353240efbf5a491 Mon Sep 17 00:00:00 2001 From: Huan Xie Date: Wed, 3 May 2017 00:19:21 -0700 Subject: [PATCH] XenAPI: Create linux bridge in dest host during live migration We found VM can live migrate successfully with XenServer hypervisor, but after migrating to dest host, we cannot ping the VM's floating or fixed IP any more. The problem is, during live migration, we only create the network in dest host which the VM's VIF connect to, but we don't establish the linux bridge and the corresponding veth pair to integration bridge br-int. Closes-Bug: 1677937 Change-Id: I0d69d2ba5b064ef303445892791804608e7f19c5 --- nova/tests/unit/virt/xenapi/test_xenapi.py | 4 +++- nova/virt/xenapi/vmops.py | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/nova/tests/unit/virt/xenapi/test_xenapi.py b/nova/tests/unit/virt/xenapi/test_xenapi.py index a980edc02c3b..fc8a01825fd6 100644 --- a/nova/tests/unit/virt/xenapi/test_xenapi.py +++ b/nova/tests/unit/virt/xenapi/test_xenapi.py @@ -3477,7 +3477,8 @@ class XenAPILiveMigrateTestCase(stubs.XenAPITestBaseNoDB): self.assertTrue(result) pre.assert_called_with("ctx", "inst", "bdi", "nw", "di", "data") - def test_post_live_migration_at_destination(self): + @mock.patch.object(vmops.VMOps, '_post_start_actions') + def test_post_live_migration_at_destination(self, mock_post_action): # ensure method is present stubs.stubout_session(self.stubs, stubs.FakeSessionForVMTests) self.conn = xenapi_conn.XenAPIDriver(fake.FakeVirtAPI(), False) @@ -3521,6 +3522,7 @@ class XenAPILiveMigrateTestCase(stubs.XenAPITestBaseNoDB): self.assertEqual(fake_fw.call_count, 3) self.assertTrue(fake_get_vm_opaque_ref.called) self.assertTrue(fake_strip_base_mirror_from_vdis.called) + mock_post_action.assert_called_once_with(fake_instance) def test_check_can_live_migrate_destination_with_block_migration(self): stubs.stubout_session(self.stubs, stubs.FakeSessionForVMTests) diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index 47337ef47518..b0653f1f73fa 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -2470,6 +2470,9 @@ class VMOps(object): # applied security groups, however this requires changes to XenServer self._prepare_instance_filter(instance, network_info) self.firewall_driver.apply_instance_filter(instance, network_info) + + # hook linux bridge and ovs bridge at destination + self._post_start_actions(instance) vm_utils.create_kernel_and_ramdisk(context, self._session, instance, instance['name'])