mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 19:11:16 +00:00
nwfilter: add nwfilterDefineXMLFlags()
I have added a new driver function which allows to define nwfilter with given flags. I have also replaced definition of nwfilterDefineXML() with function call to the new function. 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
c839014dd2
commit
fa53b26026
@ -525,15 +525,19 @@ nwfilterConnectListAllNWFilters(virConnectPtr conn,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static virNWFilterPtr
|
static virNWFilterPtr
|
||||||
nwfilterDefineXML(virConnectPtr conn,
|
nwfilterDefineXMLFlags(virConnectPtr conn,
|
||||||
const char *xml)
|
const char *xml,
|
||||||
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virNWFilterDef *def;
|
virNWFilterDef *def;
|
||||||
virNWFilterObj *obj = NULL;
|
virNWFilterObj *obj = NULL;
|
||||||
virNWFilterDef *objdef;
|
virNWFilterDef *objdef;
|
||||||
virNWFilterPtr nwfilter = NULL;
|
virNWFilterPtr nwfilter = NULL;
|
||||||
|
|
||||||
|
virCheckFlags(0, NULL);
|
||||||
|
|
||||||
if (!driver->privileged) {
|
if (!driver->privileged) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||||
_("Can't define NWFilters in session mode"));
|
_("Can't define NWFilters in session mode"));
|
||||||
@ -546,7 +550,7 @@ nwfilterDefineXML(virConnectPtr conn,
|
|||||||
if (!(def = virNWFilterDefParseString(xml)))
|
if (!(def = virNWFilterDefParseString(xml)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virNWFilterDefineXMLEnsureACL(conn, def) < 0)
|
if (virNWFilterDefineXMLFlagsEnsureACL(conn, def) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(obj = virNWFilterObjListAssignDef(driver->nwfilters, def)))
|
if (!(obj = virNWFilterObjListAssignDef(driver->nwfilters, def)))
|
||||||
@ -572,6 +576,14 @@ nwfilterDefineXML(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static virNWFilterPtr
|
||||||
|
nwfilterDefineXML(virConnectPtr conn,
|
||||||
|
const char *xml)
|
||||||
|
{
|
||||||
|
return nwfilterDefineXMLFlags(conn, xml, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nwfilterUndefine(virNWFilterPtr nwfilter)
|
nwfilterUndefine(virNWFilterPtr nwfilter)
|
||||||
{
|
{
|
||||||
@ -809,6 +821,7 @@ static virNWFilterDriver nwfilterDriver = {
|
|||||||
.nwfilterLookupByName = nwfilterLookupByName, /* 0.8.0 */
|
.nwfilterLookupByName = nwfilterLookupByName, /* 0.8.0 */
|
||||||
.nwfilterLookupByUUID = nwfilterLookupByUUID, /* 0.8.0 */
|
.nwfilterLookupByUUID = nwfilterLookupByUUID, /* 0.8.0 */
|
||||||
.nwfilterDefineXML = nwfilterDefineXML, /* 0.8.0 */
|
.nwfilterDefineXML = nwfilterDefineXML, /* 0.8.0 */
|
||||||
|
.nwfilterDefineXMLFlags = nwfilterDefineXMLFlags, /* 7.7.0 */
|
||||||
.nwfilterUndefine = nwfilterUndefine, /* 0.8.0 */
|
.nwfilterUndefine = nwfilterUndefine, /* 0.8.0 */
|
||||||
.nwfilterGetXMLDesc = nwfilterGetXMLDesc, /* 0.8.0 */
|
.nwfilterGetXMLDesc = nwfilterGetXMLDesc, /* 0.8.0 */
|
||||||
.nwfilterBindingLookupByPortDev = nwfilterBindingLookupByPortDev, /* 4.5.0 */
|
.nwfilterBindingLookupByPortDev = nwfilterBindingLookupByPortDev, /* 4.5.0 */
|
||||||
|
Loading…
Reference in New Issue
Block a user