Signed-off-by: Kristina Hanicova <khanicov@xxxxxxxxxx> --- src/network/bridge_driver.c | 5 +++-- src/test/test_driver.c | 5 +++-- src/vbox/vbox_network.c | 6 +++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index dbb8846e05..7027dc636c 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -3475,9 +3475,10 @@ networkCreateXMLFlags(virConnectPtr conn, virNetworkPtr net = NULL; virObjectEvent *event = NULL; - virCheckFlags(0, NULL); + virCheckFlags(VIR_NETWORK_CREATE_VALIDATE, NULL); - if (!(newDef = virNetworkDefParseString(xml, network_driver->xmlopt, false))) + if (!(newDef = virNetworkDefParseString(xml, network_driver->xmlopt, + !!(flags & VIR_NETWORK_CREATE_VALIDATE)))) goto cleanup; if (virNetworkCreateXMLFlagsEnsureACL(conn, newDef) < 0) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 26ff2cc759..4f3fd0197e 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -5582,9 +5582,10 @@ testNetworkCreateXMLFlags(virConnectPtr conn, const char *xml, virNetworkPtr net = NULL; virObjectEvent *event = NULL; - virCheckFlags(0, NULL); + virCheckFlags(VIR_NETWORK_CREATE_VALIDATE, NULL); - if ((newDef = virNetworkDefParseString(xml, NULL, false)) == NULL) + if (!(newDef = virNetworkDefParseString(xml, NULL, + !!(flags & VIR_NETWORK_CREATE_VALIDATE)))) goto cleanup; if (!(obj = virNetworkObjAssignDef(privconn->networks, newDef, diff --git a/src/vbox/vbox_network.c b/src/vbox/vbox_network.c index 1c23b880e8..343b8d35ad 100644 --- a/src/vbox/vbox_network.c +++ b/src/vbox/vbox_network.c @@ -386,7 +386,8 @@ vboxNetworkDefineCreateXML(virConnectPtr conn, const char *xml, bool start, virNetworkPtr ret = NULL; nsresult rc; - virCheckFlags(VIR_NETWORK_DEFINE_VALIDATE, NULL); + virCheckFlags(VIR_NETWORK_DEFINE_VALIDATE | + VIR_NETWORK_CREATE_VALIDATE, NULL); if (!data->vboxObj) return ret; @@ -397,6 +398,9 @@ vboxNetworkDefineCreateXML(virConnectPtr conn, const char *xml, bool start, VBOX_IID_INITIALIZE(&vboxnetiid); + /* Here we rely on the fact that VIR_NETWORK_DEFINE_VALIDATE and + * VIR_NETWORK_CREATE_VALIDATE always have the same value. + */ if (!(def = virNetworkDefParseString(xml, NULL, !!(flags & VIR_NETWORK_DEFINE_VALIDATE))) || (def->forward.type != VIR_NETWORK_FORWARD_NONE) || -- 2.31.1