mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
conf: storage: Remove virStorageVolDefParseNode
Proper use of virXMLParse replaces everything the function provides. Callers can use virStorageVolDefParseXML instead. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
97df89d7f5
commit
3c56186031
@ -1234,7 +1234,7 @@ virStorageCheckCompat(const char *compat)
|
||||
}
|
||||
|
||||
|
||||
static virStorageVolDef *
|
||||
virStorageVolDef *
|
||||
virStorageVolDefParseXML(virStoragePoolDef *pool,
|
||||
xmlXPathContextPtr ctxt,
|
||||
unsigned int flags)
|
||||
@ -1401,45 +1401,20 @@ virStorageVolDefParseXML(virStoragePoolDef *pool,
|
||||
}
|
||||
|
||||
|
||||
virStorageVolDef *
|
||||
virStorageVolDefParseNode(virStoragePoolDef *pool,
|
||||
xmlDocPtr xml,
|
||||
xmlNodePtr root,
|
||||
unsigned int flags)
|
||||
{
|
||||
g_autoptr(xmlXPathContext) ctxt = NULL;
|
||||
|
||||
if (!virXMLNodeNameEqual(root, "volume")) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("unexpected root element <%s>, "
|
||||
"expecting <volume>"),
|
||||
root->name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(ctxt = virXMLXPathContextNew(xml)))
|
||||
return NULL;
|
||||
|
||||
ctxt->node = root;
|
||||
return virStorageVolDefParseXML(pool, ctxt, flags);
|
||||
}
|
||||
|
||||
|
||||
static virStorageVolDef *
|
||||
virStorageVolDefParse(virStoragePoolDef *pool,
|
||||
const char *xmlStr,
|
||||
const char *filename,
|
||||
unsigned int flags)
|
||||
{
|
||||
virStorageVolDef *ret = NULL;
|
||||
g_autoptr(xmlDoc) xml = NULL;
|
||||
g_autoptr(xmlXPathContext) ctxt = NULL;
|
||||
|
||||
if ((xml = virXMLParse(filename, xmlStr, _("(storage_volume_definition)"),
|
||||
NULL, NULL, NULL, false))) {
|
||||
ret = virStorageVolDefParseNode(pool, xml, xmlDocGetRootElement(xml), flags);
|
||||
}
|
||||
if (!(xml = virXMLParse(filename, xmlStr, _("(storage_volume_definition)"),
|
||||
"volume", &ctxt, NULL, false)))
|
||||
return NULL;
|
||||
|
||||
return ret;
|
||||
return virStorageVolDefParseXML(pool, ctxt, flags);
|
||||
}
|
||||
|
||||
|
||||
|
@ -297,9 +297,8 @@ virStorageVolDefParseFile(virStoragePoolDef *pool,
|
||||
unsigned int flags);
|
||||
|
||||
virStorageVolDef *
|
||||
virStorageVolDefParseNode(virStoragePoolDef *pool,
|
||||
xmlDocPtr xml,
|
||||
xmlNodePtr root,
|
||||
virStorageVolDefParseXML(virStoragePoolDef *pool,
|
||||
xmlXPathContextPtr ctxt,
|
||||
unsigned int flags);
|
||||
|
||||
char *
|
||||
|
@ -1079,8 +1079,8 @@ virStorageVolDefFindByPath;
|
||||
virStorageVolDefFormat;
|
||||
virStorageVolDefFree;
|
||||
virStorageVolDefParseFile;
|
||||
virStorageVolDefParseNode;
|
||||
virStorageVolDefParseString;
|
||||
virStorageVolDefParseXML;
|
||||
virStorageVolDefRefreshAllocationTypeFromString;
|
||||
virStorageVolDefRefreshAllocationTypeToString;
|
||||
virStorageVolTypeFromString;
|
||||
|
@ -1147,6 +1147,7 @@ testOpenVolumesForPool(const char *file,
|
||||
xmlXPathContextPtr ctxt,
|
||||
virStoragePoolObj *obj)
|
||||
{
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
||||
virStoragePoolDef *def = virStoragePoolObjGetDef(obj);
|
||||
size_t i;
|
||||
int num;
|
||||
@ -1158,11 +1159,10 @@ testOpenVolumesForPool(const char *file,
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < num; i++) {
|
||||
xmlNodePtr node = testParseXMLDocFromFile(nodes[i], file);
|
||||
if (!node)
|
||||
if (!(ctxt->node = testParseXMLDocFromFile(nodes[i], file)))
|
||||
return -1;
|
||||
|
||||
if (!(volDef = virStorageVolDefParseNode(def, ctxt->doc, node, 0)))
|
||||
if (!(volDef = virStorageVolDefParseXML(def, ctxt, 0)))
|
||||
return -1;
|
||||
|
||||
if (!volDef->target.path) {
|
||||
|
Loading…
Reference in New Issue
Block a user