mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-05 22:05:47 +00:00
admin: Introduce virAdmConnectSetLoggingOutputs
Enable libvirt users to modify daemon's logging output settings from outside. If either an empty string or NULL is passed, a default logging output will be used the same way as it would be in case writing an empty string to the libvirtd.conf Signed-off-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
cd484b534e
commit
ceeb85bd00
@ -415,6 +415,16 @@ adminConnectGetLoggingFilters(char **filters, unsigned int flags)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
adminConnectSetLoggingOutputs(virNetDaemonPtr dmn ATTRIBUTE_UNUSED,
|
||||||
|
const char *outputs,
|
||||||
|
unsigned int flags)
|
||||||
|
{
|
||||||
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
|
return virLogSetOutputs(outputs);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
adminDispatchConnectGetLoggingOutputs(virNetServerPtr server ATTRIBUTE_UNUSED,
|
adminDispatchConnectGetLoggingOutputs(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||||
virNetServerClientPtr client ATTRIBUTE_UNUSED,
|
virNetServerClientPtr client ATTRIBUTE_UNUSED,
|
||||||
|
@ -412,6 +412,10 @@ int virAdmConnectGetLoggingFilters(virAdmConnectPtr conn,
|
|||||||
char **filters,
|
char **filters,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
|
||||||
|
int virAdmConnectSetLoggingOutputs(virAdmConnectPtr conn,
|
||||||
|
const char *outputs,
|
||||||
|
unsigned int flags);
|
||||||
|
|
||||||
# ifdef __cplusplus
|
# ifdef __cplusplus
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
@ -201,6 +201,11 @@ struct admin_connect_get_logging_filters_ret {
|
|||||||
unsigned int nfilters;
|
unsigned int nfilters;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct admin_connect_set_logging_outputs_args {
|
||||||
|
admin_string outputs;
|
||||||
|
unsigned int flags;
|
||||||
|
};
|
||||||
|
|
||||||
/* Define the program number, protocol version and procedure numbers here. */
|
/* Define the program number, protocol version and procedure numbers here. */
|
||||||
const ADMIN_PROGRAM = 0x06900690;
|
const ADMIN_PROGRAM = 0x06900690;
|
||||||
const ADMIN_PROTOCOL_VERSION = 1;
|
const ADMIN_PROTOCOL_VERSION = 1;
|
||||||
@ -296,5 +301,10 @@ enum admin_procedure {
|
|||||||
/**
|
/**
|
||||||
* @generate: none
|
* @generate: none
|
||||||
*/
|
*/
|
||||||
ADMIN_PROC_CONNECT_GET_LOGGING_FILTERS = 15
|
ADMIN_PROC_CONNECT_GET_LOGGING_FILTERS = 15,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @generate: both
|
||||||
|
*/
|
||||||
|
ADMIN_PROC_CONNECT_SET_LOGGING_OUTPUTS = 16
|
||||||
};
|
};
|
||||||
|
@ -141,6 +141,10 @@ struct admin_connect_get_logging_filters_ret {
|
|||||||
admin_string filters;
|
admin_string filters;
|
||||||
u_int nfilters;
|
u_int nfilters;
|
||||||
};
|
};
|
||||||
|
struct admin_connect_set_logging_outputs_args {
|
||||||
|
admin_string outputs;
|
||||||
|
u_int flags;
|
||||||
|
};
|
||||||
enum admin_procedure {
|
enum admin_procedure {
|
||||||
ADMIN_PROC_CONNECT_OPEN = 1,
|
ADMIN_PROC_CONNECT_OPEN = 1,
|
||||||
ADMIN_PROC_CONNECT_CLOSE = 2,
|
ADMIN_PROC_CONNECT_CLOSE = 2,
|
||||||
@ -157,4 +161,5 @@ enum admin_procedure {
|
|||||||
ADMIN_PROC_SERVER_SET_CLIENT_LIMITS = 13,
|
ADMIN_PROC_SERVER_SET_CLIENT_LIMITS = 13,
|
||||||
ADMIN_PROC_CONNECT_GET_LOGGING_OUTPUTS = 14,
|
ADMIN_PROC_CONNECT_GET_LOGGING_OUTPUTS = 14,
|
||||||
ADMIN_PROC_CONNECT_GET_LOGGING_FILTERS = 15,
|
ADMIN_PROC_CONNECT_GET_LOGGING_FILTERS = 15,
|
||||||
|
ADMIN_PROC_CONNECT_SET_LOGGING_OUTPUTS = 16,
|
||||||
};
|
};
|
||||||
|
@ -1165,3 +1165,41 @@ virAdmConnectGetLoggingFilters(virAdmConnectPtr conn,
|
|||||||
virDispatchError(NULL);
|
virDispatchError(NULL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* virAdmConnectSetLoggingOutputs:
|
||||||
|
* @conn: pointer to an active admin connection
|
||||||
|
* @outputs: pointer to a string containing a list of outputs to be defined
|
||||||
|
* @flags: extra flags; not used yet, so callers should always pass 0
|
||||||
|
*
|
||||||
|
* Redefine the existing (set of) outputs(s) with a new one specified in
|
||||||
|
* @outputs. If multiple outputs are specified, they need to be delimited by
|
||||||
|
* spaces. The format of each output must conform to the format described in
|
||||||
|
* daemon's configuration file (e.g. libvirtd.conf).
|
||||||
|
*
|
||||||
|
* To reset the existing (set of) output(s) to libvirt's defaults, an empty
|
||||||
|
* string ("") or NULL should be passed in @outputs.
|
||||||
|
*
|
||||||
|
* Returns 0 if the new output or the set of outputs has been defined
|
||||||
|
* successfully, or -1 in case of an error.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
virAdmConnectSetLoggingOutputs(virAdmConnectPtr conn,
|
||||||
|
const char *outputs,
|
||||||
|
unsigned int flags)
|
||||||
|
{
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
VIR_DEBUG("conn=%p, outputs=%s, flags=%x", conn, outputs, flags);
|
||||||
|
|
||||||
|
virResetLastError();
|
||||||
|
virCheckAdmConnectReturn(conn, -1);
|
||||||
|
|
||||||
|
if ((ret = remoteAdminConnectSetLoggingOutputs(conn, outputs, flags)) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
error:
|
||||||
|
virDispatchError(NULL);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
@ -19,6 +19,7 @@ xdr_admin_connect_list_servers_ret;
|
|||||||
xdr_admin_connect_lookup_server_args;
|
xdr_admin_connect_lookup_server_args;
|
||||||
xdr_admin_connect_lookup_server_ret;
|
xdr_admin_connect_lookup_server_ret;
|
||||||
xdr_admin_connect_open_args;
|
xdr_admin_connect_open_args;
|
||||||
|
xdr_admin_connect_set_logging_outputs_args;
|
||||||
xdr_admin_server_get_client_limits_args;
|
xdr_admin_server_get_client_limits_args;
|
||||||
xdr_admin_server_get_client_limits_ret;
|
xdr_admin_server_get_client_limits_ret;
|
||||||
xdr_admin_server_get_threadpool_parameters_args;
|
xdr_admin_server_get_threadpool_parameters_args;
|
||||||
|
@ -44,4 +44,5 @@ LIBVIRT_ADMIN_3.0.0 {
|
|||||||
global:
|
global:
|
||||||
virAdmConnectGetLoggingOutputs;
|
virAdmConnectGetLoggingOutputs;
|
||||||
virAdmConnectGetLoggingFilters;
|
virAdmConnectGetLoggingFilters;
|
||||||
|
virAdmConnectSetLoggingOutputs;
|
||||||
} LIBVIRT_ADMIN_2.0.0;
|
} LIBVIRT_ADMIN_2.0.0;
|
||||||
|
Loading…
Reference in New Issue
Block a user