mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
src: network_conf: propagate only bool to virNetworkDefParseString()
We don't need to propagate all public flags, only the information about the presence of the validation one, which can differ from function to function. This patch makes it easier and more readable in case of a future additions of validation flags. This change was suggested by Daniel. Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
7e23272e35
commit
3e4f4c2eec
@ -30523,7 +30523,7 @@ virDomainNetResolveActualType(virDomainNetDef *iface)
|
||||
if (!(xml = virNetworkGetXMLDesc(net, 0)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(def = virNetworkDefParseString(xml, NULL, 0)))
|
||||
if (!(def = virNetworkDefParseString(xml, NULL, false)))
|
||||
goto cleanup;
|
||||
|
||||
switch ((virNetworkForwardType) def->forward.type) {
|
||||
|
@ -318,7 +318,7 @@ virNetworkDefCopy(virNetworkDef *def,
|
||||
if (!(xml = virNetworkDefFormat(def, xmlopt, flags)))
|
||||
return NULL;
|
||||
|
||||
return virNetworkDefParseString(xml, xmlopt, 0);
|
||||
return virNetworkDefParseString(xml, xmlopt, false);
|
||||
}
|
||||
|
||||
|
||||
@ -2086,14 +2086,14 @@ static virNetworkDef *
|
||||
virNetworkDefParse(const char *xmlStr,
|
||||
const char *filename,
|
||||
virNetworkXMLOption *xmlopt,
|
||||
unsigned int flags)
|
||||
bool validate)
|
||||
{
|
||||
g_autoptr(xmlDoc) xml = NULL;
|
||||
virNetworkDef *def = NULL;
|
||||
int keepBlanksDefault = xmlKeepBlanksDefault(0);
|
||||
|
||||
if ((xml = virXMLParse(filename, xmlStr, _("(network_definition)"),
|
||||
"network.rng", flags & VIR_NETWORK_DEFINE_VALIDATE)))
|
||||
"network.rng", validate)))
|
||||
def = virNetworkDefParseNode(xml, xmlDocGetRootElement(xml), xmlopt);
|
||||
|
||||
xmlKeepBlanksDefault(keepBlanksDefault);
|
||||
@ -2104,9 +2104,9 @@ virNetworkDefParse(const char *xmlStr,
|
||||
virNetworkDef *
|
||||
virNetworkDefParseString(const char *xmlStr,
|
||||
virNetworkXMLOption *xmlopt,
|
||||
unsigned int flags)
|
||||
bool validate)
|
||||
{
|
||||
return virNetworkDefParse(xmlStr, NULL, xmlopt, flags);
|
||||
return virNetworkDefParse(xmlStr, NULL, xmlopt, validate);
|
||||
}
|
||||
|
||||
|
||||
@ -2114,7 +2114,7 @@ virNetworkDef *
|
||||
virNetworkDefParseFile(const char *filename,
|
||||
virNetworkXMLOption *xmlopt)
|
||||
{
|
||||
return virNetworkDefParse(NULL, filename, xmlopt, 0);
|
||||
return virNetworkDefParse(NULL, filename, xmlopt, false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -329,7 +329,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt,
|
||||
virNetworkDef *
|
||||
virNetworkDefParseString(const char *xmlStr,
|
||||
virNetworkXMLOption *xmlopt,
|
||||
unsigned int flags);
|
||||
bool validate);
|
||||
|
||||
virNetworkDef *
|
||||
virNetworkDefParseFile(const char *filename,
|
||||
|
@ -298,7 +298,7 @@ esxNetworkDefineXMLFlags(virConnectPtr conn, const char *xml,
|
||||
return NULL;
|
||||
|
||||
/* Parse network XML */
|
||||
def = virNetworkDefParseString(xml, NULL, flags);
|
||||
def = virNetworkDefParseString(xml, NULL, !!(flags & VIR_NETWORK_DEFINE_VALIDATE));
|
||||
|
||||
if (!def)
|
||||
return NULL;
|
||||
|
@ -3474,7 +3474,7 @@ networkCreateXML(virConnectPtr conn,
|
||||
virNetworkPtr net = NULL;
|
||||
virObjectEvent *event = NULL;
|
||||
|
||||
if (!(newDef = virNetworkDefParseString(xml, network_driver->xmlopt, 0)))
|
||||
if (!(newDef = virNetworkDefParseString(xml, network_driver->xmlopt, false)))
|
||||
goto cleanup;
|
||||
|
||||
if (virNetworkCreateXMLEnsureACL(conn, newDef) < 0)
|
||||
@ -3529,7 +3529,8 @@ networkDefineXMLFlags(virConnectPtr conn,
|
||||
|
||||
virCheckFlags(VIR_NETWORK_DEFINE_VALIDATE, NULL);
|
||||
|
||||
if (!(def = virNetworkDefParseString(xml, network_driver->xmlopt, flags)))
|
||||
if (!(def = virNetworkDefParseString(xml, network_driver->xmlopt,
|
||||
!!(flags & VIR_NETWORK_DEFINE_VALIDATE))))
|
||||
goto cleanup;
|
||||
|
||||
if (virNetworkDefineXMLFlagsEnsureACL(conn, def) < 0)
|
||||
|
@ -4778,7 +4778,7 @@ qemuProcessGetNetworkAddress(const char *netname,
|
||||
if (!xml)
|
||||
goto cleanup;
|
||||
|
||||
netdef = virNetworkDefParseString(xml, NULL, 0);
|
||||
netdef = virNetworkDefParseString(xml, NULL, false);
|
||||
if (!netdef)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -5581,7 +5581,7 @@ testNetworkCreateXML(virConnectPtr conn, const char *xml)
|
||||
virNetworkPtr net = NULL;
|
||||
virObjectEvent *event = NULL;
|
||||
|
||||
if ((newDef = virNetworkDefParseString(xml, NULL, 0)) == NULL)
|
||||
if ((newDef = virNetworkDefParseString(xml, NULL, false)) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
if (!(obj = virNetworkObjAssignDef(privconn->networks, newDef,
|
||||
@ -5620,7 +5620,8 @@ testNetworkDefineXMLFlags(virConnectPtr conn,
|
||||
|
||||
virCheckFlags(VIR_NETWORK_DEFINE_VALIDATE, NULL);
|
||||
|
||||
if ((newDef = virNetworkDefParseString(xml, NULL, flags)) == NULL)
|
||||
if (!(newDef = virNetworkDefParseString(xml, NULL,
|
||||
!!(flags & VIR_NETWORK_DEFINE_VALIDATE))))
|
||||
goto cleanup;
|
||||
|
||||
if (!(obj = virNetworkObjAssignDef(privconn->networks, newDef, 0)))
|
||||
|
@ -397,7 +397,8 @@ vboxNetworkDefineCreateXML(virConnectPtr conn, const char *xml, bool start,
|
||||
|
||||
VBOX_IID_INITIALIZE(&vboxnetiid);
|
||||
|
||||
if (!(def = virNetworkDefParseString(xml, NULL, flags)) ||
|
||||
if (!(def = virNetworkDefParseString(xml, NULL,
|
||||
!!(flags & VIR_NETWORK_DEFINE_VALIDATE))) ||
|
||||
(def->forward.type != VIR_NETWORK_FORWARD_NONE) ||
|
||||
(def->nips == 0 || !def->ips))
|
||||
goto cleanup;
|
||||
|
Loading…
x
Reference in New Issue
Block a user