Fix error when system uses /usr/bin/qemu-kvm, as in CentOS 7.2.

Got "libvirt.libvirtError" error when using "/usr/bin/qemu-kvm" on CentOS7.2.
CentOS 7.2 uses "/usr/libexec/qemu-kvm", this patch fixes it.

Change-Id: Icf2951701fddfac8e2f0641f6f555adb8a3c185b
Closes-Bug: #1649449
This commit is contained in:
zhangyanying 2016-12-13 19:10:24 +08:00
parent b7f001f441
commit 0f37379525

View File

@ -110,10 +110,15 @@ def main():
if args.emulator:
params['emulator'] = args.emulator
else:
if os.path.exists("/usr/bin/kvm"): # Debian
params['emulator'] = "/usr/bin/kvm"
elif os.path.exists("/usr/bin/qemu-kvm"): # Redhat
params['emulator'] = "/usr/bin/qemu-kvm"
qemu_kvm_locations = ['/usr/bin/kvm',
'/usr/bin/qemu-kvm',
'/usr/libexec/qemu-kvm']
for location in qemu_kvm_locations:
if os.path.exists(location):
params['emulator'] = location
break
else:
raise RuntimeError("Unable to find location of kvm executable")
if args.console_log:
params['console'] = CONSOLE_LOG % {'console_log': args.console_log}