mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
Use proper XML editting when setting boot device.
The current method is ugly and not future proof if extra options are ever added to the boot list (which is likely).
This commit is contained in:
parent
fb7a999a81
commit
a87933c66c
@ -1312,16 +1312,13 @@ class vmmDomain(gobject.GObject):
|
|||||||
logging.debug("Setting boot device to type: %s" % boot_type)
|
logging.debug("Setting boot device to type: %s" % boot_type)
|
||||||
|
|
||||||
def set_boot_xml(doc, ctx):
|
def set_boot_xml(doc, ctx):
|
||||||
ret = ctx.xpathEval("/domain/os/boot[1]")
|
node = ctx.xpathEval("/domain/os/boot[1]")
|
||||||
if len(ret) > 0:
|
node = (node and node[0] or None)
|
||||||
ret[0].unlinkNode()
|
|
||||||
ret[0].freeNode()
|
if node and node.prop("dev"):
|
||||||
emptyxml=doc.serialize()
|
node.setProp("dev", boot_type)
|
||||||
index = emptyxml.find("</os>")
|
|
||||||
newxml = emptyxml[0:index] + \
|
return doc.serialize()
|
||||||
"<boot dev=\"" + boot_type + "\"/>\n" + \
|
|
||||||
emptyxml[index:]
|
|
||||||
return newxml
|
|
||||||
|
|
||||||
self.redefine(util.xml_parse_wrapper, set_boot_xml)
|
self.redefine(util.xml_parse_wrapper, set_boot_xml)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user