Fix duplicate of -no-kvm options

Fix #356
This commit is contained in:
Julien Duponchelle 2015-11-10 16:25:02 +01:00
parent caade47e16
commit 63edcc1c34
2 changed files with 22 additions and 2 deletions

View File

@ -659,7 +659,7 @@ class QemuVM(BaseVM):
options = options.replace("-no-kvm", "") options = options.replace("-no-kvm", "")
if "-enable-kvm" in options: if "-enable-kvm" in options:
options = options.replace("-enable-kvm", "") options = options.replace("-enable-kvm", "")
elif "-icount" in options: elif "-icount" in options and ("-no-kvm" not in options):
# automatically add the -no-kvm option if -icount is detected # automatically add the -no-kvm option if -icount is detected
# to help with the migration of ASA VMs created before version 1.4 # to help with the migration of ASA VMs created before version 1.4
options = "-no-kvm " + options options = "-no-kvm " + options

View File

@ -431,12 +431,32 @@ def test_hdd_disk_image(vm, tmpdir):
assert vm.hdd_disk_image == str(tmpdir / "QEMU" / "test") assert vm.hdd_disk_image == str(tmpdir / "QEMU" / "test")
def test_options(vm): def test_options(linux_platform, vm):
vm.kvm = False vm.kvm = False
vm.options = "-usb" vm.options = "-usb"
assert vm.options == "-usb" assert vm.options == "-usb"
assert vm.kvm is False assert vm.kvm is False
vm.options = "-no-kvm"
assert vm.options == "-no-kvm"
vm.options = "-enable-kvm"
assert vm.options == "-enable-kvm"
vm.options = "-icount 12"
assert vm.options == "-no-kvm -icount 12"
vm.options = "-icount 12 -no-kvm"
assert vm.options == "-icount 12 -no-kvm"
def test_options_windows(windows_platform, vm):
vm.options = "-no-kvm"
assert vm.options == ""
vm.options = "-enable-kvm"
assert vm.options == ""
def test_get_qemu_img(vm, tmpdir): def test_get_qemu_img(vm, tmpdir):