mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 05:17:59 +03:00
Remote driver implementation for the virDomainAbortJob APi
This defines the wire protocol for the new API * src/remote/remote_protocol.x: Wire protocol definition * src/remote/remote_driver.c,daemon/remote.c: Client and server side implementation * daemon/remote_dispatch_args.h, daemon/remote_dispatch_prototypes.h, daemon/remote_dispatch_table.h, src/remote/remote_protocol.c, src/remote/remote_protocol.h: Re-generate from remote_protocol.x
This commit is contained in:
parent
0d8aa35f60
commit
b1a7ebfdec
@ -5434,6 +5434,35 @@ remoteDispatchDomainGetJobInfo (struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
remoteDispatchDomainAbortJob (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_abort_job_args *args,
|
||||
void *ret ATTRIBUTE_UNUSED)
|
||||
{
|
||||
virDomainPtr dom;
|
||||
|
||||
dom = get_nonnull_domain (conn, args->dom);
|
||||
if (dom == NULL) {
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virDomainAbortJob (dom) == -1) {
|
||||
virDomainFree(dom);
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
virDomainFree(dom);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*----- Helpers. -----*/
|
||||
|
||||
/* get_nonnull_domain and get_nonnull_network turn an on-wire
|
||||
|
@ -139,3 +139,4 @@
|
||||
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;
|
||||
remote_domain_abort_job_args val_remote_domain_abort_job_args;
|
||||
|
@ -66,6 +66,14 @@ static int remoteDispatchCpuCompare(
|
||||
remote_error *err,
|
||||
remote_cpu_compare_args *args,
|
||||
remote_cpu_compare_ret *ret);
|
||||
static int remoteDispatchDomainAbortJob(
|
||||
struct qemud_server *server,
|
||||
struct qemud_client *client,
|
||||
virConnectPtr conn,
|
||||
remote_message_header *hdr,
|
||||
remote_error *err,
|
||||
remote_domain_abort_job_args *args,
|
||||
void *ret);
|
||||
static int remoteDispatchDomainAttachDevice(
|
||||
struct qemud_server *server,
|
||||
struct qemud_client *client,
|
||||
|
@ -822,3 +822,8 @@
|
||||
.args_filter = (xdrproc_t) xdr_remote_domain_get_job_info_args,
|
||||
.ret_filter = (xdrproc_t) xdr_remote_domain_get_job_info_ret,
|
||||
},
|
||||
{ /* DomainAbortJob => 164 */
|
||||
.fn = (dispatch_fn) remoteDispatchDomainAbortJob,
|
||||
.args_filter = (xdrproc_t) xdr_remote_domain_abort_job_args,
|
||||
.ret_filter = (xdrproc_t) xdr_void,
|
||||
},
|
||||
|
@ -7683,6 +7683,30 @@ done:
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
remoteDomainAbortJob (virDomainPtr domain)
|
||||
{
|
||||
int rv = -1;
|
||||
remote_domain_abort_job_args args;
|
||||
struct private_data *priv = domain->conn->privateData;
|
||||
|
||||
remoteDriverLock(priv);
|
||||
|
||||
make_nonnull_domain (&args.dom, domain);
|
||||
|
||||
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_ABORT_JOB,
|
||||
(xdrproc_t) xdr_remote_domain_abort_job_args, (char *) &args,
|
||||
(xdrproc_t) xdr_void, (char *) NULL) == -1)
|
||||
goto done;
|
||||
|
||||
rv = 0;
|
||||
|
||||
done:
|
||||
remoteDriverUnlock(priv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@ -9101,7 +9125,7 @@ static virDriver remote_driver = {
|
||||
remoteCPUCompare, /* cpuCompare */
|
||||
remoteCPUBaseline, /* cpuBaseline */
|
||||
remoteDomainGetJobInfo, /* domainGetJobInfo */
|
||||
NULL, /* domainFinishJob */
|
||||
remoteDomainAbortJob, /* domainFinishJob */
|
||||
};
|
||||
|
||||
static virNetworkDriver network_driver = {
|
||||
|
@ -2999,6 +2999,15 @@ xdr_remote_domain_get_job_info_ret (XDR *xdrs, remote_domain_get_job_info_ret *o
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_remote_domain_abort_job_args (XDR *xdrs, remote_domain_abort_job_args *objp)
|
||||
{
|
||||
|
||||
if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_remote_procedure (XDR *xdrs, remote_procedure *objp)
|
||||
{
|
||||
|
@ -1699,6 +1699,11 @@ struct remote_domain_get_job_info_ret {
|
||||
uint64_t fileRemaining;
|
||||
};
|
||||
typedef struct remote_domain_get_job_info_ret remote_domain_get_job_info_ret;
|
||||
|
||||
struct remote_domain_abort_job_args {
|
||||
remote_nonnull_domain dom;
|
||||
};
|
||||
typedef struct remote_domain_abort_job_args remote_domain_abort_job_args;
|
||||
#define REMOTE_PROGRAM 0x20008086
|
||||
#define REMOTE_PROTOCOL_VERSION 1
|
||||
|
||||
@ -1866,6 +1871,7 @@ enum remote_procedure {
|
||||
REMOTE_PROC_DOMAIN_DETACH_DEVICE_FLAGS = 161,
|
||||
REMOTE_PROC_CPU_BASELINE = 162,
|
||||
REMOTE_PROC_DOMAIN_GET_JOB_INFO = 163,
|
||||
REMOTE_PROC_DOMAIN_ABORT_JOB = 164,
|
||||
};
|
||||
typedef enum remote_procedure remote_procedure;
|
||||
|
||||
@ -2174,6 +2180,7 @@ 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_domain_abort_job_args (XDR *, remote_domain_abort_job_args*);
|
||||
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*);
|
||||
@ -2456,6 +2463,7 @@ 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_domain_abort_job_args ();
|
||||
extern bool_t xdr_remote_procedure ();
|
||||
extern bool_t xdr_remote_message_type ();
|
||||
extern bool_t xdr_remote_message_status ();
|
||||
|
@ -1512,6 +1512,11 @@ struct remote_domain_get_job_info_ret {
|
||||
};
|
||||
|
||||
|
||||
struct remote_domain_abort_job_args {
|
||||
remote_nonnull_domain dom;
|
||||
};
|
||||
|
||||
|
||||
/*----- Protocol. -----*/
|
||||
|
||||
/* Define the program number, protocol version and procedure numbers here. */
|
||||
@ -1697,7 +1702,8 @@ enum remote_procedure {
|
||||
|
||||
REMOTE_PROC_DOMAIN_DETACH_DEVICE_FLAGS = 161,
|
||||
REMOTE_PROC_CPU_BASELINE = 162,
|
||||
REMOTE_PROC_DOMAIN_GET_JOB_INFO = 163
|
||||
REMOTE_PROC_DOMAIN_GET_JOB_INFO = 163,
|
||||
REMOTE_PROC_DOMAIN_ABORT_JOB = 164
|
||||
|
||||
/*
|
||||
* Notice how the entries are grouped in sets of 10 ?
|
||||
|
Loading…
Reference in New Issue
Block a user