Shahar Havivi has uploaded a new change for review. Change subject: v2v: add mount windows iso drivers ......................................................................
v2v: add mount windows iso drivers virt-v2v expect proprietary Windows drivers to be in: /usr/share/virtio-win or the path sould be be set in VIRTIO_WIN_DIR environment. Change-Id: I675555d29bc354fff3b393e83f6b9594fe5bdd75 Signed-off-by: Shahar Havivi <[email protected]> --- M vdsm/API.py M vdsm/rpc/bindingxmlrpc.py M vdsm/rpc/vdsmapi-schema.json M vdsm/v2v.py 4 files changed, 45 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/58/42358/1 diff --git a/vdsm/API.py b/vdsm/API.py index 80586c7..4e1018b 100644 --- a/vdsm/API.py +++ b/vdsm/API.py @@ -1400,6 +1400,9 @@ return v2v.convert_external_vm(uri, username, password, vminfo, jobid, self._cif.irs) + def mountV2VWindowsDrivers(self, iso_path, umount=False): + return v2v.mount_windows_drivers(iso_path, umount) + def getConvertedVm(self, jobid): return v2v.get_converted_vm(jobid) diff --git a/vdsm/rpc/bindingxmlrpc.py b/vdsm/rpc/bindingxmlrpc.py index 6bb7082..9ad75cb 100644 --- a/vdsm/rpc/bindingxmlrpc.py +++ b/vdsm/rpc/bindingxmlrpc.py @@ -373,6 +373,10 @@ api = API.Global() return api.convertExternalVm(uri, username, password, vminfo, jobid) + def mountV2VWindowsDrivers(self, iso_path, umount=False): + api = API.Global() + return api.mountV2VWindowsDrivers(iso_path, umount) + def getConvertedVm(self, jobid): api = API.Global() return api.getConvertedVm(jobid) @@ -1059,7 +1063,8 @@ (self.convertExternalVm, 'convertExternalVm'), (self.getConvertedVm, 'getConvertedVm'), (self.abortV2VJob, 'abortV2VJob'), - (self.deleteV2VJob, 'deleteV2VJob')) + (self.deleteV2VJob, 'deleteV2VJob'), + (self.mountV2VWindowsDrivers, 'mountV2VWindowsDrivers')) def getIrsMethods(self): return ((self.domainActivate, 'activateStorageDomain'), diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json index 53d3b1b..2194a2b 100644 --- a/vdsm/rpc/vdsmapi-schema.json +++ b/vdsm/rpc/vdsmapi-schema.json @@ -3898,6 +3898,21 @@ 'data': {'jobid': 'UUID'}} ## +# @Host.mountV2VWindowsDrivers: +# +# mount windows iso file that contains Windows drivers for proper virt-v2v +# Windows conversion +# +# @iso_path: full path to windows drivers iso +# +# @umount: #optional if true unmount the drivers iso +# +# Since: 4.17.0 +## +{'command': {'class': 'Host', 'name': 'mountV2VWindowsDrivers'}, + 'data': {'iso_path': 'str', '*umount': 'bool'}} + +## # @VMFullInfo: # # Full information about VM. diff --git a/vdsm/v2v.py b/vdsm/v2v.py index b6763da..b9e5df8 100644 --- a/vdsm/v2v.py +++ b/vdsm/v2v.py @@ -35,6 +35,7 @@ import libvirt +from storage.mount import Mount, isMounted from vdsm.constants import P_VDSM_RUN from vdsm.define import errCode, doneCode from vdsm import libvirtconnection @@ -49,6 +50,7 @@ _V2V_DIR = os.path.join(P_VDSM_RUN, 'v2v') _VIRT_V2V = CommandPath('virt-v2v', '/usr/bin/virt-v2v') +_WIN_DRIVER_DIR = _V2V_DIR = os.path.join(_V2V_DIR, 'virtio-win') ImportProgress = namedtuple('ImportProgress', ['current_disk', 'disk_count', 'description']) @@ -177,6 +179,25 @@ return {'status': doneCode, 'ovf': ovf} +def mount_windows_drivers(iso_path, umount=False): + if not os.path.exists(iso_path): + raise InvalidInputError('Iso file not exists %s' % iso_path) + + if not os.path.exists(_WIN_DRIVER_DIR): + cmd = ['/usr/bin/mkdir', _WIN_DRIVER_DIR] + rc, out, err = execCmd(cmd) + if rc != 0: + raise V2VError('Error mounting iso: %r' % err) + + m = Mount(iso_path, _WIN_DRIVER_DIR) + if umount: + m.umount() + elif not isMounted(_WIN_DRIVER_DIR): + m.mount(mntOpts='loop') + + return {'status': doneCode} + + def delete_job(job_id): try: job = _get_job(job_id) -- To view, visit https://gerrit.ovirt.org/42358 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I675555d29bc354fff3b393e83f6b9594fe5bdd75 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/mailman/listinfo/vdsm-patches
