mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
api: add public virNWFilterDefineXMLFlags() and remote protocol
This new API function allows to define nwfilter with given flags. 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
0447e6243b
commit
c839014dd2
@ -85,6 +85,9 @@ virNWFilterPtr virNWFilterLookupByUUIDString (virConnectPtr conn,
|
||||
*/
|
||||
virNWFilterPtr virNWFilterDefineXML (virConnectPtr conn,
|
||||
const char *xmlDesc);
|
||||
virNWFilterPtr virNWFilterDefineXMLFlags(virConnectPtr conn,
|
||||
const char *xmlDesc,
|
||||
unsigned int flags);
|
||||
|
||||
/*
|
||||
* Delete persistent nwfilter
|
||||
|
@ -49,6 +49,11 @@ typedef virNWFilterPtr
|
||||
(*virDrvNWFilterDefineXML)(virConnectPtr conn,
|
||||
const char *xmlDesc);
|
||||
|
||||
typedef virNWFilterPtr
|
||||
(*virDrvNWFilterDefineXMLFlags)(virConnectPtr conn,
|
||||
const char *xmlDesc,
|
||||
unsigned int flags);
|
||||
|
||||
typedef int
|
||||
(*virDrvNWFilterUndefine)(virNWFilterPtr nwfilter);
|
||||
|
||||
@ -98,6 +103,7 @@ struct _virNWFilterDriver {
|
||||
virDrvNWFilterLookupByName nwfilterLookupByName;
|
||||
virDrvNWFilterLookupByUUID nwfilterLookupByUUID;
|
||||
virDrvNWFilterDefineXML nwfilterDefineXML;
|
||||
virDrvNWFilterDefineXMLFlags nwfilterDefineXMLFlags;
|
||||
virDrvNWFilterUndefine nwfilterUndefine;
|
||||
virDrvNWFilterGetXMLDesc nwfilterGetXMLDesc;
|
||||
virDrvConnectListAllNWFilterBindings connectListAllNWFilterBindings;
|
||||
|
@ -406,6 +406,47 @@ virNWFilterDefineXML(virConnectPtr conn, const char *xmlDesc)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virNWFilterDefineXMLFlags:
|
||||
* @conn: pointer to the hypervisor connection
|
||||
* @xmlDesc: an XML description of the nwfilter
|
||||
* @flags: extra flags; not used yet, so callers should always pass 0
|
||||
*
|
||||
* Define a new network filter, based on an XML description
|
||||
* similar to the one returned by virNWFilterGetXMLDesc()
|
||||
*
|
||||
* virNWFilterFree should be used to free the resources after the
|
||||
* nwfilter object is no longer needed.
|
||||
*
|
||||
* Returns a new nwfilter object or NULL in case of failure
|
||||
*/
|
||||
virNWFilterPtr
|
||||
virNWFilterDefineXMLFlags(virConnectPtr conn, const char *xmlDesc, unsigned int flags)
|
||||
{
|
||||
VIR_DEBUG("conn=%p, xmlDesc=%s flags=0x%x", conn, NULLSTR(xmlDesc), flags);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
virCheckConnectReturn(conn, NULL);
|
||||
virCheckNonNullArgGoto(xmlDesc, error);
|
||||
virCheckReadOnlyGoto(conn->flags, error);
|
||||
|
||||
if (conn->nwfilterDriver && conn->nwfilterDriver->nwfilterDefineXMLFlags) {
|
||||
virNWFilterPtr ret;
|
||||
ret = conn->nwfilterDriver->nwfilterDefineXMLFlags(conn, xmlDesc, flags);
|
||||
if (!ret)
|
||||
goto error;
|
||||
return ret;
|
||||
}
|
||||
|
||||
virReportUnsupportedError();
|
||||
|
||||
error:
|
||||
virDispatchError(conn);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virNWFilterUndefine:
|
||||
* @nwfilter: a nwfilter object
|
||||
|
@ -896,4 +896,9 @@ LIBVIRT_7.3.0 {
|
||||
virNodeDeviceCreate;
|
||||
} LIBVIRT_7.2.0;
|
||||
|
||||
LIBVIRT_7.7.0 {
|
||||
global:
|
||||
virNWFilterDefineXMLFlags;
|
||||
} LIBVIRT_7.3.0;
|
||||
|
||||
# .... define new API here using predicted next version number ....
|
||||
|
@ -8680,6 +8680,7 @@ static virNWFilterDriver nwfilter_driver = {
|
||||
.nwfilterLookupByName = remoteNWFilterLookupByName, /* 0.8.0 */
|
||||
.nwfilterGetXMLDesc = remoteNWFilterGetXMLDesc, /* 0.8.0 */
|
||||
.nwfilterDefineXML = remoteNWFilterDefineXML, /* 0.8.0 */
|
||||
.nwfilterDefineXMLFlags = remoteNWFilterDefineXMLFlags, /* 7.7.0 */
|
||||
.nwfilterUndefine = remoteNWFilterUndefine, /* 0.8.0 */
|
||||
.connectNumOfNWFilters = remoteConnectNumOfNWFilters, /* 0.8.0 */
|
||||
.connectListNWFilters = remoteConnectListNWFilters, /* 0.8.0 */
|
||||
|
@ -1627,6 +1627,15 @@ struct remote_nwfilter_define_xml_ret {
|
||||
remote_nonnull_nwfilter nwfilter;
|
||||
};
|
||||
|
||||
struct remote_nwfilter_define_xml_flags_args {
|
||||
remote_nonnull_string xml;
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
struct remote_nwfilter_define_xml_flags_ret {
|
||||
remote_nonnull_nwfilter nwfilter;
|
||||
};
|
||||
|
||||
struct remote_nwfilter_undefine_args {
|
||||
remote_nonnull_nwfilter nwfilter;
|
||||
};
|
||||
@ -6784,6 +6793,13 @@ enum remote_procedure {
|
||||
* @priority: high
|
||||
* @acl: node_device:start
|
||||
*/
|
||||
REMOTE_PROC_NODE_DEVICE_CREATE = 430
|
||||
REMOTE_PROC_NODE_DEVICE_CREATE = 430,
|
||||
|
||||
/**
|
||||
* @generate: both
|
||||
* @priority: high
|
||||
* @acl: nwfilter:write
|
||||
* @acl: nwfilter:save
|
||||
*/
|
||||
REMOTE_PROC_NWFILTER_DEFINE_XML_FLAGS = 431
|
||||
};
|
||||
|
@ -1174,6 +1174,13 @@ struct remote_nwfilter_define_xml_args {
|
||||
struct remote_nwfilter_define_xml_ret {
|
||||
remote_nonnull_nwfilter nwfilter;
|
||||
};
|
||||
struct remote_nwfilter_define_xml_flags_args {
|
||||
remote_nonnull_string xml;
|
||||
u_int flags;
|
||||
};
|
||||
struct remote_nwfilter_define_xml_flags_ret {
|
||||
remote_nonnull_nwfilter nwfilter;
|
||||
};
|
||||
struct remote_nwfilter_undefine_args {
|
||||
remote_nonnull_nwfilter nwfilter;
|
||||
};
|
||||
@ -3623,4 +3630,5 @@ enum remote_procedure {
|
||||
REMOTE_PROC_NODE_DEVICE_DEFINE_XML = 428,
|
||||
REMOTE_PROC_NODE_DEVICE_UNDEFINE = 429,
|
||||
REMOTE_PROC_NODE_DEVICE_CREATE = 430,
|
||||
REMOTE_PROC_NWFILTER_DEFINE_XML_FLAGS = 431,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user