mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
remote: implement virDomainGetGuestInfo
Add daemon and client code to serialize/deserialize virDomainGetGuestInfo(). Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com> Tested-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
96880b87d0
commit
e8b83b2aac
@ -7650,3 +7650,50 @@ remoteSerializeDomainDiskErrors(virDomainDiskErrorPtr errors,
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
remoteDispatchDomainGetGuestInfo(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
virNetServerClientPtr client,
|
||||
virNetMessagePtr msg ATTRIBUTE_UNUSED,
|
||||
virNetMessageErrorPtr rerr,
|
||||
remote_domain_get_guest_info_args *args,
|
||||
remote_domain_get_guest_info_ret *ret)
|
||||
{
|
||||
int rv = -1;
|
||||
virConnectPtr conn = remoteGetHypervisorConn(client);
|
||||
virDomainPtr dom = NULL;
|
||||
virTypedParameterPtr params = NULL;
|
||||
int nparams = 0;
|
||||
|
||||
if (!conn)
|
||||
goto cleanup;
|
||||
|
||||
if (!(dom = get_nonnull_domain(conn, args->dom)))
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainGetGuestInfo(dom, args->types, ¶ms, &nparams, args->flags) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (nparams > REMOTE_DOMAIN_GUEST_INFO_PARAMS_MAX) {
|
||||
virReportError(VIR_ERR_RPC,
|
||||
_("Too many params in guestinfo: %d for limit %d"),
|
||||
nparams, REMOTE_DOMAIN_GUEST_INFO_PARAMS_MAX);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virTypedParamsSerialize(params, nparams,
|
||||
(virTypedParameterRemotePtr *) &ret->params.params_val,
|
||||
&ret->params.params_len,
|
||||
VIR_TYPED_PARAM_STRING_OKAY) < 0)
|
||||
goto cleanup;
|
||||
|
||||
rv = 0;
|
||||
|
||||
cleanup:
|
||||
if (rv < 0)
|
||||
virNetMessageSaveError(rerr);
|
||||
virTypedParamsFree(params, nparams);
|
||||
virObjectUnref(dom);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -8306,6 +8306,49 @@ remoteNetworkPortGetParameters(virNetworkPortPtr port,
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int
|
||||
remoteDomainGetGuestInfo(virDomainPtr dom,
|
||||
unsigned int types,
|
||||
virTypedParameterPtr *params,
|
||||
int *nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
int rv = -1;
|
||||
struct private_data *priv = dom->conn->privateData;
|
||||
remote_domain_get_guest_info_args args;
|
||||
remote_domain_get_guest_info_ret ret;
|
||||
|
||||
remoteDriverLock(priv);
|
||||
|
||||
make_nonnull_domain(&args.dom, dom);
|
||||
|
||||
args.types = types;
|
||||
args.flags = flags;
|
||||
|
||||
memset(&ret, 0, sizeof(ret));
|
||||
|
||||
if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_GUEST_INFO,
|
||||
(xdrproc_t)xdr_remote_domain_get_guest_info_args, (char *)&args,
|
||||
(xdrproc_t)xdr_remote_domain_get_guest_info_ret, (char *)&ret) == -1)
|
||||
goto done;
|
||||
|
||||
if (virTypedParamsDeserialize((virTypedParameterRemotePtr) ret.params.params_val,
|
||||
ret.params.params_len,
|
||||
REMOTE_DOMAIN_GUEST_INFO_PARAMS_MAX,
|
||||
params,
|
||||
nparams) < 0)
|
||||
goto cleanup;
|
||||
|
||||
rv = 0;
|
||||
|
||||
cleanup:
|
||||
xdr_free((xdrproc_t)xdr_remote_domain_get_guest_info_ret,
|
||||
(char *) &ret);
|
||||
|
||||
done:
|
||||
remoteDriverUnlock(priv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* get_nonnull_domain and get_nonnull_network turn an on-wire
|
||||
* (name, uuid) pair into virDomainPtr or virNetworkPtr object.
|
||||
@ -8733,6 +8776,7 @@ static virHypervisorDriver hypervisor_driver = {
|
||||
.domainCheckpointLookupByName = remoteDomainCheckpointLookupByName, /* 5.6.0 */
|
||||
.domainCheckpointGetParent = remoteDomainCheckpointGetParent, /* 5.6.0 */
|
||||
.domainCheckpointDelete = remoteDomainCheckpointDelete, /* 5.6.0 */
|
||||
.domainGetGuestInfo = remoteDomainGetGuestInfo, /* 5.7.0 */
|
||||
};
|
||||
|
||||
static virNetworkDriver network_driver = {
|
||||
|
@ -269,6 +269,9 @@ const REMOTE_NODE_SEV_INFO_MAX = 64;
|
||||
/* Upper limit on number of launch security information entries */
|
||||
const REMOTE_DOMAIN_LAUNCH_SECURITY_INFO_PARAMS_MAX = 64;
|
||||
|
||||
/* Upper limit on number of parameters describing a guest */
|
||||
const REMOTE_DOMAIN_GUEST_INFO_PARAMS_MAX = 2048;
|
||||
|
||||
/*
|
||||
* Upper limit on list of network port parameters
|
||||
*/
|
||||
@ -3723,6 +3726,16 @@ struct remote_domain_checkpoint_delete_args {
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
struct remote_domain_get_guest_info_args {
|
||||
remote_nonnull_domain dom;
|
||||
unsigned int types;
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
struct remote_domain_get_guest_info_ret {
|
||||
remote_typed_param params<REMOTE_DOMAIN_GUEST_INFO_PARAMS_MAX>;
|
||||
};
|
||||
|
||||
/*----- Protocol. -----*/
|
||||
|
||||
/* Define the program number, protocol version and procedure numbers here. */
|
||||
@ -6584,5 +6597,11 @@ enum remote_procedure {
|
||||
* @generate: both
|
||||
* @acl: domain:checkpoint
|
||||
*/
|
||||
REMOTE_PROC_DOMAIN_CHECKPOINT_DELETE = 417
|
||||
REMOTE_PROC_DOMAIN_CHECKPOINT_DELETE = 417,
|
||||
|
||||
/**
|
||||
* @generate: none
|
||||
* @acl: domain:write
|
||||
*/
|
||||
REMOTE_PROC_DOMAIN_GET_GUEST_INFO = 418
|
||||
};
|
||||
|
@ -3105,6 +3105,17 @@ struct remote_domain_checkpoint_delete_args {
|
||||
remote_nonnull_domain_checkpoint checkpoint;
|
||||
u_int flags;
|
||||
};
|
||||
struct remote_domain_get_guest_info_args {
|
||||
remote_nonnull_domain dom;
|
||||
u_int types;
|
||||
u_int flags;
|
||||
};
|
||||
struct remote_domain_get_guest_info_ret {
|
||||
struct {
|
||||
u_int params_len;
|
||||
remote_typed_param * params_val;
|
||||
} params;
|
||||
};
|
||||
enum remote_procedure {
|
||||
REMOTE_PROC_CONNECT_OPEN = 1,
|
||||
REMOTE_PROC_CONNECT_CLOSE = 2,
|
||||
@ -3523,4 +3534,5 @@ enum remote_procedure {
|
||||
REMOTE_PROC_DOMAIN_CHECKPOINT_LOOKUP_BY_NAME = 415,
|
||||
REMOTE_PROC_DOMAIN_CHECKPOINT_GET_PARENT = 416,
|
||||
REMOTE_PROC_DOMAIN_CHECKPOINT_DELETE = 417,
|
||||
REMOTE_PROC_DOMAIN_GET_GUEST_INFO = 418,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user