From e06b0940ce5e25f7414e4e961e3af84707f54c8d Mon Sep 17 00:00:00 2001 From: Rick Harris Date: Thu, 28 Jun 2012 00:04:23 +0000 Subject: [PATCH] Dom0 plugin now returns data in proper format. The virt-layer code was refactored so that a dict was used to pass around which VDIs are present. This code makes the Dom0 plugin return that same data structure so we don't have to perform an extra conversion step. Change-Id: Ib4f1b0082138d233eb0c3873bbc553395510bc8d --- nova/tests/xenapi/stubs.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/nova/tests/xenapi/stubs.py b/nova/tests/xenapi/stubs.py index f6689c794..255f26a22 100644 --- a/nova/tests/xenapi/stubs.py +++ b/nova/tests/xenapi/stubs.py @@ -41,7 +41,7 @@ def stubout_instance_snapshot(stubs): 'kernel': dict(uuid=_make_fake_vdi(), file=None), 'ramdisk': dict(uuid=_make_fake_vdi(), file=None)} - stubs.Set(vm_utils, 'fetch_image', fake_fetch_image) + stubs.Set(vm_utils, '_fetch_image', fake_fetch_image) def fake_wait_for_vhd_coalesce(*args): #TODO(sirp): Should we actually fake out the data here @@ -172,8 +172,8 @@ class FakeSessionForVMTests(fake.SessionBase): def host_call_plugin(self, _1, _2, plugin, method, _5): if (plugin, method) == ('glance', 'download_vhd'): - return fake.as_json(dict(vdi_type='root', - vdi_uuid=_make_fake_vdi())) + root_uuid = _make_fake_vdi() + return jsonutils.dumps(dict(root=dict(uuid=root_uuid))) elif (plugin, method) == ("xenhost", "iptables_config"): return fake.as_json(out=self._fake_iptables_save_output, err='') @@ -183,10 +183,10 @@ class FakeSessionForVMTests(fake.SessionBase): def host_call_plugin_swap(self, _1, _2, plugin, method, _5): if (plugin, method) == ('glance', 'download_vhd'): - return fake.as_json(dict(vdi_type='root', - vdi_uuid=_make_fake_vdi()), - dict(vdi_type='swap', - vdi_uuid=_make_fake_vdi())) + root_uuid = _make_fake_vdi() + swap_uuid = _make_fake_vdi() + return jsonutils.dumps(dict(root=dict(uuid=root_uuid), + swap=dict(uuid=swap_uuid))) else: return (super(FakeSessionForVMTests, self). host_call_plugin(_1, _2, plugin, method, _5))