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 --- daemon/remote.c | 29 +++++++++++++++++++++++++++++ daemon/remote_dispatch_args.h | 1 + daemon/remote_dispatch_prototypes.h | 8 ++++++++ daemon/remote_dispatch_table.h | 5 +++++ src/remote/remote_driver.c | 26 +++++++++++++++++++++++++- src/remote/remote_protocol.c | 9 +++++++++ src/remote/remote_protocol.h | 8 ++++++++ src/remote/remote_protocol.x | 8 +++++++- 8 files changed, 92 insertions(+), 2 deletions(-) diff --git a/daemon/remote.c b/daemon/remote.c index 67d663e..d4713b2 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -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 diff --git a/daemon/remote_dispatch_args.h b/daemon/remote_dispatch_args.h index 3a40542..f97155b 100644 --- a/daemon/remote_dispatch_args.h +++ b/daemon/remote_dispatch_args.h @@ -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; diff --git a/daemon/remote_dispatch_prototypes.h b/daemon/remote_dispatch_prototypes.h index 4b8992e..b81c8c3 100644 --- a/daemon/remote_dispatch_prototypes.h +++ b/daemon/remote_dispatch_prototypes.h @@ -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, diff --git a/daemon/remote_dispatch_table.h b/daemon/remote_dispatch_table.h index a1b34d4..5ad6bff 100644 --- a/daemon/remote_dispatch_table.h +++ b/daemon/remote_dispatch_table.h @@ -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, +}, diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 82a82f4..a12f964 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -7661,6 +7661,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; +} + + /*----------------------------------------------------------------------*/ @@ -9053,7 +9077,7 @@ static virDriver remote_driver = { remoteCPUCompare, /* cpuCompare */ remoteCPUBaseline, /* cpuBaseline */ remoteDomainGetJobInfo, /* domainGetJobInfo */ - NULL, /* domainFinishJob */ + remoteDomainAbortJob, /* domainFinishJob */ }; static virNetworkDriver network_driver = { diff --git a/src/remote/remote_protocol.c b/src/remote/remote_protocol.c index a1f33cc..701acab 100644 --- a/src/remote/remote_protocol.c +++ b/src/remote/remote_protocol.c @@ -3000,6 +3000,15 @@ xdr_remote_domain_get_job_info_ret (XDR *xdrs, remote_domain_get_job_info_ret *o } 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) { diff --git a/src/remote/remote_protocol.h b/src/remote/remote_protocol.h index be2df93..e06d73f 100644 --- a/src/remote/remote_protocol.h +++ b/src/remote/remote_protocol.h @@ -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 (); diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index e54c739..5e33da5 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -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 ? -- 1.6.6 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list