Shahar Havivi has uploaded a new change for review. Change subject: v2v: add test for Xen block device ......................................................................
v2v: add test for Xen block device Change-Id: I1afc7d21857e59ebf69856e99e15cc3796149e4e Signed-off-by: Shahar Havivi <[email protected]> --- M tests/v2vTests.py 1 file changed, 28 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/22/63022/1 diff --git a/tests/v2vTests.py b/tests/v2vTests.py index 013a56a..7c1d5a9 100644 --- a/tests/v2vTests.py +++ b/tests/v2vTests.py @@ -84,6 +84,7 @@ self._id = id self._active = active self._has_snapshots = has_snapshots + self._disk_type = 'file' def name(self): return self._name @@ -106,6 +107,9 @@ def isActive(self): return self._active + def setDiskType(self, disk_type): + self._disk_type = disk_type + def XMLDesc(self, flags=0): return """ <domain type='vmware' id='15'> @@ -122,7 +126,7 @@ <on_reboot>restart</on_reboot> <on_crash>destroy</on_crash> <devices> - <disk type='file' device='disk'> + <disk type='{disk_type}' device='disk'> <source file='[datastore1] RHEL/RHEL_{name}.vmdk'/> <target dev='sda' bus='scsi'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> @@ -140,6 +144,7 @@ </domain>""".format( name=self._name, uuid=self._uuid, + disk_type=self._disk_type, mac=self._mac_address) def hasCurrentSnapshot(self): @@ -151,12 +156,16 @@ def __init__(self, vms): self._vms = vms + self._type = 'ESX' def close(self): pass + def setType(self, type_name): + self._type = type_name + def getType(self): - return "ESX" + return self._type def listAllDomains(self): return [vm for vm in self._vms] @@ -512,6 +521,23 @@ def testSuccessfulXenImport(self): self._commonConvertExternalVM(self.xen_url) + def testXenBlockDevice(self): + def _connect(uri, username, passwd): + self._vms[0].setDiskType('block') + conn = MockVirConnect(vms=self._vms) + conn.setType('Xen') + return conn + + with MonkeyPatchScope([(libvirtconnection, 'open_connection', + _connect)]): + vms = v2v.get_external_vms(self.xen_url, 'user', + ProtectedPassword('password'), + None)['vmList'] + + self._vms[0].setDiskType('block') + print '\n>>> %r\n' % self._vms[0] + self.assertEqual(len(vms), len(VM_SPECS) - 1) + @MonkeyPatch(v2v, '_VIRT_V2V', FAKE_VIRT_V2V) @MonkeyPatch(v2v, '_LOG_DIR', None) def testSuccessfulImportOVA(self): -- To view, visit https://gerrit.ovirt.org/63022 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1afc7d21857e59ebf69856e99e15cc3796149e4e Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Shahar Havivi <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/admin/lists/[email protected]
