summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2011-09-30 15:40:04 +0000
committerGerrit Code Review <review@openstack.org>2011-09-30 15:40:04 +0000
commit96b99e4d1f5f264e7f263ddbf50981abf5a3b04e (patch)
treea20a6d10fce59da6232e30eedb8f5555aeb28383 /nova/tests
parentcb6250fa77d7724ba7e5dd15e8a3c9973756c1f5 (diff)
parentb9aac1181581b9036c98f5aa493731fdc74be7e1 (diff)
Merge "Fixed bug lp850602. Adding backing file copy operation on kvm block migration."
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_libvirt.py26
1 files changed, 17 insertions, 9 deletions
diff --git a/nova/tests/test_libvirt.py b/nova/tests/test_libvirt.py
index aefe26cc8..8b6f2080d 100644
--- a/nova/tests/test_libvirt.py
+++ b/nova/tests/test_libvirt.py
@@ -629,9 +629,12 @@ class LibvirtConnTestCase(test.TestCase):
fake_timer = FakeTime()
+ # _fake_network_info must be called before create_fake_libvirt_mock(),
+ # as _fake_network_info calls utils.import_class() and
+ # create_fake_libvirt_mock() mocks utils.import_class().
+ network_info = _fake_network_info(self.stubs, 1)
self.create_fake_libvirt_mock()
instance_ref = db.instance_create(self.context, self.test_instance)
- network_info = _fake_network_info(self.stubs, 1)
# Start test
self.mox.ReplayAll()
@@ -684,10 +687,7 @@ class LibvirtConnTestCase(test.TestCase):
return vdmock
self.create_fake_libvirt_mock(lookupByName=fake_lookup)
-# self.mox.StubOutWithMock(self.compute, "recover_live_migration")
self.mox.StubOutWithMock(self.compute, "rollback_live_migration")
-# self.compute.recover_live_migration(self.context, instance_ref,
-# dest='dest')
self.compute.rollback_live_migration(self.context, instance_ref,
'dest', False)
@@ -722,7 +722,8 @@ class LibvirtConnTestCase(test.TestCase):
# Test data
instance_ref = db.instance_create(self.context, self.test_instance)
- dummyjson = '[{"path": "%s/disk", "local_gb": "10G", "type": "raw"}]'
+ dummyjson = ('[{"path": "%s/disk", "local_gb": "10G",'
+ ' "type": "raw", "backing_file": ""}]')
# Preparing mocks
# qemu-img should be mockd since test environment might not have
@@ -763,7 +764,10 @@ class LibvirtConnTestCase(test.TestCase):
"</devices></domain>")
ret = ("image: /test/disk\nfile format: raw\n"
- "virtual size: 20G (21474836480 bytes)\ndisk size: 3.1G\n")
+ "virtual size: 20G (21474836480 bytes)\ndisk size: 3.1G\n"
+ "disk size: 102M\n"
+ "cluster_size: 2097152\n"
+ "backing file: /test/dummy (actual path: /backing/file)\n")
# Preparing mocks
vdmock = self.mox.CreateMock(libvirt.virDomain)
@@ -793,7 +797,9 @@ class LibvirtConnTestCase(test.TestCase):
info[0]['path'] == '/test/disk' and
info[1]['path'] == '/test/disk.local' and
info[0]['local_gb'] == '10G' and
- info[1]['local_gb'] == '20G')
+ info[1]['local_gb'] == '20G' and
+ info[0]['backing_file'] == "" and
+ info[1]['backing_file'] == "file")
db.instance_destroy(self.context, instance_ref['id'])
@@ -806,6 +812,10 @@ class LibvirtConnTestCase(test.TestCase):
def fake_none(self, instance):
return
+ # _fake_network_info must be called before create_fake_libvirt_mock(),
+ # as _fake_network_info calls utils.import_class() and
+ # create_fake_libvirt_mock() mocks utils.import_class().
+ network_info = _fake_network_info(self.stubs, 1)
self.create_fake_libvirt_mock()
instance = db.instance_create(self.context, self.test_instance)
@@ -815,8 +825,6 @@ class LibvirtConnTestCase(test.TestCase):
conn.firewall_driver.setattr('setup_basic_filtering', fake_none)
conn.firewall_driver.setattr('prepare_instance_filter', fake_none)
- network_info = _fake_network_info(self.stubs, 1)
-
try:
conn.spawn(self.context, instance, network_info)
except Exception, e: