diff options
| author | Chris Behrens <cbehrens@codestud.com> | 2011-05-23 16:51:28 -0500 |
|---|---|---|
| committer | Chris Behrens <cbehrens@codestud.com> | 2011-05-23 16:51:28 -0500 |
| commit | 42c209d90f491d19b3aabc70f8dafc33b76cf20d (patch) | |
| tree | a521166ff42a92e331923a0cf20c12597c9d7218 /nova/tests | |
| parent | 94766fac0f5fdb3c7847b1129a8f05948a97f887 (diff) | |
fix tests, have glance plugin return json encoded string of vdi uuids
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/xenapi/stubs.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/nova/tests/xenapi/stubs.py b/nova/tests/xenapi/stubs.py index d9306900d..9f6f64318 100644 --- a/nova/tests/xenapi/stubs.py +++ b/nova/tests/xenapi/stubs.py @@ -17,6 +17,7 @@ """Stubouts, mocks and fixtures for the test suite""" import eventlet +import json from nova.virt import xenapi_conn from nova.virt.xenapi import fake from nova.virt.xenapi import volume_utils @@ -37,7 +38,7 @@ def stubout_instance_snapshot(stubs): sr_ref=sr_ref, sharable=False) vdi_rec = session.get_xenapi().VDI.get_record(vdi_ref) vdi_uuid = vdi_rec['uuid'] - return dict(primary_vdi_uuid=vdi_uuid, swap_vdi_uuid=None) + return {'primary_vdi_uuid': vdi_uuid} stubs.Set(vm_utils.VMHelper, 'fetch_image', fake_fetch_image) @@ -132,10 +133,16 @@ class FakeSessionForVMTests(fake.SessionBase): def __init__(self, uri): super(FakeSessionForVMTests, self).__init__(uri) - def host_call_plugin(self, _1, _2, _3, _4, _5): + def host_call_plugin(self, _1, _2, plugin, method, _5): sr_ref = fake.get_all('SR')[0] vdi_ref = fake.create_vdi('', False, sr_ref, False) vdi_rec = fake.get_record('VDI', vdi_ref) + if plugin == "glance" and method == "download_vhd": + swap_vdi_ref = fake.create_vdi('', False, sr_ref, False) + swap_vdi_rec = fake.get_record('VDI', swap_vdi_ref) + return '<string>%s</string>' % json.dumps( + {'primary_vdi_uuid': vdi_rec['uuid'], + 'swap_vdi_uuid': swap_vdi_rec['uuid']}) return '<string>%s</string>' % vdi_rec['uuid'] def VM_start(self, _1, ref, _2, _3): |
