I added new driver functions to handle creating network with given flags. I also replaced definitions of the functions without flags with function calls to the new ones. Signed-off-by: Kristina Hanicova <khanicov@xxxxxxxxxx> --- src/network/bridge_driver.c | 18 +++++++++++++++--- src/test/test_driver.c | 13 ++++++++++++- src/vbox/vbox_network.c | 7 +++++++ 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index e8b9ffa1fc..32b37de030 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -3464,8 +3464,9 @@ networkValidate(virNetworkDriverState *driver, static virNetworkPtr -networkCreateXML(virConnectPtr conn, - const char *xml) +networkCreateXMLFlags(virConnectPtr conn, + const char *xml, + unsigned int flags) { virNetworkDriverState *driver = networkGetDriver(); virNetworkDef *newDef; @@ -3474,10 +3475,12 @@ networkCreateXML(virConnectPtr conn, virNetworkPtr net = NULL; virObjectEvent *event = NULL; + virCheckFlags(0, NULL); + if (!(newDef = virNetworkDefParseString(xml, network_driver->xmlopt, 0))) goto cleanup; - if (virNetworkCreateXMLEnsureACL(conn, newDef) < 0) + if (virNetworkCreateXMLFlagsEnsureACL(conn, newDef) < 0) goto cleanup; if (networkValidate(driver, newDef) < 0) @@ -3515,6 +3518,14 @@ networkCreateXML(virConnectPtr conn, } +static virNetworkPtr +networkCreateXML(virConnectPtr conn, + const char *xml) +{ + return networkCreateXMLFlags(conn, xml, 0); +} + + static virNetworkPtr networkDefineXMLFlags(virConnectPtr conn, const char *xml, @@ -5628,6 +5639,7 @@ static virNetworkDriver networkDriver = { .networkLookupByUUID = networkLookupByUUID, /* 0.2.0 */ .networkLookupByName = networkLookupByName, /* 0.2.0 */ .networkCreateXML = networkCreateXML, /* 0.2.0 */ + .networkCreateXMLFlags = networkCreateXMLFlags, /* 7.8.0 */ .networkDefineXML = networkDefineXML, /* 0.2.0 */ .networkDefineXMLFlags = networkDefineXMLFlags, /* 7.7.0 */ .networkUndefine = networkUndefine, /* 0.2.0 */ diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 2f19b7c520..4ab03019e1 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -5572,7 +5572,8 @@ testNetworkIsPersistent(virNetworkPtr net) static virNetworkPtr -testNetworkCreateXML(virConnectPtr conn, const char *xml) +testNetworkCreateXMLFlags(virConnectPtr conn, const char *xml, + unsigned int flags) { testDriver *privconn = conn->privateData; virNetworkDef *newDef; @@ -5581,6 +5582,8 @@ testNetworkCreateXML(virConnectPtr conn, const char *xml) virNetworkPtr net = NULL; virObjectEvent *event = NULL; + virCheckFlags(0, NULL); + if ((newDef = virNetworkDefParseString(xml, NULL, 0)) == NULL) goto cleanup; @@ -5606,6 +5609,13 @@ testNetworkCreateXML(virConnectPtr conn, const char *xml) } +static virNetworkPtr +testNetworkCreateXML(virConnectPtr conn, const char *xml) +{ + return testNetworkCreateXMLFlags(conn, xml, 0); +} + + static virNetworkPtr testNetworkDefineXMLFlags(virConnectPtr conn, const char *xml, @@ -9722,6 +9732,7 @@ static virNetworkDriver testNetworkDriver = { .networkLookupByUUID = testNetworkLookupByUUID, /* 0.3.2 */ .networkLookupByName = testNetworkLookupByName, /* 0.3.2 */ .networkCreateXML = testNetworkCreateXML, /* 0.3.2 */ + .networkCreateXMLFlags = testNetworkCreateXMLFlags, /* 7.8.0 */ .networkDefineXML = testNetworkDefineXML, /* 0.3.2 */ .networkDefineXMLFlags = testNetworkDefineXMLFlags, /* 7.7.0 */ .networkUndefine = testNetworkUndefine, /* 0.3.2 */ diff --git a/src/vbox/vbox_network.c b/src/vbox/vbox_network.c index c554b052c9..2826937f81 100644 --- a/src/vbox/vbox_network.c +++ b/src/vbox/vbox_network.c @@ -560,6 +560,12 @@ static virNetworkPtr vboxNetworkCreateXML(virConnectPtr conn, const char *xml) return vboxNetworkDefineCreateXML(conn, xml, true, 0); } +static virNetworkPtr vboxNetworkCreateXMLFlags(virConnectPtr conn, const char *xml, + unsigned int flags) +{ + return vboxNetworkDefineCreateXML(conn, xml, true, flags); +} + static virNetworkPtr vboxNetworkDefineXML(virConnectPtr conn, const char *xml) { return vboxNetworkDefineCreateXML(conn, xml, false, 0); @@ -929,6 +935,7 @@ virNetworkDriver vboxNetworkDriver = { .networkLookupByUUID = vboxNetworkLookupByUUID, /* 0.6.4 */ .networkLookupByName = vboxNetworkLookupByName, /* 0.6.4 */ .networkCreateXML = vboxNetworkCreateXML, /* 0.6.4 */ + .networkCreateXMLFlags = vboxNetworkCreateXMLFlags, /* 7.8.0 */ .networkDefineXML = vboxNetworkDefineXML, /* 0.6.4 */ .networkDefineXMLFlags = vboxNetworkDefineXMLFlags, /* 7.7.0 */ .networkUndefine = vboxNetworkUndefine, /* 0.6.4 */ -- 2.31.1