Fix Qemu cannot be used on Windows

Fix #291
This commit is contained in:
Julien Duponchelle
2015-08-26 13:47:12 +02:00
parent 70f62cd5eb
commit fea7a8a9ab
2 changed files with 17 additions and 1 deletions

View File

@ -149,7 +149,9 @@ class QemuVM(BaseVM):
if self._platform == "qemu-kvm":
self._platform = "x86_64"
else:
self._platform = re.sub(r'^qemu-system-(.*)(w.exe)?$', r'\1', os.path.basename(qemu_path), re.IGNORECASE)
qemu_bin = os.path.basename(qemu_path)
qemu_bin = re.sub(r'(w)?\.(exe|EXE)$', '', qemu_bin)
self._platform = re.sub(r'^qemu-system-(.*)$', r'\1', qemu_bin, re.IGNORECASE)
if self._platform.split(".")[0] not in QEMU_PLATFORMS:
raise QemuError("Platform {} is unknown".format(self._platform))
log.info('QEMU VM "{name}" [{id}] has set the QEMU path to {qemu_path}'.format(name=self._name,