mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemu: Use VIR_XPATH_NODE_AUTORESTORE when XPath context is modified
Use the new helper when moving around the current node of the XPath context. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
23ab209272
commit
b6aacfc435
@ -3042,7 +3042,7 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsPtr qemuCaps,
|
||||
char *str = NULL;
|
||||
xmlNodePtr hostCPUNode;
|
||||
xmlNodePtr *nodes = NULL;
|
||||
xmlNodePtr oldnode = ctxt->node;
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||
qemuMonitorCPUModelInfoPtr hostCPU = NULL;
|
||||
int ret = -1;
|
||||
size_t i;
|
||||
@ -3160,7 +3160,6 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsPtr qemuCaps,
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
ctxt->node = oldnode;
|
||||
VIR_FREE(str);
|
||||
VIR_FREE(nodes);
|
||||
qemuMonitorCPUModelInfoFree(hostCPU);
|
||||
|
@ -2717,7 +2717,7 @@ qemuDomainObjPrivateXMLParseJobNBDSource(xmlNodePtr node,
|
||||
xmlXPathContextPtr ctxt,
|
||||
virDomainDiskDefPtr disk)
|
||||
{
|
||||
xmlNodePtr savedNode = ctxt->node;
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
||||
char *format = NULL;
|
||||
char *type = NULL;
|
||||
@ -2772,7 +2772,6 @@ qemuDomainObjPrivateXMLParseJobNBDSource(xmlNodePtr node,
|
||||
cleanup:
|
||||
VIR_FREE(format);
|
||||
VIR_FREE(type);
|
||||
ctxt->node = savedNode;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -2827,7 +2826,7 @@ qemuDomainObjPrivateXMLParseJob(virDomainObjPtr vm,
|
||||
qemuDomainObjPrivatePtr priv,
|
||||
xmlXPathContextPtr ctxt)
|
||||
{
|
||||
xmlNodePtr savedNode = ctxt->node;
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||
char *tmp = NULL;
|
||||
int ret = -1;
|
||||
|
||||
@ -2884,7 +2883,6 @@ qemuDomainObjPrivateXMLParseJob(virDomainObjPtr vm,
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
ctxt->node = savedNode;
|
||||
VIR_FREE(tmp);
|
||||
return ret;
|
||||
}
|
||||
|
@ -946,7 +946,7 @@ qemuMigrationCookieNetworkXMLParse(xmlXPathContextPtr ctxt)
|
||||
int n;
|
||||
xmlNodePtr *interfaces = NULL;
|
||||
char *vporttype;
|
||||
xmlNodePtr save_ctxt = ctxt->node;
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||
|
||||
if (VIR_ALLOC(optr) < 0)
|
||||
goto error;
|
||||
@ -978,7 +978,6 @@ qemuMigrationCookieNetworkXMLParse(xmlXPathContextPtr ctxt)
|
||||
VIR_FREE(interfaces);
|
||||
|
||||
cleanup:
|
||||
ctxt->node = save_ctxt;
|
||||
return optr;
|
||||
|
||||
error:
|
||||
@ -997,7 +996,7 @@ qemuMigrationCookieNBDXMLParse(xmlXPathContextPtr ctxt)
|
||||
size_t i;
|
||||
int n;
|
||||
xmlNodePtr *disks = NULL;
|
||||
xmlNodePtr save_ctxt = ctxt->node;
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||
|
||||
if (VIR_ALLOC(ret) < 0)
|
||||
goto error;
|
||||
@ -1044,7 +1043,6 @@ qemuMigrationCookieNBDXMLParse(xmlXPathContextPtr ctxt)
|
||||
VIR_FREE(port);
|
||||
VIR_FREE(capacity);
|
||||
VIR_FREE(disks);
|
||||
ctxt->node = save_ctxt;
|
||||
return ret;
|
||||
error:
|
||||
qemuMigrationCookieNBDFree(ret);
|
||||
@ -1058,7 +1056,7 @@ qemuMigrationCookieStatisticsXMLParse(xmlXPathContextPtr ctxt)
|
||||
{
|
||||
qemuDomainJobInfoPtr jobInfo = NULL;
|
||||
qemuMonitorMigrationStats *stats;
|
||||
xmlNodePtr save_ctxt = ctxt->node;
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||
|
||||
if (!(ctxt->node = virXPathNode("./statistics", ctxt)))
|
||||
goto cleanup;
|
||||
@ -1136,7 +1134,6 @@ qemuMigrationCookieStatisticsXMLParse(xmlXPathContextPtr ctxt)
|
||||
virXPathInt("string(./" VIR_DOMAIN_JOB_AUTO_CONVERGE_THROTTLE "[1])",
|
||||
ctxt, &stats->cpu_throttle_percentage);
|
||||
cleanup:
|
||||
ctxt->node = save_ctxt;
|
||||
return jobInfo;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user