[PATCH] virt.kvm_vm: Autodetect whenever bootindex should be used

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Also, avoid checking twice and use the result when to
add boot=on/off to the command line.

Signed-off-by: Gerd Hoffmann <kraxel@xxxxxxxxxx>
Signed-off-by: Lucas Meneghel Rodrigues <lmr@xxxxxxxxxx>
---
 client/virt/kvm_vm.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py
index 19d018d..35e12b6 100644
--- a/client/virt/kvm_vm.py
+++ b/client/virt/kvm_vm.py
@@ -474,7 +474,7 @@ class VM(virt_vm.BaseVM):
                       lun=None):
             name = None
             dev = ""
-            if self.params.get("use_bootindex") in ['yes', 'on', True]:
+            if not re.search("boot=on\|off", help, re.MULTILINE):
                 if boot in ['yes', 'on', True]:
                     bootindex = "1"
                 boot = "unused"
@@ -550,7 +550,8 @@ class VM(virt_vm.BaseVM):
             cmd += _add_option("werror", werror)
             cmd += _add_option("serial", serial)
             cmd += _add_option("snapshot", snapshot, bool)
-            if re.search("boot=on\|off", help, re.MULTILINE):
+            # Only add boot=on/off if necessary (deprecated in newer qemu)
+            if boot != "unused":
                 cmd += _add_option("boot", boot, bool)
             cmd += _add_option("id", name)
             cmd += _add_option("readonly", readonly, bool)
-- 
1.7.11.4

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux