[Kimchi-devel] [PATCH][Kimchi] Issue #1012: Boot order gets reset to only one entry after editing a VM

Ramon Medeiros ramonn at linux.vnet.ibm.com
Wed Sep 21 17:31:53 UTC 2016


The comparison 'if "bootorder" or "bootmenu" in params' was always
returning true, beyond this error, the function always remove boot
sequence, without check if the user asked to.

Signed-off-by: Ramon Medeiros <ramonn at linux.vnet.ibm.com>
---
 model/vms.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/model/vms.py b/model/vms.py
index b889166..f56038d 100644
--- a/model/vms.py
+++ b/model/vms.py
@@ -775,12 +775,12 @@ class VMModel(object):
         # get machine type
         os = et.find("os")
 
-        # remove old order
-        for device in os.findall("boot"):
-            os.remove(device)
-
         # add new bootorder
         if "bootorder" in params:
+
+            # remove old order
+            [os.remove(device) for device in os.findall("boot")]
+
             for device in get_bootorder_node(params["bootorder"]):
                 os.append(device)
 
@@ -858,7 +858,7 @@ class VMModel(object):
             new_xml = self._update_memory_config(new_xml, params, dom)
 
         # update bootorder or bootmenu
-        if "bootorder" or "bootmenu" in params:
+        if "bootorder" in params or "bootmenu" in params:
             new_xml = self._update_bootorder(new_xml, params)
 
         snapshots_info = []
-- 
2.5.5




More information about the Kimchi-devel mailing list