mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
conf: use virXMLPropString for boot parsing
XPath is good for random search of elements, not for accessing attributes of one node. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
8cf6eb4612
commit
0b36d6cb08
@ -16039,6 +16039,7 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt,
|
||||
virDomainDefPtr def)
|
||||
{
|
||||
xmlNodePtr *nodes = NULL;
|
||||
xmlNodePtr node;
|
||||
size_t i;
|
||||
int n;
|
||||
char *tmp = NULL;
|
||||
@ -16088,7 +16089,8 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt,
|
||||
def->os.bootDevs[0] = VIR_DOMAIN_BOOT_DISK;
|
||||
}
|
||||
|
||||
tmp = virXPathString("string(./os/bootmenu[1]/@enable)", ctxt);
|
||||
if ((node = virXPathNode("./os/bootmenu[1]", ctxt))) {
|
||||
tmp = virXMLPropString(node, "enable");
|
||||
if (tmp) {
|
||||
def->os.bootmenu = virTristateBoolTypeFromString(tmp);
|
||||
if (def->os.bootmenu <= 0) {
|
||||
@ -16102,7 +16104,7 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt,
|
||||
VIR_FREE(tmp);
|
||||
}
|
||||
|
||||
tmp = virXPathString("string(./os/bootmenu[1]/@timeout)", ctxt);
|
||||
tmp = virXMLPropString(node, "timeout");
|
||||
if (tmp && def->os.bootmenu == VIR_TRISTATE_BOOL_YES) {
|
||||
if (virStrToLong_uip(tmp, NULL, 0, &def->os.bm_timeout) < 0 ||
|
||||
def->os.bm_timeout > 65535) {
|
||||
@ -16114,8 +16116,10 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt,
|
||||
def->os.bm_timeout_set = true;
|
||||
}
|
||||
VIR_FREE(tmp);
|
||||
}
|
||||
|
||||
tmp = virXPathString("string(./os/bios[1]/@useserial)", ctxt);
|
||||
if ((node = virXPathNode("./os/bios[1]", ctxt))) {
|
||||
tmp = virXMLPropString(node, "useserial");
|
||||
if (tmp) {
|
||||
if (STREQ(tmp, "yes")) {
|
||||
if (virXPathULong("count(./devices/serial)",
|
||||
@ -16132,7 +16136,7 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt,
|
||||
VIR_FREE(tmp);
|
||||
}
|
||||
|
||||
tmp = virXPathString("string(./os/bios[1]/@rebootTimeout)", ctxt);
|
||||
tmp = virXMLPropString(node, "rebootTimeout");
|
||||
if (tmp) {
|
||||
/* that was really just for the check if it is there */
|
||||
|
||||
@ -16145,6 +16149,7 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt,
|
||||
}
|
||||
def->os.bios.rt_set = true;
|
||||
}
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user