mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
conf: storage: Provide only virStoragePoolDefParse
Replace the virStoragePoolDefParseString/File thin wrappers by virStoragePoolDefParse. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
b3e33a0ef7
commit
97df89d7f5
@ -29914,7 +29914,7 @@ virDomainStorageSourceTranslateSourcePool(virStorageSource *src,
|
|||||||
if (!(poolxml = virStoragePoolGetXMLDesc(pool, 0)))
|
if (!(poolxml = virStoragePoolGetXMLDesc(pool, 0)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!(pooldef = virStoragePoolDefParseString(poolxml, 0)))
|
if (!(pooldef = virStoragePoolDefParse(poolxml, NULL, 0)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
src->srcpool->pooltype = pooldef->type;
|
src->srcpool->pooltype = pooldef->type;
|
||||||
|
@ -972,7 +972,7 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static virStoragePoolDef *
|
virStoragePoolDef *
|
||||||
virStoragePoolDefParse(const char *xmlStr,
|
virStoragePoolDefParse(const char *xmlStr,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
@ -990,21 +990,6 @@ virStoragePoolDefParse(const char *xmlStr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virStoragePoolDef *
|
|
||||||
virStoragePoolDefParseString(const char *xmlStr,
|
|
||||||
unsigned int flags)
|
|
||||||
{
|
|
||||||
return virStoragePoolDefParse(xmlStr, NULL, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
virStoragePoolDef *
|
|
||||||
virStoragePoolDefParseFile(const char *filename)
|
|
||||||
{
|
|
||||||
return virStoragePoolDefParse(NULL, filename, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virStoragePoolSourceFormat(virBuffer *buf,
|
virStoragePoolSourceFormat(virBuffer *buf,
|
||||||
virStoragePoolOptions *options,
|
virStoragePoolOptions *options,
|
||||||
|
@ -272,11 +272,9 @@ virStoragePoolDef *
|
|||||||
virStoragePoolDefParseXML(xmlXPathContextPtr ctxt);
|
virStoragePoolDefParseXML(xmlXPathContextPtr ctxt);
|
||||||
|
|
||||||
virStoragePoolDef *
|
virStoragePoolDef *
|
||||||
virStoragePoolDefParseString(const char *xml,
|
virStoragePoolDefParse(const char *xmlStr,
|
||||||
unsigned int flags);
|
const char *filename,
|
||||||
|
unsigned int flags);
|
||||||
virStoragePoolDef *
|
|
||||||
virStoragePoolDefParseFile(const char *filename);
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
virStoragePoolDefFormat(virStoragePoolDef *def);
|
virStoragePoolDefFormat(virStoragePoolDef *def);
|
||||||
|
@ -1579,7 +1579,7 @@ virStoragePoolObjLoad(virStoragePoolObjList *pools,
|
|||||||
|
|
||||||
VIR_DEBUG("loading storage pool config XML '%s'", path);
|
VIR_DEBUG("loading storage pool config XML '%s'", path);
|
||||||
|
|
||||||
if (!(def = virStoragePoolDefParseFile(path)))
|
if (!(def = virStoragePoolDefParse(NULL, path, 0)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!virStringMatchesNameSuffix(file, def->name, ".xml")) {
|
if (!virStringMatchesNameSuffix(file, def->name, ".xml")) {
|
||||||
|
@ -1053,9 +1053,8 @@ virStoragePoolCapsNew;
|
|||||||
virStoragePartedFsTypeToString;
|
virStoragePartedFsTypeToString;
|
||||||
virStoragePoolDefFormat;
|
virStoragePoolDefFormat;
|
||||||
virStoragePoolDefFree;
|
virStoragePoolDefFree;
|
||||||
virStoragePoolDefParseFile;
|
virStoragePoolDefParse;
|
||||||
virStoragePoolDefParseSourceString;
|
virStoragePoolDefParseSourceString;
|
||||||
virStoragePoolDefParseString;
|
|
||||||
virStoragePoolFormatDiskTypeFromString;
|
virStoragePoolFormatDiskTypeFromString;
|
||||||
virStoragePoolFormatDiskTypeToString;
|
virStoragePoolFormatDiskTypeToString;
|
||||||
virStoragePoolFormatFileSystemNetTypeToString;
|
virStoragePoolFormatFileSystemNetTypeToString;
|
||||||
|
@ -721,7 +721,7 @@ storagePoolCreateXML(virConnectPtr conn,
|
|||||||
VIR_EXCLUSIVE_FLAGS_RET(VIR_STORAGE_POOL_BUILD_OVERWRITE,
|
VIR_EXCLUSIVE_FLAGS_RET(VIR_STORAGE_POOL_BUILD_OVERWRITE,
|
||||||
VIR_STORAGE_POOL_BUILD_NO_OVERWRITE, NULL);
|
VIR_STORAGE_POOL_BUILD_NO_OVERWRITE, NULL);
|
||||||
|
|
||||||
if (!(newDef = virStoragePoolDefParseString(xml, 0)))
|
if (!(newDef = virStoragePoolDefParse(xml, NULL, 0)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virStoragePoolCreateXMLEnsureACL(conn, newDef) < 0)
|
if (virStoragePoolCreateXMLEnsureACL(conn, newDef) < 0)
|
||||||
@ -801,7 +801,7 @@ storagePoolDefineXML(virConnectPtr conn,
|
|||||||
|
|
||||||
virCheckFlags(VIR_STORAGE_POOL_DEFINE_VALIDATE, NULL);
|
virCheckFlags(VIR_STORAGE_POOL_DEFINE_VALIDATE, NULL);
|
||||||
|
|
||||||
if (!(newDef = virStoragePoolDefParseString(xml, flags)))
|
if (!(newDef = virStoragePoolDefParse(xml, NULL, flags)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virXMLCheckIllegalChars("name", newDef->name, "\n") < 0)
|
if (virXMLCheckIllegalChars("name", newDef->name, "\n") < 0)
|
||||||
|
@ -6631,7 +6631,7 @@ testStoragePoolCreateXML(virConnectPtr conn,
|
|||||||
virCheckFlags(0, NULL);
|
virCheckFlags(0, NULL);
|
||||||
|
|
||||||
virObjectLock(privconn);
|
virObjectLock(privconn);
|
||||||
if (!(newDef = virStoragePoolDefParseString(xml, 0)))
|
if (!(newDef = virStoragePoolDefParse(xml, NULL, 0)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(obj = virStoragePoolObjListAdd(privconn->pools, &newDef,
|
if (!(obj = virStoragePoolObjListAdd(privconn->pools, &newDef,
|
||||||
@ -6693,7 +6693,7 @@ testStoragePoolDefineXML(virConnectPtr conn,
|
|||||||
virCheckFlags(VIR_STORAGE_POOL_DEFINE_VALIDATE, NULL);
|
virCheckFlags(VIR_STORAGE_POOL_DEFINE_VALIDATE, NULL);
|
||||||
|
|
||||||
virObjectLock(privconn);
|
virObjectLock(privconn);
|
||||||
if (!(newDef = virStoragePoolDefParseString(xml, flags)))
|
if (!(newDef = virStoragePoolDefParse(xml, NULL, flags)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
newDef->capacity = defaultPoolCap;
|
newDef->capacity = defaultPoolCap;
|
||||||
|
@ -27,7 +27,7 @@ testCompareXMLToArgvFiles(bool shouldFail,
|
|||||||
g_autofree char *src = NULL;
|
g_autofree char *src = NULL;
|
||||||
g_autoptr(virCommand) cmd = NULL;
|
g_autoptr(virCommand) cmd = NULL;
|
||||||
|
|
||||||
if (!(def = virStoragePoolDefParseFile(poolxml)))
|
if (!(def = virStoragePoolDefParse(NULL, poolxml, 0)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
defTypeStr = virStoragePoolTypeToString(def->type);
|
defTypeStr = virStoragePoolTypeToString(def->type);
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml)
|
|||||||
g_autofree char *actual = NULL;
|
g_autofree char *actual = NULL;
|
||||||
g_autoptr(virStoragePoolDef) dev = NULL;
|
g_autoptr(virStoragePoolDef) dev = NULL;
|
||||||
|
|
||||||
if (!(dev = virStoragePoolDefParseFile(inxml)))
|
if (!(dev = virStoragePoolDefParse(NULL, inxml, 0)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!(actual = virStoragePoolDefFormat(dev)))
|
if (!(actual = virStoragePoolDefFormat(dev)))
|
||||||
|
@ -48,7 +48,7 @@ testCompareXMLToArgvFiles(bool shouldFail,
|
|||||||
g_autoptr(virStorageVolDef) inputvol = NULL;
|
g_autoptr(virStorageVolDef) inputvol = NULL;
|
||||||
g_autoptr(virStoragePoolDef) inputpool = NULL;
|
g_autoptr(virStoragePoolDef) inputpool = NULL;
|
||||||
|
|
||||||
if (!(def = virStoragePoolDefParseFile(poolxml)))
|
if (!(def = virStoragePoolDefParse(NULL, poolxml, 0)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(obj = virStoragePoolObjNew())) {
|
if (!(obj = virStoragePoolObjNew())) {
|
||||||
@ -58,7 +58,7 @@ testCompareXMLToArgvFiles(bool shouldFail,
|
|||||||
virStoragePoolObjSetDef(obj, def);
|
virStoragePoolObjSetDef(obj, def);
|
||||||
|
|
||||||
if (inputpoolxml) {
|
if (inputpoolxml) {
|
||||||
if (!(inputpool = virStoragePoolDefParseFile(inputpoolxml)))
|
if (!(inputpool = virStoragePoolDefParse(NULL, inputpoolxml, 0)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ testCompareXMLToXMLFiles(const char *poolxml, const char *inxml,
|
|||||||
g_autoptr(virStoragePoolDef) pool = NULL;
|
g_autoptr(virStoragePoolDef) pool = NULL;
|
||||||
g_autoptr(virStorageVolDef) dev = NULL;
|
g_autoptr(virStorageVolDef) dev = NULL;
|
||||||
|
|
||||||
if (!(pool = virStoragePoolDefParseFile(poolxml)))
|
if (!(pool = virStoragePoolDefParse(NULL, poolxml, 0)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!(dev = virStorageVolDefParseFile(pool, inxml, flags)))
|
if (!(dev = virStorageVolDefParseFile(pool, inxml, flags)))
|
||||||
|
Loading…
Reference in New Issue
Block a user