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;
|
char *str = NULL;
|
||||||
xmlNodePtr hostCPUNode;
|
xmlNodePtr hostCPUNode;
|
||||||
xmlNodePtr *nodes = NULL;
|
xmlNodePtr *nodes = NULL;
|
||||||
xmlNodePtr oldnode = ctxt->node;
|
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||||
qemuMonitorCPUModelInfoPtr hostCPU = NULL;
|
qemuMonitorCPUModelInfoPtr hostCPU = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
size_t i;
|
size_t i;
|
||||||
@ -3160,7 +3160,6 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsPtr qemuCaps,
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
ctxt->node = oldnode;
|
|
||||||
VIR_FREE(str);
|
VIR_FREE(str);
|
||||||
VIR_FREE(nodes);
|
VIR_FREE(nodes);
|
||||||
qemuMonitorCPUModelInfoFree(hostCPU);
|
qemuMonitorCPUModelInfoFree(hostCPU);
|
||||||
|
@ -2717,7 +2717,7 @@ qemuDomainObjPrivateXMLParseJobNBDSource(xmlNodePtr node,
|
|||||||
xmlXPathContextPtr ctxt,
|
xmlXPathContextPtr ctxt,
|
||||||
virDomainDiskDefPtr disk)
|
virDomainDiskDefPtr disk)
|
||||||
{
|
{
|
||||||
xmlNodePtr savedNode = ctxt->node;
|
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||||
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
||||||
char *format = NULL;
|
char *format = NULL;
|
||||||
char *type = NULL;
|
char *type = NULL;
|
||||||
@ -2772,7 +2772,6 @@ qemuDomainObjPrivateXMLParseJobNBDSource(xmlNodePtr node,
|
|||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(format);
|
VIR_FREE(format);
|
||||||
VIR_FREE(type);
|
VIR_FREE(type);
|
||||||
ctxt->node = savedNode;
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2827,7 +2826,7 @@ qemuDomainObjPrivateXMLParseJob(virDomainObjPtr vm,
|
|||||||
qemuDomainObjPrivatePtr priv,
|
qemuDomainObjPrivatePtr priv,
|
||||||
xmlXPathContextPtr ctxt)
|
xmlXPathContextPtr ctxt)
|
||||||
{
|
{
|
||||||
xmlNodePtr savedNode = ctxt->node;
|
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||||
char *tmp = NULL;
|
char *tmp = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
@ -2884,7 +2883,6 @@ qemuDomainObjPrivateXMLParseJob(virDomainObjPtr vm,
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
ctxt->node = savedNode;
|
|
||||||
VIR_FREE(tmp);
|
VIR_FREE(tmp);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -946,7 +946,7 @@ qemuMigrationCookieNetworkXMLParse(xmlXPathContextPtr ctxt)
|
|||||||
int n;
|
int n;
|
||||||
xmlNodePtr *interfaces = NULL;
|
xmlNodePtr *interfaces = NULL;
|
||||||
char *vporttype;
|
char *vporttype;
|
||||||
xmlNodePtr save_ctxt = ctxt->node;
|
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||||
|
|
||||||
if (VIR_ALLOC(optr) < 0)
|
if (VIR_ALLOC(optr) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
@ -978,7 +978,6 @@ qemuMigrationCookieNetworkXMLParse(xmlXPathContextPtr ctxt)
|
|||||||
VIR_FREE(interfaces);
|
VIR_FREE(interfaces);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
ctxt->node = save_ctxt;
|
|
||||||
return optr;
|
return optr;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
@ -997,7 +996,7 @@ qemuMigrationCookieNBDXMLParse(xmlXPathContextPtr ctxt)
|
|||||||
size_t i;
|
size_t i;
|
||||||
int n;
|
int n;
|
||||||
xmlNodePtr *disks = NULL;
|
xmlNodePtr *disks = NULL;
|
||||||
xmlNodePtr save_ctxt = ctxt->node;
|
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||||
|
|
||||||
if (VIR_ALLOC(ret) < 0)
|
if (VIR_ALLOC(ret) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
@ -1044,7 +1043,6 @@ qemuMigrationCookieNBDXMLParse(xmlXPathContextPtr ctxt)
|
|||||||
VIR_FREE(port);
|
VIR_FREE(port);
|
||||||
VIR_FREE(capacity);
|
VIR_FREE(capacity);
|
||||||
VIR_FREE(disks);
|
VIR_FREE(disks);
|
||||||
ctxt->node = save_ctxt;
|
|
||||||
return ret;
|
return ret;
|
||||||
error:
|
error:
|
||||||
qemuMigrationCookieNBDFree(ret);
|
qemuMigrationCookieNBDFree(ret);
|
||||||
@ -1058,7 +1056,7 @@ qemuMigrationCookieStatisticsXMLParse(xmlXPathContextPtr ctxt)
|
|||||||
{
|
{
|
||||||
qemuDomainJobInfoPtr jobInfo = NULL;
|
qemuDomainJobInfoPtr jobInfo = NULL;
|
||||||
qemuMonitorMigrationStats *stats;
|
qemuMonitorMigrationStats *stats;
|
||||||
xmlNodePtr save_ctxt = ctxt->node;
|
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||||
|
|
||||||
if (!(ctxt->node = virXPathNode("./statistics", ctxt)))
|
if (!(ctxt->node = virXPathNode("./statistics", ctxt)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1136,7 +1134,6 @@ qemuMigrationCookieStatisticsXMLParse(xmlXPathContextPtr ctxt)
|
|||||||
virXPathInt("string(./" VIR_DOMAIN_JOB_AUTO_CONVERGE_THROTTLE "[1])",
|
virXPathInt("string(./" VIR_DOMAIN_JOB_AUTO_CONVERGE_THROTTLE "[1])",
|
||||||
ctxt, &stats->cpu_throttle_percentage);
|
ctxt, &stats->cpu_throttle_percentage);
|
||||||
cleanup:
|
cleanup:
|
||||||
ctxt->node = save_ctxt;
|
|
||||||
return jobInfo;
|
return jobInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user