mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 05:17:59 +03:00
Remote driver implmentation of job info API
* src/remote/remote_protocol.x: Define wire protocol format for virDomainGetJobInfo API * src/remote/remote_driver.c, daemon/remote.c: Implement client and server marshalling code for virDomainGetJobInfo() * daemon/remote_dispatch_args.h, daemon/remote_dispatch_prototypes.h daemon/remote_dispatch_ret.h, daemon/remote_dispatch_table.h, src/remote/remote_protocol.c, src/remote/remote_protocol.h: Rebuild files from src/remote/remote_protocol.x
This commit is contained in:
parent
92bd859a29
commit
b85a53405c
@ -5386,6 +5386,50 @@ remoteDispatchCpuBaseline(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
ret->cpu = cpu;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
remoteDispatchDomainGetJobInfo (struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||
virConnectPtr conn,
|
||||
remote_message_header *hdr ATTRIBUTE_UNUSED,
|
||||
remote_error *rerr,
|
||||
remote_domain_get_job_info_args *args,
|
||||
remote_domain_get_job_info_ret *ret)
|
||||
{
|
||||
virDomainPtr dom;
|
||||
virDomainJobInfo info;
|
||||
|
||||
dom = get_nonnull_domain (conn, args->dom);
|
||||
if (dom == NULL) {
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virDomainGetJobInfo (dom, &info) == -1) {
|
||||
virDomainFree(dom);
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret->type = info.type;
|
||||
ret->timeElapsed = info.timeElapsed;
|
||||
ret->timeRemaining = info.timeRemaining;
|
||||
ret->dataTotal = info.dataTotal;
|
||||
ret->dataProcessed = info.dataProcessed;
|
||||
ret->dataRemaining = info.dataRemaining;
|
||||
ret->memTotal = info.memTotal;
|
||||
ret->memProcessed = info.memProcessed;
|
||||
ret->memRemaining = info.memRemaining;
|
||||
ret->fileTotal = info.fileTotal;
|
||||
ret->fileProcessed = info.fileProcessed;
|
||||
ret->fileRemaining = info.fileRemaining;
|
||||
|
||||
virDomainFree(dom);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -138,3 +138,4 @@
|
||||
remote_domain_attach_device_flags_args val_remote_domain_attach_device_flags_args;
|
||||
remote_domain_detach_device_flags_args val_remote_domain_detach_device_flags_args;
|
||||
remote_cpu_baseline_args val_remote_cpu_baseline_args;
|
||||
remote_domain_get_job_info_args val_remote_domain_get_job_info_args;
|
||||
|
@ -194,6 +194,14 @@ static int remoteDispatchDomainGetInfo(
|
||||
remote_error *err,
|
||||
remote_domain_get_info_args *args,
|
||||
remote_domain_get_info_ret *ret);
|
||||
static int remoteDispatchDomainGetJobInfo(
|
||||
struct qemud_server *server,
|
||||
struct qemud_client *client,
|
||||
virConnectPtr conn,
|
||||
remote_message_header *hdr,
|
||||
remote_error *err,
|
||||
remote_domain_get_job_info_args *args,
|
||||
remote_domain_get_job_info_ret *ret);
|
||||
static int remoteDispatchDomainGetMaxMemory(
|
||||
struct qemud_server *server,
|
||||
struct qemud_client *client,
|
||||
|
@ -118,3 +118,4 @@
|
||||
remote_cpu_compare_ret val_remote_cpu_compare_ret;
|
||||
remote_domain_memory_stats_ret val_remote_domain_memory_stats_ret;
|
||||
remote_cpu_baseline_ret val_remote_cpu_baseline_ret;
|
||||
remote_domain_get_job_info_ret val_remote_domain_get_job_info_ret;
|
||||
|
@ -817,3 +817,8 @@
|
||||
.args_filter = (xdrproc_t) xdr_remote_cpu_baseline_args,
|
||||
.ret_filter = (xdrproc_t) xdr_remote_cpu_baseline_ret,
|
||||
},
|
||||
{ /* DomainGetJobInfo => 163 */
|
||||
.fn = (dispatch_fn) remoteDispatchDomainGetJobInfo,
|
||||
.args_filter = (xdrproc_t) xdr_remote_domain_get_job_info_args,
|
||||
.ret_filter = (xdrproc_t) xdr_remote_domain_get_job_info_ret,
|
||||
},
|
||||
|
@ -7643,6 +7643,46 @@ done:
|
||||
return cpu;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
remoteDomainGetJobInfo (virDomainPtr domain, virDomainJobInfoPtr info)
|
||||
{
|
||||
int rv = -1;
|
||||
remote_domain_get_job_info_args args;
|
||||
remote_domain_get_job_info_ret ret;
|
||||
struct private_data *priv = domain->conn->privateData;
|
||||
|
||||
remoteDriverLock(priv);
|
||||
|
||||
make_nonnull_domain (&args.dom, domain);
|
||||
|
||||
memset (&ret, 0, sizeof ret);
|
||||
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_JOB_INFO,
|
||||
(xdrproc_t) xdr_remote_domain_get_job_info_args, (char *) &args,
|
||||
(xdrproc_t) xdr_remote_domain_get_job_info_ret, (char *) &ret) == -1)
|
||||
goto done;
|
||||
|
||||
info->type = ret.type;
|
||||
info->timeElapsed = ret.timeElapsed;
|
||||
info->timeRemaining = ret.timeRemaining;
|
||||
info->dataTotal = ret.dataTotal;
|
||||
info->dataProcessed = ret.dataProcessed;
|
||||
info->dataRemaining = ret.dataRemaining;
|
||||
info->memTotal = ret.memTotal;
|
||||
info->memProcessed = ret.memProcessed;
|
||||
info->memRemaining = ret.memRemaining;
|
||||
info->fileTotal = ret.fileTotal;
|
||||
info->fileProcessed = ret.fileProcessed;
|
||||
info->fileRemaining = ret.fileRemaining;
|
||||
|
||||
rv = 0;
|
||||
|
||||
done:
|
||||
remoteDriverUnlock(priv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@ -9060,7 +9100,7 @@ static virDriver remote_driver = {
|
||||
remoteDomainIsPersistent, /* domainIsPersistent */
|
||||
remoteCPUCompare, /* cpuCompare */
|
||||
remoteCPUBaseline, /* cpuBaseline */
|
||||
NULL, /* domainGetJobInfo */
|
||||
remoteDomainGetJobInfo, /* domainGetJobInfo */
|
||||
};
|
||||
|
||||
static virNetworkDriver network_driver = {
|
||||
|
@ -2959,6 +2959,46 @@ xdr_remote_cpu_baseline_ret (XDR *xdrs, remote_cpu_baseline_ret *objp)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_remote_domain_get_job_info_args (XDR *xdrs, remote_domain_get_job_info_args *objp)
|
||||
{
|
||||
|
||||
if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_remote_domain_get_job_info_ret (XDR *xdrs, remote_domain_get_job_info_ret *objp)
|
||||
{
|
||||
|
||||
if (!xdr_int (xdrs, &objp->type))
|
||||
return FALSE;
|
||||
if (!xdr_uint64_t (xdrs, &objp->timeElapsed))
|
||||
return FALSE;
|
||||
if (!xdr_uint64_t (xdrs, &objp->timeRemaining))
|
||||
return FALSE;
|
||||
if (!xdr_uint64_t (xdrs, &objp->dataTotal))
|
||||
return FALSE;
|
||||
if (!xdr_uint64_t (xdrs, &objp->dataProcessed))
|
||||
return FALSE;
|
||||
if (!xdr_uint64_t (xdrs, &objp->dataRemaining))
|
||||
return FALSE;
|
||||
if (!xdr_uint64_t (xdrs, &objp->memTotal))
|
||||
return FALSE;
|
||||
if (!xdr_uint64_t (xdrs, &objp->memProcessed))
|
||||
return FALSE;
|
||||
if (!xdr_uint64_t (xdrs, &objp->memRemaining))
|
||||
return FALSE;
|
||||
if (!xdr_uint64_t (xdrs, &objp->fileTotal))
|
||||
return FALSE;
|
||||
if (!xdr_uint64_t (xdrs, &objp->fileProcessed))
|
||||
return FALSE;
|
||||
if (!xdr_uint64_t (xdrs, &objp->fileRemaining))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_remote_procedure (XDR *xdrs, remote_procedure *objp)
|
||||
{
|
||||
|
@ -1678,6 +1678,27 @@ struct remote_cpu_baseline_ret {
|
||||
remote_nonnull_string cpu;
|
||||
};
|
||||
typedef struct remote_cpu_baseline_ret remote_cpu_baseline_ret;
|
||||
|
||||
struct remote_domain_get_job_info_args {
|
||||
remote_nonnull_domain dom;
|
||||
};
|
||||
typedef struct remote_domain_get_job_info_args remote_domain_get_job_info_args;
|
||||
|
||||
struct remote_domain_get_job_info_ret {
|
||||
int type;
|
||||
uint64_t timeElapsed;
|
||||
uint64_t timeRemaining;
|
||||
uint64_t dataTotal;
|
||||
uint64_t dataProcessed;
|
||||
uint64_t dataRemaining;
|
||||
uint64_t memTotal;
|
||||
uint64_t memProcessed;
|
||||
uint64_t memRemaining;
|
||||
uint64_t fileTotal;
|
||||
uint64_t fileProcessed;
|
||||
uint64_t fileRemaining;
|
||||
};
|
||||
typedef struct remote_domain_get_job_info_ret remote_domain_get_job_info_ret;
|
||||
#define REMOTE_PROGRAM 0x20008086
|
||||
#define REMOTE_PROTOCOL_VERSION 1
|
||||
|
||||
@ -1844,6 +1865,7 @@ enum remote_procedure {
|
||||
REMOTE_PROC_DOMAIN_ATTACH_DEVICE_FLAGS = 160,
|
||||
REMOTE_PROC_DOMAIN_DETACH_DEVICE_FLAGS = 161,
|
||||
REMOTE_PROC_CPU_BASELINE = 162,
|
||||
REMOTE_PROC_DOMAIN_GET_JOB_INFO = 163,
|
||||
};
|
||||
typedef enum remote_procedure remote_procedure;
|
||||
|
||||
@ -2150,6 +2172,8 @@ extern bool_t xdr_remote_cpu_compare_args (XDR *, remote_cpu_compare_args*);
|
||||
extern bool_t xdr_remote_cpu_compare_ret (XDR *, remote_cpu_compare_ret*);
|
||||
extern bool_t xdr_remote_cpu_baseline_args (XDR *, remote_cpu_baseline_args*);
|
||||
extern bool_t xdr_remote_cpu_baseline_ret (XDR *, remote_cpu_baseline_ret*);
|
||||
extern bool_t xdr_remote_domain_get_job_info_args (XDR *, remote_domain_get_job_info_args*);
|
||||
extern bool_t xdr_remote_domain_get_job_info_ret (XDR *, remote_domain_get_job_info_ret*);
|
||||
extern bool_t xdr_remote_procedure (XDR *, remote_procedure*);
|
||||
extern bool_t xdr_remote_message_type (XDR *, remote_message_type*);
|
||||
extern bool_t xdr_remote_message_status (XDR *, remote_message_status*);
|
||||
@ -2430,6 +2454,8 @@ extern bool_t xdr_remote_cpu_compare_args ();
|
||||
extern bool_t xdr_remote_cpu_compare_ret ();
|
||||
extern bool_t xdr_remote_cpu_baseline_args ();
|
||||
extern bool_t xdr_remote_cpu_baseline_ret ();
|
||||
extern bool_t xdr_remote_domain_get_job_info_args ();
|
||||
extern bool_t xdr_remote_domain_get_job_info_ret ();
|
||||
extern bool_t xdr_remote_procedure ();
|
||||
extern bool_t xdr_remote_message_type ();
|
||||
extern bool_t xdr_remote_message_status ();
|
||||
|
@ -1488,6 +1488,30 @@ struct remote_cpu_baseline_ret {
|
||||
};
|
||||
|
||||
|
||||
struct remote_domain_get_job_info_args {
|
||||
remote_nonnull_domain dom;
|
||||
};
|
||||
|
||||
struct remote_domain_get_job_info_ret {
|
||||
int type;
|
||||
|
||||
unsigned hyper timeElapsed;
|
||||
unsigned hyper timeRemaining;
|
||||
|
||||
unsigned hyper dataTotal;
|
||||
unsigned hyper dataProcessed;
|
||||
unsigned hyper dataRemaining;
|
||||
|
||||
unsigned hyper memTotal;
|
||||
unsigned hyper memProcessed;
|
||||
unsigned hyper memRemaining;
|
||||
|
||||
unsigned hyper fileTotal;
|
||||
unsigned hyper fileProcessed;
|
||||
unsigned hyper fileRemaining;
|
||||
};
|
||||
|
||||
|
||||
/*----- Protocol. -----*/
|
||||
|
||||
/* Define the program number, protocol version and procedure numbers here. */
|
||||
@ -1672,7 +1696,8 @@ enum remote_procedure {
|
||||
REMOTE_PROC_DOMAIN_ATTACH_DEVICE_FLAGS = 160,
|
||||
|
||||
REMOTE_PROC_DOMAIN_DETACH_DEVICE_FLAGS = 161,
|
||||
REMOTE_PROC_CPU_BASELINE = 162
|
||||
REMOTE_PROC_CPU_BASELINE = 162,
|
||||
REMOTE_PROC_DOMAIN_GET_JOB_INFO = 163
|
||||
|
||||
/*
|
||||
* Notice how the entries are grouped in sets of 10 ?
|
||||
|
Loading…
Reference in New Issue
Block a user