admin: Introduce virAdmConnectSetLoggingFilters

Enable libvirt users to modify logging filters of a daemon from outside.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Erik Skultety
2016-12-15 10:36:23 +01:00
parent ceeb85bd00
commit 1a38fbaa86
7 changed files with 70 additions and 1 deletions
+11 -1
View File
@@ -206,6 +206,11 @@ struct admin_connect_set_logging_outputs_args {
unsigned int flags;
};
struct admin_connect_set_logging_filters_args {
admin_string filters;
unsigned int flags;
};
/* Define the program number, protocol version and procedure numbers here. */
const ADMIN_PROGRAM = 0x06900690;
const ADMIN_PROTOCOL_VERSION = 1;
@@ -306,5 +311,10 @@ enum admin_procedure {
/**
* @generate: both
*/
ADMIN_PROC_CONNECT_SET_LOGGING_OUTPUTS = 16
ADMIN_PROC_CONNECT_SET_LOGGING_OUTPUTS = 16,
/**
* @generate: both
*/
ADMIN_PROC_CONNECT_SET_LOGGING_FILTERS = 17
};
+5
View File
@@ -145,6 +145,10 @@ struct admin_connect_set_logging_outputs_args {
admin_string outputs;
u_int flags;
};
struct admin_connect_set_logging_filters_args {
admin_string filters;
u_int flags;
};
enum admin_procedure {
ADMIN_PROC_CONNECT_OPEN = 1,
ADMIN_PROC_CONNECT_CLOSE = 2,
@@ -162,4 +166,5 @@ enum admin_procedure {
ADMIN_PROC_CONNECT_GET_LOGGING_OUTPUTS = 14,
ADMIN_PROC_CONNECT_GET_LOGGING_FILTERS = 15,
ADMIN_PROC_CONNECT_SET_LOGGING_OUTPUTS = 16,
ADMIN_PROC_CONNECT_SET_LOGGING_FILTERS = 17,
};
+38
View File
@@ -1203,3 +1203,41 @@ virAdmConnectSetLoggingOutputs(virAdmConnectPtr conn,
virDispatchError(NULL);
return -1;
}
/**
* virAdmConnectSetLoggingFilters:
* @conn: pointer to an active admin connection
* @filters: pointer to a string containing a list of filters to be defined
* @flags: extra flags; not used yet, so callers should always pass 0
*
* Redefine the existing (set of) filter(s) with a new one specified in
* @filters. If multiple filters are specified, they need to be delimited by
* spaces. The format of each filter must conform to the format described in
* daemon's configuration file (e.g. libvirtd.conf).
*
* To clear the currently defined (set of) filter(s), pass either an empty
* string ("") or NULL in @filters.
*
* Returns 0 if the new filter or the set of filters has been defined
* successfully, or -1 in case of an error.
*/
int
virAdmConnectSetLoggingFilters(virAdmConnectPtr conn,
const char *filters,
unsigned int flags)
{
int ret = -1;
VIR_DEBUG("conn=%p, flags=%x", conn, flags);
virResetLastError();
virCheckAdmConnectReturn(conn, -1);
if ((ret = remoteAdminConnectSetLoggingFilters(conn, filters, flags)) < 0)
goto error;
return ret;
error:
virDispatchError(NULL);
return -1;
}
+1
View File
@@ -19,6 +19,7 @@ xdr_admin_connect_list_servers_ret;
xdr_admin_connect_lookup_server_args;
xdr_admin_connect_lookup_server_ret;
xdr_admin_connect_open_args;
xdr_admin_connect_set_logging_filters_args;
xdr_admin_connect_set_logging_outputs_args;
xdr_admin_server_get_client_limits_args;
xdr_admin_server_get_client_limits_ret;
+1
View File
@@ -45,4 +45,5 @@ LIBVIRT_ADMIN_3.0.0 {
virAdmConnectGetLoggingOutputs;
virAdmConnectGetLoggingFilters;
virAdmConnectSetLoggingOutputs;
virAdmConnectSetLoggingFilters;
} LIBVIRT_ADMIN_2.0.0;