[libvirt] [PATCH 7/9] Remote driver implementation for the virDomainAbortJob APi

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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        |    9 ++++++++-
 8 files changed, 93 insertions(+), 2 deletions(-)

diff --git a/daemon/remote.c b/daemon/remote.c
index e434591..3269bde 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -5356,6 +5356,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 b66af1c..9cbe258 100644
--- a/daemon/remote_dispatch_args.h
+++ b/daemon/remote_dispatch_args.h
@@ -136,3 +136,4 @@
     remote_cpu_compare_args val_remote_cpu_compare_args;
     remote_domain_memory_stats_args val_remote_domain_memory_stats_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 b520f7d..e34d756 100644
--- a/daemon/remote_dispatch_prototypes.h
+++ b/daemon/remote_dispatch_prototypes.h
@@ -58,6 +58,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 18acba8..de3a355 100644
--- a/daemon/remote_dispatch_table.h
+++ b/daemon/remote_dispatch_table.h
@@ -807,3 +807,8 @@
     .args_filter = (xdrproc_t) xdr_remote_domain_get_job_info_args,
     .ret_filter = (xdrproc_t) xdr_remote_domain_get_job_info_ret,
 },
+{   /* DomainAbortJob => 161 */
+    .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 dd0bf9a..b777b31 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -7576,6 +7576,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;
+}
+
+
 /*----------------------------------------------------------------------*/
 
 
@@ -8965,7 +8989,7 @@ static virDriver remote_driver = {
     remoteDomainIsPersistent, /* domainIsPersistent */
     remoteCPUCompare, /* cpuCompare */
     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 662170d..c81bb46 100644
--- a/src/remote/remote_protocol.c
+++ b/src/remote/remote_protocol.c
@@ -2954,6 +2954,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 47ff223..e014621 100644
--- a/src/remote/remote_protocol.h
+++ b/src/remote/remote_protocol.h
@@ -1671,6 +1671,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
 
@@ -1835,6 +1840,7 @@ enum remote_procedure {
         REMOTE_PROC_CPU_COMPARE = 158,
         REMOTE_PROC_DOMAIN_MEMORY_STATS = 159,
         REMOTE_PROC_DOMAIN_GET_JOB_INFO = 160,
+        REMOTE_PROC_DOMAIN_ABORT_JOB = 161,
 };
 typedef enum remote_procedure remote_procedure;
 
@@ -2139,6 +2145,7 @@ 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_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*);
@@ -2417,6 +2424,7 @@ extern bool_t xdr_remote_cpu_compare_args ();
 extern bool_t xdr_remote_cpu_compare_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 9b37bb4..0753852 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -1485,6 +1485,11 @@ struct remote_domain_get_job_info_ret {
     unsigned hyper fileRemaining;
 };
 
+
+struct remote_domain_abort_job_args {
+    remote_nonnull_domain dom;
+};
+
 /*----- Protocol. -----*/
 
 /* Define the program number, protocol version and procedure numbers here. */
@@ -1666,7 +1671,9 @@ enum remote_procedure {
     REMOTE_PROC_GET_LIB_VERSION = 157,
     REMOTE_PROC_CPU_COMPARE = 158,
     REMOTE_PROC_DOMAIN_MEMORY_STATS = 159,
-    REMOTE_PROC_DOMAIN_GET_JOB_INFO = 160
+    REMOTE_PROC_DOMAIN_GET_JOB_INFO = 160,
+
+    REMOTE_PROC_DOMAIN_ABORT_JOB = 161
 
     /*
      * 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

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]