2015-10-15 12:48:58 +00:00
|
|
|
/*
|
|
|
|
* admin_remote.c
|
|
|
|
*
|
|
|
|
* Copyright (C) 2015 Red Hat, Inc.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* Author: Erik Skultety <eskultet@redhat.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
#include <rpc/rpc.h>
|
2015-11-23 11:41:32 +00:00
|
|
|
#include "virtypedparam.h"
|
2015-10-15 12:48:58 +00:00
|
|
|
#include "admin_protocol.h"
|
|
|
|
|
|
|
|
typedef struct _remoteAdminPriv remoteAdminPriv;
|
|
|
|
typedef remoteAdminPriv *remoteAdminPrivPtr;
|
|
|
|
|
|
|
|
struct _remoteAdminPriv {
|
|
|
|
virObjectLockable parent;
|
|
|
|
|
|
|
|
int counter;
|
|
|
|
virNetClientPtr client;
|
|
|
|
virNetClientProgramPtr program;
|
|
|
|
};
|
|
|
|
|
|
|
|
static virClassPtr remoteAdminPrivClass;
|
|
|
|
|
|
|
|
static void
|
|
|
|
remoteAdminPrivDispose(void *opaque)
|
|
|
|
{
|
|
|
|
remoteAdminPrivPtr priv = opaque;
|
|
|
|
|
|
|
|
virObjectUnref(priv->program);
|
|
|
|
virObjectUnref(priv->client);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-08-14 07:17:01 +00:00
|
|
|
/* Helpers */
|
|
|
|
static virAdmServerPtr
|
|
|
|
get_nonnull_server(virAdmConnectPtr conn, admin_nonnull_server server)
|
|
|
|
{
|
|
|
|
return virAdmGetServer(conn, server.name);
|
|
|
|
}
|
|
|
|
|
2016-04-14 22:20:11 +00:00
|
|
|
static virAdmClientPtr
|
|
|
|
get_nonnull_client(virAdmServerPtr srv, admin_nonnull_client client)
|
|
|
|
{
|
|
|
|
return virAdmGetClient(srv, client.id, client.timestamp, client.transport);
|
|
|
|
}
|
|
|
|
|
2015-11-23 11:41:32 +00:00
|
|
|
static void
|
|
|
|
make_nonnull_server(admin_nonnull_server *srv_dst, virAdmServerPtr srv_src)
|
|
|
|
{
|
|
|
|
srv_dst->name = srv_src->name;
|
|
|
|
}
|
2015-08-14 07:17:01 +00:00
|
|
|
|
2016-04-22 11:05:42 +00:00
|
|
|
static void
|
|
|
|
make_nonnull_client(admin_nonnull_client *client_dst,
|
|
|
|
virAdmClientPtr client_src)
|
|
|
|
{
|
|
|
|
client_dst->id = client_src->id;
|
|
|
|
client_dst->transport = client_src->transport;
|
|
|
|
client_dst->timestamp = client_src->timestamp;
|
|
|
|
make_nonnull_server(&client_dst->srv, client_src->srv);
|
|
|
|
}
|
|
|
|
|
2015-10-15 12:48:58 +00:00
|
|
|
static int
|
2015-12-10 12:46:45 +00:00
|
|
|
callFull(virAdmConnectPtr conn ATTRIBUTE_UNUSED,
|
2015-10-15 12:48:58 +00:00
|
|
|
remoteAdminPrivPtr priv,
|
|
|
|
int *fdin,
|
|
|
|
size_t fdinlen,
|
|
|
|
int **fdout,
|
|
|
|
size_t *fdoutlen,
|
|
|
|
int proc_nr,
|
|
|
|
xdrproc_t args_filter, char *args,
|
|
|
|
xdrproc_t ret_filter, char *ret)
|
|
|
|
{
|
|
|
|
int rv;
|
|
|
|
virNetClientProgramPtr prog = priv->program;
|
|
|
|
int counter = priv->counter++;
|
|
|
|
virNetClientPtr client = priv->client;
|
|
|
|
|
|
|
|
/* Unlock, so that if we get any async events/stream data
|
|
|
|
* while processing the RPC, we don't deadlock when our
|
|
|
|
* callbacks for those are invoked
|
|
|
|
*/
|
|
|
|
virObjectRef(priv);
|
|
|
|
virObjectUnlock(priv);
|
|
|
|
|
|
|
|
rv = virNetClientProgramCall(prog,
|
|
|
|
client,
|
|
|
|
counter,
|
|
|
|
proc_nr,
|
|
|
|
fdinlen, fdin,
|
|
|
|
fdoutlen, fdout,
|
|
|
|
args_filter, args,
|
|
|
|
ret_filter, ret);
|
|
|
|
|
|
|
|
virObjectLock(priv);
|
|
|
|
virObjectUnref(priv);
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2015-12-10 12:46:45 +00:00
|
|
|
call(virAdmConnectPtr conn,
|
2015-10-15 12:48:58 +00:00
|
|
|
unsigned int flags,
|
|
|
|
int proc_nr,
|
|
|
|
xdrproc_t args_filter, char *args,
|
|
|
|
xdrproc_t ret_filter, char *ret)
|
|
|
|
{
|
|
|
|
virCheckFlags(0, -1);
|
|
|
|
|
2015-12-10 12:46:45 +00:00
|
|
|
return callFull(conn, conn->privateData,
|
2015-10-15 12:48:58 +00:00
|
|
|
NULL, 0, NULL, NULL, proc_nr,
|
|
|
|
args_filter, args, ret_filter, ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "admin_client.h"
|
|
|
|
|
2015-10-12 15:10:57 +00:00
|
|
|
static void
|
|
|
|
remoteAdminClientCloseFunc(virNetClientPtr client ATTRIBUTE_UNUSED,
|
|
|
|
int reason,
|
|
|
|
void *opaque)
|
|
|
|
{
|
2015-12-10 12:46:45 +00:00
|
|
|
virAdmConnectCloseCallbackDataPtr cbdata = opaque;
|
2015-10-12 15:10:57 +00:00
|
|
|
|
|
|
|
virObjectLock(cbdata);
|
|
|
|
|
|
|
|
if (cbdata->callback) {
|
|
|
|
VIR_DEBUG("Triggering connection close callback %p reason=%d, opaque=%p",
|
|
|
|
cbdata->callback, reason, cbdata->opaque);
|
2015-12-10 12:46:45 +00:00
|
|
|
cbdata->callback(cbdata->conn, reason, cbdata->opaque);
|
2016-11-10 12:21:29 +00:00
|
|
|
virAdmConnectCloseCallbackDataReset(cbdata);
|
2015-10-12 15:10:57 +00:00
|
|
|
}
|
|
|
|
virObjectUnlock(cbdata);
|
|
|
|
}
|
|
|
|
|
2015-10-12 15:08:29 +00:00
|
|
|
static int
|
2015-12-10 12:46:45 +00:00
|
|
|
remoteAdminConnectOpen(virAdmConnectPtr conn, unsigned int flags)
|
2015-10-12 15:08:29 +00:00
|
|
|
{
|
|
|
|
int rv = -1;
|
2015-12-10 12:46:45 +00:00
|
|
|
remoteAdminPrivPtr priv = conn->privateData;
|
|
|
|
admin_connect_open_args args;
|
2015-10-12 15:08:29 +00:00
|
|
|
|
|
|
|
virObjectLock(priv);
|
|
|
|
|
2016-05-05 11:42:52 +00:00
|
|
|
args.flags = flags & ~VIR_CONNECT_NO_ALIASES;
|
2015-10-12 15:08:29 +00:00
|
|
|
|
2015-10-12 15:10:57 +00:00
|
|
|
if (virNetClientRegisterAsyncIO(priv->client) < 0) {
|
|
|
|
VIR_DEBUG("Failed to add event watch, disabling events and support for"
|
|
|
|
" keepalive messages");
|
|
|
|
virResetLastError();
|
|
|
|
}
|
|
|
|
|
2015-12-10 12:46:45 +00:00
|
|
|
virObjectRef(conn->closeCallback);
|
2015-10-12 15:10:57 +00:00
|
|
|
virNetClientSetCloseCallback(priv->client, remoteAdminClientCloseFunc,
|
2015-12-10 12:46:45 +00:00
|
|
|
conn->closeCallback,
|
2015-10-12 15:10:57 +00:00
|
|
|
virObjectFreeCallback);
|
|
|
|
|
2015-12-10 12:46:45 +00:00
|
|
|
if (call(conn, 0, ADMIN_PROC_CONNECT_OPEN,
|
|
|
|
(xdrproc_t)xdr_admin_connect_open_args, (char *)&args,
|
2015-10-12 15:08:29 +00:00
|
|
|
(xdrproc_t)xdr_void, (char *)NULL) == -1) {
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
rv = 0;
|
|
|
|
|
|
|
|
done:
|
|
|
|
virObjectUnlock(priv);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2015-12-10 12:46:45 +00:00
|
|
|
remoteAdminConnectClose(virAdmConnectPtr conn)
|
2015-10-12 15:08:29 +00:00
|
|
|
{
|
|
|
|
int rv = -1;
|
2015-12-10 12:46:45 +00:00
|
|
|
remoteAdminPrivPtr priv = conn->privateData;
|
2015-10-12 15:08:29 +00:00
|
|
|
|
|
|
|
virObjectLock(priv);
|
|
|
|
|
2015-12-10 12:46:45 +00:00
|
|
|
if (call(conn, 0, ADMIN_PROC_CONNECT_CLOSE,
|
2015-10-12 15:08:29 +00:00
|
|
|
(xdrproc_t)xdr_void, (char *)NULL,
|
|
|
|
(xdrproc_t)xdr_void, (char *)NULL) == -1) {
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
admin: Fix memory leak in remoteAdminConnectClose
When virt-admin is run with valgrind, this kind of output can be obtained:
HEAP SUMMARY:
in use at exit: 134,589 bytes in 1,031 blocks
total heap usage: 2,667 allocs, 1,636 frees, 496,755 bytes allocated
88 bytes in 1 blocks are definitely lost in loss record 82 of 128
at 0x4C2A9C7: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x52F6D1F: virAllocVar (viralloc.c:560)
by 0x5350268: virObjectNew (virobject.c:193)
by 0x53503E0: virObjectLockableNew (virobject.c:219)
by 0x4E3BBCB: virAdmConnectNew (datatypes.c:832)
by 0x4E38495: virAdmConnectOpen (libvirt-admin.c:209)
by 0x10C541: vshAdmConnect (virt-admin.c:107)
by 0x10C7B2: vshAdmReconnect (virt-admin.c:163)
by 0x10CC7C: cmdConnect (virt-admin.c:298)
by 0x110838: vshCommandRun (vsh.c:1224)
by 0x10DFD8: main (virt-admin.c:862)
LEAK SUMMARY:
definitely lost: 88 bytes in 1 blocks
indirectly lost: 0 bytes in 0 blocks
possibly lost: 0 bytes in 0 blocks
still reachable: 134,501 bytes in 1,030 blocks
suppressed: 0 bytes in 0 blocks
This is because virNetClientSetCloseCallback was being reinitialized
incorrectly. By resetting the callbacks in a proper way, the leak is fixed.
2016-02-18 13:39:18 +00:00
|
|
|
virNetClientSetCloseCallback(priv->client, NULL, conn->closeCallback,
|
|
|
|
virObjectFreeCallback);
|
|
|
|
virNetClientClose(priv->client);
|
2015-10-12 15:10:57 +00:00
|
|
|
|
2015-10-12 15:08:29 +00:00
|
|
|
rv = 0;
|
|
|
|
|
|
|
|
done:
|
|
|
|
virObjectUnlock(priv);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2015-10-15 12:48:58 +00:00
|
|
|
static void
|
|
|
|
remoteAdminPrivFree(void *opaque)
|
|
|
|
{
|
2015-12-10 12:46:45 +00:00
|
|
|
virAdmConnectPtr conn = opaque;
|
2015-10-15 12:48:58 +00:00
|
|
|
|
2015-12-10 12:46:45 +00:00
|
|
|
remoteAdminConnectClose(conn);
|
|
|
|
virObjectUnref(conn->privateData);
|
2015-10-15 12:48:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static remoteAdminPrivPtr
|
|
|
|
remoteAdminPrivNew(const char *sock_path)
|
|
|
|
{
|
|
|
|
remoteAdminPrivPtr priv = NULL;
|
|
|
|
|
|
|
|
if (!(priv = virObjectLockableNew(remoteAdminPrivClass)))
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
if (!(priv->client = virNetClientNewUNIX(sock_path, false, NULL)))
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
if (!(priv->program = virNetClientProgramNew(ADMIN_PROGRAM,
|
|
|
|
ADMIN_PROTOCOL_VERSION,
|
|
|
|
NULL, 0, NULL)))
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
if (virNetClientAddProgram(priv->client, priv->program) < 0)
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
return priv;
|
|
|
|
error:
|
|
|
|
virObjectUnref(priv);
|
|
|
|
return NULL;
|
|
|
|
}
|
2015-11-23 11:41:32 +00:00
|
|
|
|
|
|
|
static int
|
|
|
|
remoteAdminServerGetThreadPoolParameters(virAdmServerPtr srv,
|
|
|
|
virTypedParameterPtr *params,
|
|
|
|
int *nparams,
|
|
|
|
unsigned int flags)
|
|
|
|
{
|
|
|
|
int rv = -1;
|
|
|
|
remoteAdminPrivPtr priv = srv->conn->privateData;
|
|
|
|
admin_server_get_threadpool_parameters_args args;
|
|
|
|
admin_server_get_threadpool_parameters_ret ret;
|
|
|
|
|
|
|
|
args.flags = flags;
|
|
|
|
make_nonnull_server(&args.srv, srv);
|
|
|
|
|
|
|
|
memset(&ret, 0, sizeof(ret));
|
|
|
|
virObjectLock(priv);
|
|
|
|
|
|
|
|
if (call(srv->conn, 0, ADMIN_PROC_SERVER_GET_THREADPOOL_PARAMETERS,
|
|
|
|
(xdrproc_t)xdr_admin_server_get_threadpool_parameters_args, (char *) &args,
|
|
|
|
(xdrproc_t)xdr_admin_server_get_threadpool_parameters_ret, (char *) &ret) == -1)
|
|
|
|
goto cleanup;
|
|
|
|
|
|
|
|
if (virTypedParamsDeserialize((virTypedParameterRemotePtr) ret.params.params_val,
|
|
|
|
ret.params.params_len,
|
|
|
|
ADMIN_SERVER_THREADPOOL_PARAMETERS_MAX,
|
|
|
|
params,
|
|
|
|
nparams) < 0)
|
|
|
|
goto cleanup;
|
|
|
|
|
|
|
|
rv = 0;
|
|
|
|
xdr_free((xdrproc_t)xdr_admin_server_get_threadpool_parameters_ret, (char *) &ret);
|
|
|
|
|
|
|
|
cleanup:
|
|
|
|
virObjectUnlock(priv);
|
|
|
|
return rv;
|
|
|
|
}
|
admin: Introduce virAdmServerSetThreadPoolParameters
Since threadpool increments the current number of threads according to current
load, i.e. how many jobs are waiting in the queue. The count however, is
constrained by max and min limits of workers. The logic of this new API works
like this:
1) setting the minimum
a) When the limit is increased, depending on the current number of
threads, new threads are possibly spawned if the current number of
threads is less than the new minimum limit
b) Decreasing the minimum limit has no possible effect on the current
number of threads
2) setting the maximum
a) Icreasing the maximum limit has no immediate effect on the current
number of threads, it only allows the threadpool to spawn more
threads when new jobs, that would otherwise end up queued, arrive.
b) Decreasing the maximum limit may affect the current number of
threads, if the current number of threads is less than the new
maximum limit. Since there may be some ongoing time-consuming jobs
that would effectively block this API from killing any threads.
Therefore, this API is asynchronous with best-effort execution,
i.e. the necessary number of workers will be terminated once they
finish their previous job, unless other workers had already
terminated, decreasing the limit to the requested value.
3) setting priority workers
- both increase and decrease in count of these workers have an
immediate impact on the current number of workers, new ones will be
spawned or some of them get terminated respectively.
Signed-off-by: Erik Skultety <eskultet@redhat.com>
2016-02-22 13:24:04 +00:00
|
|
|
|
|
|
|
static int
|
|
|
|
remoteAdminServerSetThreadPoolParameters(virAdmServerPtr srv,
|
|
|
|
virTypedParameterPtr params,
|
|
|
|
int nparams,
|
|
|
|
unsigned int flags)
|
|
|
|
{
|
|
|
|
int rv = -1;
|
|
|
|
remoteAdminPrivPtr priv = srv->conn->privateData;
|
|
|
|
admin_server_set_threadpool_parameters_args args;
|
|
|
|
|
|
|
|
args.flags = flags;
|
|
|
|
make_nonnull_server(&args.srv, srv);
|
|
|
|
|
|
|
|
virObjectLock(priv);
|
|
|
|
|
|
|
|
if (virTypedParamsSerialize(params, nparams,
|
|
|
|
(virTypedParameterRemotePtr *) &args.params.params_val,
|
|
|
|
&args.params.params_len,
|
|
|
|
0) < 0)
|
|
|
|
goto cleanup;
|
|
|
|
|
|
|
|
|
|
|
|
if (call(srv->conn, 0, ADMIN_PROC_SERVER_SET_THREADPOOL_PARAMETERS,
|
|
|
|
(xdrproc_t)xdr_admin_server_set_threadpool_parameters_args, (char *) &args,
|
|
|
|
(xdrproc_t)xdr_void, (char *) NULL) == -1)
|
|
|
|
goto cleanup;
|
|
|
|
|
|
|
|
rv = 0;
|
|
|
|
cleanup:
|
|
|
|
virTypedParamsRemoteFree((virTypedParameterRemotePtr) args.params.params_val,
|
|
|
|
args.params.params_len);
|
|
|
|
virObjectUnlock(priv);
|
|
|
|
return rv;
|
|
|
|
}
|
2016-04-22 11:05:42 +00:00
|
|
|
|
|
|
|
static int
|
|
|
|
remoteAdminClientGetInfo(virAdmClientPtr client,
|
|
|
|
virTypedParameterPtr *params,
|
|
|
|
int *nparams,
|
|
|
|
unsigned int flags)
|
|
|
|
{
|
|
|
|
int rv = -1;
|
|
|
|
remoteAdminPrivPtr priv = client->srv->conn->privateData;
|
|
|
|
admin_client_get_info_args args;
|
|
|
|
admin_client_get_info_ret ret;
|
|
|
|
|
|
|
|
args.flags = flags;
|
|
|
|
make_nonnull_client(&args.clnt, client);
|
|
|
|
|
|
|
|
memset(&ret, 0, sizeof(ret));
|
|
|
|
virObjectLock(priv);
|
|
|
|
|
|
|
|
if (call(client->srv->conn, 0, ADMIN_PROC_CLIENT_GET_INFO,
|
|
|
|
(xdrproc_t)xdr_admin_client_get_info_args, (char *) &args,
|
|
|
|
(xdrproc_t)xdr_admin_client_get_info_ret, (char *) &ret) == -1)
|
|
|
|
goto cleanup;
|
|
|
|
|
|
|
|
if (virTypedParamsDeserialize((virTypedParameterRemotePtr) ret.params.params_val,
|
|
|
|
ret.params.params_len,
|
|
|
|
ADMIN_CLIENT_INFO_PARAMETERS_MAX,
|
|
|
|
params,
|
|
|
|
nparams) < 0)
|
|
|
|
goto cleanup;
|
|
|
|
|
|
|
|
rv = 0;
|
|
|
|
xdr_free((xdrproc_t)xdr_admin_client_get_info_ret, (char *) &ret);
|
|
|
|
|
|
|
|
cleanup:
|
|
|
|
virObjectUnlock(priv);
|
|
|
|
return rv;
|
|
|
|
}
|
2016-04-04 08:28:22 +00:00
|
|
|
|
|
|
|
static int
|
|
|
|
remoteAdminServerGetClientLimits(virAdmServerPtr srv,
|
|
|
|
virTypedParameterPtr *params,
|
|
|
|
int *nparams,
|
|
|
|
unsigned int flags)
|
|
|
|
{
|
|
|
|
int rv = -1;
|
|
|
|
admin_server_get_client_limits_args args;
|
|
|
|
admin_server_get_client_limits_ret ret;
|
|
|
|
remoteAdminPrivPtr priv = srv->conn->privateData;
|
|
|
|
args.flags = flags;
|
|
|
|
make_nonnull_server(&args.srv, srv);
|
|
|
|
|
|
|
|
memset(&ret, 0, sizeof(ret));
|
|
|
|
virObjectLock(priv);
|
|
|
|
|
|
|
|
if (call(srv->conn, 0, ADMIN_PROC_SERVER_GET_CLIENT_LIMITS,
|
|
|
|
(xdrproc_t) xdr_admin_server_get_client_limits_args,
|
|
|
|
(char *) &args,
|
|
|
|
(xdrproc_t) xdr_admin_server_get_client_limits_ret,
|
|
|
|
(char *) &ret) == -1)
|
|
|
|
goto cleanup;
|
|
|
|
|
|
|
|
if (virTypedParamsDeserialize((virTypedParameterRemotePtr) ret.params.params_val,
|
|
|
|
ret.params.params_len,
|
|
|
|
ADMIN_SERVER_CLIENT_LIMITS_MAX,
|
|
|
|
params,
|
|
|
|
nparams) < 0)
|
|
|
|
goto cleanup;
|
|
|
|
|
|
|
|
rv = 0;
|
|
|
|
xdr_free((xdrproc_t) xdr_admin_server_get_client_limits_ret,
|
|
|
|
(char *) &ret);
|
|
|
|
|
|
|
|
cleanup:
|
|
|
|
virObjectUnlock(priv);
|
|
|
|
return rv;
|
|
|
|
}
|
2016-04-04 12:24:52 +00:00
|
|
|
|
|
|
|
static int
|
|
|
|
remoteAdminServerSetClientLimits(virAdmServerPtr srv,
|
|
|
|
virTypedParameterPtr params,
|
|
|
|
int nparams,
|
|
|
|
unsigned int flags)
|
|
|
|
{
|
|
|
|
int rv = -1;
|
|
|
|
admin_server_set_client_limits_args args;
|
|
|
|
remoteAdminPrivPtr priv = srv->conn->privateData;
|
|
|
|
|
|
|
|
args.flags = flags;
|
|
|
|
make_nonnull_server(&args.srv, srv);
|
|
|
|
|
|
|
|
virObjectLock(priv);
|
|
|
|
|
|
|
|
if (virTypedParamsSerialize(params, nparams,
|
|
|
|
(virTypedParameterRemotePtr *) &args.params.params_val,
|
|
|
|
&args.params.params_len,
|
|
|
|
0) < 0)
|
|
|
|
goto cleanup;
|
|
|
|
|
|
|
|
if (call(srv->conn, 0, ADMIN_PROC_SERVER_SET_CLIENT_LIMITS,
|
|
|
|
(xdrproc_t) xdr_admin_server_set_client_limits_args,
|
|
|
|
(char *) &args,
|
|
|
|
(xdrproc_t) xdr_void, (char *) NULL) == -1)
|
|
|
|
goto cleanup;
|
|
|
|
|
|
|
|
rv = 0;
|
|
|
|
cleanup:
|
|
|
|
virTypedParamsRemoteFree((virTypedParameterRemotePtr) args.params.params_val,
|
|
|
|
args.params.params_len);
|
|
|
|
virObjectUnlock(priv);
|
|
|
|
return rv;
|
|
|
|
}
|
2016-03-04 22:00:40 +00:00
|
|
|
|
|
|
|
static int
|
|
|
|
remoteAdminConnectGetLoggingOutputs(virAdmConnectPtr conn,
|
|
|
|
char **outputs,
|
|
|
|
unsigned int flags)
|
|
|
|
{
|
|
|
|
int rv = -1;
|
|
|
|
remoteAdminPrivPtr priv = conn->privateData;
|
|
|
|
admin_connect_get_logging_outputs_args args;
|
|
|
|
admin_connect_get_logging_outputs_ret ret;
|
|
|
|
|
|
|
|
args.flags = flags;
|
|
|
|
|
|
|
|
memset(&ret, 0, sizeof(ret));
|
|
|
|
virObjectLock(priv);
|
|
|
|
|
|
|
|
if (call(conn,
|
|
|
|
0,
|
|
|
|
ADMIN_PROC_CONNECT_GET_LOGGING_OUTPUTS,
|
|
|
|
(xdrproc_t) xdr_admin_connect_get_logging_outputs_args,
|
|
|
|
(char *) &args,
|
|
|
|
(xdrproc_t) xdr_admin_connect_get_logging_outputs_ret,
|
|
|
|
(char *) &ret) == -1)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
if (outputs)
|
|
|
|
VIR_STEAL_PTR(*outputs, ret.outputs);
|
|
|
|
|
|
|
|
rv = ret.noutputs;
|
|
|
|
xdr_free((xdrproc_t) xdr_admin_connect_get_logging_outputs_ret, (char *) &ret);
|
|
|
|
|
|
|
|
done:
|
|
|
|
virObjectUnlock(priv);
|
|
|
|
return rv;
|
|
|
|
}
|
2016-03-04 21:58:55 +00:00
|
|
|
|
|
|
|
static int
|
|
|
|
remoteAdminConnectGetLoggingFilters(virAdmConnectPtr conn,
|
|
|
|
char **filters,
|
|
|
|
unsigned int flags)
|
|
|
|
{
|
|
|
|
int rv = -1;
|
|
|
|
remoteAdminPrivPtr priv = conn->privateData;
|
|
|
|
admin_connect_get_logging_filters_args args;
|
|
|
|
admin_connect_get_logging_filters_ret ret;
|
|
|
|
|
|
|
|
args.flags = flags;
|
|
|
|
|
|
|
|
memset(&ret, 0, sizeof(ret));
|
|
|
|
virObjectLock(priv);
|
|
|
|
|
|
|
|
if (call(conn,
|
|
|
|
0,
|
|
|
|
ADMIN_PROC_CONNECT_GET_LOGGING_FILTERS,
|
|
|
|
(xdrproc_t) xdr_admin_connect_get_logging_filters_args,
|
|
|
|
(char *) &args,
|
|
|
|
(xdrproc_t) xdr_admin_connect_get_logging_filters_ret,
|
|
|
|
(char *) &ret) == -1)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
if (filters)
|
|
|
|
*filters = ret.filters ? *ret.filters : NULL;
|
|
|
|
|
|
|
|
rv = ret.nfilters;
|
|
|
|
VIR_FREE(ret.filters);
|
|
|
|
|
|
|
|
done:
|
|
|
|
virObjectUnlock(priv);
|
|
|
|
return rv;
|
|
|
|
}
|