summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatt.dietz@rackspace.com <>2011-03-07 22:50:35 +0000
committermatt.dietz@rackspace.com <>2011-03-07 22:50:35 +0000
commit5c7ee13b058fb954fd9bbc4a3550716b8faa0b97 (patch)
treec7e3a40d2371d8f2b1403f94e72b7de460be1409
parent88c5555e867c730065c18541a35b161eb861b502 (diff)
And unit tests
-rw-r--r--nova/tests/test_xenapi.py5
-rw-r--r--nova/tests/xenapi/stubs.py4
-rw-r--r--nova/virt/xenapi_conn.py2
3 files changed, 10 insertions, 1 deletions
diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py
index 7f437c2b8..6e458558d 100644
--- a/nova/tests/test_xenapi.py
+++ b/nova/tests/test_xenapi.py
@@ -383,6 +383,11 @@ class XenAPIMigrateInstance(test.TestCase):
conn = xenapi_conn.get_connection(False)
conn.attach_disk(instance, {'base_copy': 'hurr', 'cow': 'durr'})
+ def test_finish_resize(self):
+ instance = db.instance_create(self.values)
+ stubs.stubout_session(self.stubs, stubs.FakeSessionForMigrationTests)
+ conn = xenapi_conn.get_connection(False)
+ conn.finish_resize(instance, dict(base_copy='hurr', cow='durr'))
class XenAPIDetermineDiskImageTestCase(test.TestCase):
"""
diff --git a/nova/tests/xenapi/stubs.py b/nova/tests/xenapi/stubs.py
index 11e89c9b4..28037c2ba 100644
--- a/nova/tests/xenapi/stubs.py
+++ b/nova/tests/xenapi/stubs.py
@@ -251,6 +251,9 @@ def stub_out_migration_methods(stubs):
def fake_destroy(*args, **kwargs):
pass
+ def fake_spawn_with_disk(*args, **kwargs):
+ pass
+
stubs.Set(vmops.VMOps, '_destroy', fake_destroy)
stubs.Set(vm_utils.VMHelper, 'scan_default_sr', fake_sr)
stubs.Set(vm_utils.VMHelper, 'scan_sr', fake_sr)
@@ -259,3 +262,4 @@ def stub_out_migration_methods(stubs):
stubs.Set(xenapi_conn.XenAPISession, 'wait_for_task', lambda x, y, z: None)
stubs.Set(vm_utils.VMHelper, 'get_sr_path', fake_get_sr_path)
stubs.Set(vmops.VMOps, '_shutdown', fake_shutdown)
+ stubs.Set(vmops.VMOps, 'spawn_with_disk', fake_spawn_with_disk)
diff --git a/nova/virt/xenapi_conn.py b/nova/virt/xenapi_conn.py
index 7e8f825e9..3991496b2 100644
--- a/nova/virt/xenapi_conn.py
+++ b/nova/virt/xenapi_conn.py
@@ -158,7 +158,7 @@ class XenAPIConnection(object):
"""Create VM instance"""
self._vmops.spawn(instance)
- def finish_resize(self, instance, disk_info)
+ def finish_resize(self, instance, disk_info):
"""Completes a resize, turning on the migrated instance"""
new_disk_info = self.attach_disk(instance, disk_info)
self._vmops.spawn_with_disk(instance, new_disk_info)