mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
conf: network: Provide only virNetworkDefParse
Replace virNetworkDefParseString/File by direct calls to virNetworkDefParse. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
e56e82a654
commit
1eb67d24de
@ -29728,7 +29728,7 @@ virDomainNetResolveActualType(virDomainNetDef *iface)
|
||||
if (!(xml = virNetworkGetXMLDesc(net, 0)))
|
||||
return -1;
|
||||
|
||||
if (!(def = virNetworkDefParseString(xml, NULL, false)))
|
||||
if (!(def = virNetworkDefParse(xml, NULL, NULL, false)))
|
||||
return -1;
|
||||
|
||||
switch ((virNetworkForwardType) def->forward.type) {
|
||||
|
@ -315,7 +315,7 @@ virNetworkDefCopy(virNetworkDef *def,
|
||||
if (!(xml = virNetworkDefFormat(def, xmlopt, flags)))
|
||||
return NULL;
|
||||
|
||||
return virNetworkDefParseString(xml, xmlopt, false);
|
||||
return virNetworkDefParse(xml, NULL, xmlopt, false);
|
||||
}
|
||||
|
||||
|
||||
@ -2025,7 +2025,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt,
|
||||
}
|
||||
|
||||
|
||||
static virNetworkDef *
|
||||
virNetworkDef *
|
||||
virNetworkDefParse(const char *xmlStr,
|
||||
const char *filename,
|
||||
virNetworkXMLOption *xmlopt,
|
||||
@ -2046,23 +2046,6 @@ virNetworkDefParse(const char *xmlStr,
|
||||
}
|
||||
|
||||
|
||||
virNetworkDef *
|
||||
virNetworkDefParseString(const char *xmlStr,
|
||||
virNetworkXMLOption *xmlopt,
|
||||
bool validate)
|
||||
{
|
||||
return virNetworkDefParse(xmlStr, NULL, xmlopt, validate);
|
||||
}
|
||||
|
||||
|
||||
virNetworkDef *
|
||||
virNetworkDefParseFile(const char *filename,
|
||||
virNetworkXMLOption *xmlopt)
|
||||
{
|
||||
return virNetworkDefParse(NULL, filename, xmlopt, false);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virNetworkDNSDefFormat(virBuffer *buf,
|
||||
const virNetworkDNSDef *def)
|
||||
|
@ -325,14 +325,11 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt,
|
||||
virNetworkXMLOption *xmlopt);
|
||||
|
||||
virNetworkDef *
|
||||
virNetworkDefParseString(const char *xmlStr,
|
||||
virNetworkDefParse(const char *xmlStr,
|
||||
const char *filename,
|
||||
virNetworkXMLOption *xmlopt,
|
||||
bool validate);
|
||||
|
||||
virNetworkDef *
|
||||
virNetworkDefParseFile(const char *filename,
|
||||
virNetworkXMLOption *xmlopt);
|
||||
|
||||
char *
|
||||
virNetworkDefFormat(const virNetworkDef *def,
|
||||
virNetworkXMLOption *xmlopt,
|
||||
|
@ -967,7 +967,7 @@ virNetworkLoadConfig(virNetworkObjList *nets,
|
||||
if ((autostart = virFileLinkPointsTo(autostartLink, configFile)) < 0)
|
||||
goto error;
|
||||
|
||||
if (!(def = virNetworkDefParseFile(configFile, xmlopt)))
|
||||
if (!(def = virNetworkDefParse(NULL, configFile, xmlopt, false)))
|
||||
goto error;
|
||||
|
||||
if (STRNEQ(name, def->name)) {
|
||||
|
@ -296,7 +296,7 @@ esxNetworkDefineXMLFlags(virConnectPtr conn, const char *xml,
|
||||
return NULL;
|
||||
|
||||
/* Parse network XML */
|
||||
def = virNetworkDefParseString(xml, NULL, !!(flags & VIR_NETWORK_DEFINE_VALIDATE));
|
||||
def = virNetworkDefParse(xml, NULL, NULL, !!(flags & VIR_NETWORK_DEFINE_VALIDATE));
|
||||
|
||||
if (!def)
|
||||
return NULL;
|
||||
|
@ -828,8 +828,7 @@ virNetworkDefForwardIf;
|
||||
virNetworkDefFree;
|
||||
virNetworkDefGetIPByIndex;
|
||||
virNetworkDefGetRouteByIndex;
|
||||
virNetworkDefParseFile;
|
||||
virNetworkDefParseString;
|
||||
virNetworkDefParse;
|
||||
virNetworkDefParseXML;
|
||||
virNetworkDefUpdateSection;
|
||||
virNetworkDHCPLeaseTimeUnitTypeFromString;
|
||||
|
@ -3017,7 +3017,7 @@ networkCreateXMLFlags(virConnectPtr conn,
|
||||
|
||||
virCheckFlags(VIR_NETWORK_CREATE_VALIDATE, NULL);
|
||||
|
||||
if (!(newDef = virNetworkDefParseString(xml, network_driver->xmlopt,
|
||||
if (!(newDef = virNetworkDefParse(xml, NULL, network_driver->xmlopt,
|
||||
!!(flags & VIR_NETWORK_CREATE_VALIDATE))))
|
||||
goto cleanup;
|
||||
|
||||
@ -3082,7 +3082,7 @@ networkDefineXMLFlags(virConnectPtr conn,
|
||||
|
||||
virCheckFlags(VIR_NETWORK_DEFINE_VALIDATE, NULL);
|
||||
|
||||
if (!(def = virNetworkDefParseString(xml, network_driver->xmlopt,
|
||||
if (!(def = virNetworkDefParse(xml, NULL, network_driver->xmlopt,
|
||||
!!(flags & VIR_NETWORK_DEFINE_VALIDATE))))
|
||||
goto cleanup;
|
||||
|
||||
|
@ -4852,7 +4852,7 @@ qemuProcessGetNetworkAddress(const char *netname,
|
||||
if (!xml)
|
||||
return -1;
|
||||
|
||||
netdef = virNetworkDefParseString(xml, NULL, false);
|
||||
netdef = virNetworkDefParse(xml, NULL, NULL, false);
|
||||
if (!netdef)
|
||||
return -1;
|
||||
|
||||
|
@ -5559,7 +5559,7 @@ testNetworkCreateXMLFlags(virConnectPtr conn, const char *xml,
|
||||
|
||||
virCheckFlags(VIR_NETWORK_CREATE_VALIDATE, NULL);
|
||||
|
||||
if (!(newDef = virNetworkDefParseString(xml, NULL,
|
||||
if (!(newDef = virNetworkDefParse(xml, NULL, NULL,
|
||||
!!(flags & VIR_NETWORK_CREATE_VALIDATE))))
|
||||
goto cleanup;
|
||||
|
||||
@ -5605,7 +5605,7 @@ testNetworkDefineXMLFlags(virConnectPtr conn,
|
||||
|
||||
virCheckFlags(VIR_NETWORK_DEFINE_VALIDATE, NULL);
|
||||
|
||||
if (!(newDef = virNetworkDefParseString(xml, NULL,
|
||||
if (!(newDef = virNetworkDefParse(xml, NULL, NULL,
|
||||
!!(flags & VIR_NETWORK_DEFINE_VALIDATE))))
|
||||
goto cleanup;
|
||||
|
||||
|
@ -402,7 +402,7 @@ vboxNetworkDefineCreateXML(virConnectPtr conn, const char *xml, bool start,
|
||||
|
||||
VBOX_IID_INITIALIZE(&vboxnetiid);
|
||||
|
||||
if (!(def = virNetworkDefParseString(xml, NULL, validate)) ||
|
||||
if (!(def = virNetworkDefParse(xml, NULL, NULL, validate)) ||
|
||||
(def->forward.type != VIR_NETWORK_FORWARD_NONE) ||
|
||||
(def->nips == 0 || !def->ips))
|
||||
goto cleanup;
|
||||
|
@ -31,7 +31,7 @@ testCompareXMLToConfFiles(const char *inxml, const char *outconf,
|
||||
if (!(xmlopt = networkDnsmasqCreateXMLConf()))
|
||||
goto fail;
|
||||
|
||||
if (!(def = virNetworkDefParseFile(inxml, xmlopt)))
|
||||
if (!(def = virNetworkDefParse(NULL, inxml, xmlopt, false)))
|
||||
goto fail;
|
||||
|
||||
if (!(obj = virNetworkObjNew()))
|
||||
|
@ -95,7 +95,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
||||
|
||||
virCommandSetDryRun(dryRunToken, &buf, true, true, testCommandDryRun, NULL);
|
||||
|
||||
if (!(def = virNetworkDefParseFile(xml, NULL)))
|
||||
if (!(def = virNetworkDefParse(NULL, xml, NULL, false)))
|
||||
return -1;
|
||||
|
||||
if (networkAddFirewallRules(def) < 0)
|
||||
|
@ -33,7 +33,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml,
|
||||
if (!(xmlopt = networkDnsmasqCreateXMLConf()))
|
||||
goto cleanup;
|
||||
|
||||
if (!(dev = virNetworkDefParseFile(inxml, xmlopt))) {
|
||||
if (!(dev = virNetworkDefParse(NULL, inxml, xmlopt, false))) {
|
||||
result = TEST_COMPARE_NET_XML2XML_RESULT_FAIL_PARSE;
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ testCompareXMLToXMLFiles(const char *netxml, const char *updatexml,
|
||||
if (virTestLoadFile(updatexml, &updateXmlData) < 0)
|
||||
return -1;
|
||||
|
||||
if (!(def = virNetworkDefParseFile(netxml, NULL)))
|
||||
if (!(def = virNetworkDefParse(NULL, netxml, NULL, false)))
|
||||
goto fail;
|
||||
|
||||
if (virNetworkDefUpdateSection(def, command, section, parentIndex,
|
||||
|
Loading…
Reference in New Issue
Block a user