mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +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)))
|
if (!(xml = virNetworkGetXMLDesc(net, 0)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!(def = virNetworkDefParseString(xml, NULL, false)))
|
if (!(def = virNetworkDefParse(xml, NULL, NULL, false)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
switch ((virNetworkForwardType) def->forward.type) {
|
switch ((virNetworkForwardType) def->forward.type) {
|
||||||
|
@ -315,7 +315,7 @@ virNetworkDefCopy(virNetworkDef *def,
|
|||||||
if (!(xml = virNetworkDefFormat(def, xmlopt, flags)))
|
if (!(xml = virNetworkDefFormat(def, xmlopt, flags)))
|
||||||
return NULL;
|
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,
|
virNetworkDefParse(const char *xmlStr,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
virNetworkXMLOption *xmlopt,
|
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
|
static int
|
||||||
virNetworkDNSDefFormat(virBuffer *buf,
|
virNetworkDNSDefFormat(virBuffer *buf,
|
||||||
const virNetworkDNSDef *def)
|
const virNetworkDNSDef *def)
|
||||||
|
@ -325,14 +325,11 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt,
|
|||||||
virNetworkXMLOption *xmlopt);
|
virNetworkXMLOption *xmlopt);
|
||||||
|
|
||||||
virNetworkDef *
|
virNetworkDef *
|
||||||
virNetworkDefParseString(const char *xmlStr,
|
virNetworkDefParse(const char *xmlStr,
|
||||||
|
const char *filename,
|
||||||
virNetworkXMLOption *xmlopt,
|
virNetworkXMLOption *xmlopt,
|
||||||
bool validate);
|
bool validate);
|
||||||
|
|
||||||
virNetworkDef *
|
|
||||||
virNetworkDefParseFile(const char *filename,
|
|
||||||
virNetworkXMLOption *xmlopt);
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
virNetworkDefFormat(const virNetworkDef *def,
|
virNetworkDefFormat(const virNetworkDef *def,
|
||||||
virNetworkXMLOption *xmlopt,
|
virNetworkXMLOption *xmlopt,
|
||||||
|
@ -967,7 +967,7 @@ virNetworkLoadConfig(virNetworkObjList *nets,
|
|||||||
if ((autostart = virFileLinkPointsTo(autostartLink, configFile)) < 0)
|
if ((autostart = virFileLinkPointsTo(autostartLink, configFile)) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (!(def = virNetworkDefParseFile(configFile, xmlopt)))
|
if (!(def = virNetworkDefParse(NULL, configFile, xmlopt, false)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (STRNEQ(name, def->name)) {
|
if (STRNEQ(name, def->name)) {
|
||||||
|
@ -296,7 +296,7 @@ esxNetworkDefineXMLFlags(virConnectPtr conn, const char *xml,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Parse network XML */
|
/* Parse network XML */
|
||||||
def = virNetworkDefParseString(xml, NULL, !!(flags & VIR_NETWORK_DEFINE_VALIDATE));
|
def = virNetworkDefParse(xml, NULL, NULL, !!(flags & VIR_NETWORK_DEFINE_VALIDATE));
|
||||||
|
|
||||||
if (!def)
|
if (!def)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -828,8 +828,7 @@ virNetworkDefForwardIf;
|
|||||||
virNetworkDefFree;
|
virNetworkDefFree;
|
||||||
virNetworkDefGetIPByIndex;
|
virNetworkDefGetIPByIndex;
|
||||||
virNetworkDefGetRouteByIndex;
|
virNetworkDefGetRouteByIndex;
|
||||||
virNetworkDefParseFile;
|
virNetworkDefParse;
|
||||||
virNetworkDefParseString;
|
|
||||||
virNetworkDefParseXML;
|
virNetworkDefParseXML;
|
||||||
virNetworkDefUpdateSection;
|
virNetworkDefUpdateSection;
|
||||||
virNetworkDHCPLeaseTimeUnitTypeFromString;
|
virNetworkDHCPLeaseTimeUnitTypeFromString;
|
||||||
|
@ -3017,7 +3017,7 @@ networkCreateXMLFlags(virConnectPtr conn,
|
|||||||
|
|
||||||
virCheckFlags(VIR_NETWORK_CREATE_VALIDATE, NULL);
|
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))))
|
!!(flags & VIR_NETWORK_CREATE_VALIDATE))))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -3082,7 +3082,7 @@ networkDefineXMLFlags(virConnectPtr conn,
|
|||||||
|
|
||||||
virCheckFlags(VIR_NETWORK_DEFINE_VALIDATE, NULL);
|
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))))
|
!!(flags & VIR_NETWORK_DEFINE_VALIDATE))))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
@ -4852,7 +4852,7 @@ qemuProcessGetNetworkAddress(const char *netname,
|
|||||||
if (!xml)
|
if (!xml)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
netdef = virNetworkDefParseString(xml, NULL, false);
|
netdef = virNetworkDefParse(xml, NULL, NULL, false);
|
||||||
if (!netdef)
|
if (!netdef)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -5559,7 +5559,7 @@ testNetworkCreateXMLFlags(virConnectPtr conn, const char *xml,
|
|||||||
|
|
||||||
virCheckFlags(VIR_NETWORK_CREATE_VALIDATE, NULL);
|
virCheckFlags(VIR_NETWORK_CREATE_VALIDATE, NULL);
|
||||||
|
|
||||||
if (!(newDef = virNetworkDefParseString(xml, NULL,
|
if (!(newDef = virNetworkDefParse(xml, NULL, NULL,
|
||||||
!!(flags & VIR_NETWORK_CREATE_VALIDATE))))
|
!!(flags & VIR_NETWORK_CREATE_VALIDATE))))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -5605,7 +5605,7 @@ testNetworkDefineXMLFlags(virConnectPtr conn,
|
|||||||
|
|
||||||
virCheckFlags(VIR_NETWORK_DEFINE_VALIDATE, NULL);
|
virCheckFlags(VIR_NETWORK_DEFINE_VALIDATE, NULL);
|
||||||
|
|
||||||
if (!(newDef = virNetworkDefParseString(xml, NULL,
|
if (!(newDef = virNetworkDefParse(xml, NULL, NULL,
|
||||||
!!(flags & VIR_NETWORK_DEFINE_VALIDATE))))
|
!!(flags & VIR_NETWORK_DEFINE_VALIDATE))))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ vboxNetworkDefineCreateXML(virConnectPtr conn, const char *xml, bool start,
|
|||||||
|
|
||||||
VBOX_IID_INITIALIZE(&vboxnetiid);
|
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->forward.type != VIR_NETWORK_FORWARD_NONE) ||
|
||||||
(def->nips == 0 || !def->ips))
|
(def->nips == 0 || !def->ips))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -31,7 +31,7 @@ testCompareXMLToConfFiles(const char *inxml, const char *outconf,
|
|||||||
if (!(xmlopt = networkDnsmasqCreateXMLConf()))
|
if (!(xmlopt = networkDnsmasqCreateXMLConf()))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (!(def = virNetworkDefParseFile(inxml, xmlopt)))
|
if (!(def = virNetworkDefParse(NULL, inxml, xmlopt, false)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (!(obj = virNetworkObjNew()))
|
if (!(obj = virNetworkObjNew()))
|
||||||
|
@ -95,7 +95,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
|||||||
|
|
||||||
virCommandSetDryRun(dryRunToken, &buf, true, true, testCommandDryRun, NULL);
|
virCommandSetDryRun(dryRunToken, &buf, true, true, testCommandDryRun, NULL);
|
||||||
|
|
||||||
if (!(def = virNetworkDefParseFile(xml, NULL)))
|
if (!(def = virNetworkDefParse(NULL, xml, NULL, false)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (networkAddFirewallRules(def) < 0)
|
if (networkAddFirewallRules(def) < 0)
|
||||||
|
@ -33,7 +33,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml,
|
|||||||
if (!(xmlopt = networkDnsmasqCreateXMLConf()))
|
if (!(xmlopt = networkDnsmasqCreateXMLConf()))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(dev = virNetworkDefParseFile(inxml, xmlopt))) {
|
if (!(dev = virNetworkDefParse(NULL, inxml, xmlopt, false))) {
|
||||||
result = TEST_COMPARE_NET_XML2XML_RESULT_FAIL_PARSE;
|
result = TEST_COMPARE_NET_XML2XML_RESULT_FAIL_PARSE;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ testCompareXMLToXMLFiles(const char *netxml, const char *updatexml,
|
|||||||
if (virTestLoadFile(updatexml, &updateXmlData) < 0)
|
if (virTestLoadFile(updatexml, &updateXmlData) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!(def = virNetworkDefParseFile(netxml, NULL)))
|
if (!(def = virNetworkDefParse(NULL, netxml, NULL, false)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (virNetworkDefUpdateSection(def, command, section, parentIndex,
|
if (virNetworkDefUpdateSection(def, command, section, parentIndex,
|
||||||
|
Loading…
Reference in New Issue
Block a user