mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
src: add driver support for networkCreateXMLFlags()
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@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
6a0a2840cf
commit
00182251d0
@ -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, false)))
|
||||
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,
|
||||
@ -5630,6 +5641,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 */
|
||||
|
@ -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, false)) == 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,
|
||||
@ -9723,6 +9733,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 */
|
||||
|
@ -561,6 +561,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);
|
||||
@ -930,6 +936,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 */
|
||||
|
Loading…
Reference in New Issue
Block a user