From 5c11a8c537eb4349e02e8f42468b441c259fbfc2 Mon Sep 17 00:00:00 2001 From: Michael Still Date: Wed, 8 May 2013 15:28:40 +1000 Subject: Handle instance directories correctly for migrates. In Grizzly we changed how we name instance directories. Unfortunately the decision as to what directory name to use is based on whether there is a pre-existing directory on the compute node with the old name. In the case of live migration, that doesn't work because we have libvirt copy the directory across for us. So, we need to pass around the directory name in the migration request. This is better anyway, as it means that ops types don't need to handle an instance directory magically renaming itself at some point. Resolves bug 1175286. Change-Id: Ib102e644a8742726fa2049303354d466b8109e0b --- nova/tests/virt/libvirt/fake_libvirt_utils.py | 5 +++-- nova/tests/virt/libvirt/test_libvirt.py | 11 ++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/virt/libvirt/fake_libvirt_utils.py b/nova/tests/virt/libvirt/fake_libvirt_utils.py index ba00a7091..23b758e03 100644 --- a/nova/tests/virt/libvirt/fake_libvirt_utils.py +++ b/nova/tests/virt/libvirt/fake_libvirt_utils.py @@ -197,8 +197,9 @@ def fetch_image(context, target, image_id, user_id, project_id): pass -def get_instance_path(instance, forceold=False): - return libvirt_utils.get_instance_path(instance, forceold=forceold) +def get_instance_path(instance, forceold=False, relative=False): + return libvirt_utils.get_instance_path(instance, forceold=forceold, + relative=relative) def pick_disk_driver_name(is_block_dev=False): diff --git a/nova/tests/virt/libvirt/test_libvirt.py b/nova/tests/virt/libvirt/test_libvirt.py index 6b70fe1c6..484162d54 100644 --- a/nova/tests/virt/libvirt/test_libvirt.py +++ b/nova/tests/virt/libvirt/test_libvirt.py @@ -2264,9 +2264,9 @@ class LibvirtConnTestCase(test.TestCase): conn._check_shared_storage_test_file("file").AndReturn(False) self.mox.StubOutWithMock(conn, "_assert_dest_node_has_enough_disk") - conn._assert_dest_node_has_enough_disk(self.context, instance_ref, - dest_check_data['disk_available_mb'], - False) + conn._assert_dest_node_has_enough_disk( + self.context, instance_ref, dest_check_data['disk_available_mb'], + False) self.mox.ReplayAll() conn.check_can_live_migrate_source(self.context, instance_ref, @@ -2467,13 +2467,14 @@ class LibvirtConnTestCase(test.TestCase): self.mox.ReplayAll() migrate_data = {'is_shared_storage': False, 'is_volume_backed': True, - 'block_migration': False + 'block_migration': False, + 'instance_relative_path': inst_ref['name'] } ret = conn.pre_live_migration(c, inst_ref, vol, nw_info, migrate_data) self.assertEqual(ret, None) self.assertTrue(os.path.exists('%s/%s/' % (tmpdir, - inst_ref['uuid']))) + inst_ref['name']))) db.instance_destroy(self.context, inst_ref['uuid']) def test_pre_block_migration_works_correctly(self): -- cgit