mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
conf: networkportdef: Provide only virNetworkPortDefParse
Replace the two helpers virNetworkPortDefParseString/File with the common helper. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
0589afb96b
commit
ed080445a6
@ -29537,7 +29537,7 @@ virDomainNetCreatePort(virConnectPtr conn,
|
||||
VIR_FREE(portxml);
|
||||
|
||||
if (!(portxml = virNetworkPortGetXMLDesc(port, 0)) ||
|
||||
!(portdef = virNetworkPortDefParseString(portxml, 0)) ||
|
||||
!(portdef = virNetworkPortDefParse(portxml, NULL, 0)) ||
|
||||
virDomainNetDefActualFromNetworkPort(iface, portdef) < 0) {
|
||||
virErrorPreserveLast(&save_err);
|
||||
virNetworkPortDelete(port, 0);
|
||||
|
@ -1833,7 +1833,7 @@ virNetworkObjLoadAllPorts(virNetworkObj *net,
|
||||
|
||||
file = g_strdup_printf("%s/%s.xml", dir, de->d_name);
|
||||
|
||||
portdef = virNetworkPortDefParseFile(file);
|
||||
portdef = virNetworkPortDefParse(NULL, file, 0);
|
||||
if (!portdef) {
|
||||
VIR_WARN("Cannot parse port %s", file);
|
||||
continue;
|
||||
|
@ -251,7 +251,7 @@ virNetworkPortDefParseXML(xmlXPathContextPtr ctxt)
|
||||
}
|
||||
|
||||
|
||||
static virNetworkPortDef *
|
||||
virNetworkPortDef *
|
||||
virNetworkPortDefParse(const char *xmlStr,
|
||||
const char *filename,
|
||||
unsigned int flags)
|
||||
@ -268,21 +268,6 @@ virNetworkPortDefParse(const char *xmlStr,
|
||||
}
|
||||
|
||||
|
||||
virNetworkPortDef *
|
||||
virNetworkPortDefParseString(const char *xmlStr,
|
||||
unsigned int flags)
|
||||
{
|
||||
return virNetworkPortDefParse(xmlStr, NULL, flags);
|
||||
}
|
||||
|
||||
|
||||
virNetworkPortDef *
|
||||
virNetworkPortDefParseFile(const char *filename)
|
||||
{
|
||||
return virNetworkPortDefParse(NULL, filename, 0);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
virNetworkPortDefFormat(const virNetworkPortDef *def)
|
||||
{
|
||||
|
@ -81,12 +81,10 @@ virNetworkPortDefFree(virNetworkPortDef *port);
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNetworkPortDef, virNetworkPortDefFree);
|
||||
|
||||
virNetworkPortDef *
|
||||
virNetworkPortDefParseString(const char *xml,
|
||||
virNetworkPortDefParse(const char *xmlStr,
|
||||
const char *filename,
|
||||
unsigned int flags);
|
||||
|
||||
virNetworkPortDef *
|
||||
virNetworkPortDefParseFile(const char *filename);
|
||||
|
||||
char *
|
||||
virNetworkPortDefFormat(const virNetworkPortDef *def);
|
||||
|
||||
|
@ -1326,8 +1326,7 @@ virNetworkObjUpdateAssignDef;
|
||||
virNetworkPortDefFormat;
|
||||
virNetworkPortDefFormatBuf;
|
||||
virNetworkPortDefFree;
|
||||
virNetworkPortDefParseFile;
|
||||
virNetworkPortDefParseString;
|
||||
virNetworkPortDefParse;
|
||||
virNetworkPortDefSaveStatus;
|
||||
|
||||
|
||||
|
@ -4844,7 +4844,7 @@ networkPortCreateXML(virNetworkPtr net,
|
||||
|
||||
def = virNetworkObjGetDef(obj);
|
||||
|
||||
if (!(portdef = virNetworkPortDefParseString(xmldesc, flags)))
|
||||
if (!(portdef = virNetworkPortDefParse(xmldesc, NULL, flags)))
|
||||
goto cleanup;
|
||||
|
||||
if (virNetworkPortCreateXMLEnsureACL(net->conn, def, portdef) < 0)
|
||||
|
@ -38,7 +38,7 @@ testCompareXMLToXMLFiles(const char *expected)
|
||||
g_autofree char *actual = NULL;
|
||||
g_autoptr(virNetworkPortDef) dev = NULL;
|
||||
|
||||
if (!(dev = virNetworkPortDefParseFile(expected)))
|
||||
if (!(dev = virNetworkPortDefParse(NULL, expected, 0)))
|
||||
return -1;
|
||||
|
||||
if (!(actual = virNetworkPortDefFormat(dev)))
|
||||
|
Loading…
Reference in New Issue
Block a user