[PATCH 4/6 V3] inject-nmi: Implementing the remote protocol

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

 




Signed-off-by: Lai Jiangshan <laijs@xxxxxxxxxxxxxx>
---
 daemon/remote.c                     |   28 ++++++++++++++++++++++++++++
 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        |   11 +++++++++++
 src/remote/remote_protocol.h        |   10 ++++++++++
 src/remote/remote_protocol.x        |    8 +++++++-
 src/remote_protocol-structs         |    4 ++++
 9 files changed, 99 insertions(+), 2 deletions(-)

diff --git a/daemon/remote.c b/daemon/remote.c
index 54fef64..9ae232e 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -3288,6 +3288,34 @@ no_memory:
 }
 
 static int
+remoteDispatchDomainInjectNmi(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_inject_nmi_args *args,
+                              void *ret ATTRIBUTE_UNUSED)
+{
+    virDomainPtr dom;
+    int rv = -1;
+
+    if (!(dom = get_nonnull_domain(conn, args->dom)))
+        goto cleanup;
+
+    if (virDomainInjectNMI(dom, args->flags) == -1)
+        goto cleanup;
+
+    rv = 0;
+
+cleanup:
+    if (rv < 0)
+        remoteDispatchError(rerr);
+    if (dom)
+        virDomainFree(dom);
+    return rv;
+}
+
+static int
 remoteDispatchDomainSetVcpus(struct qemud_server *server ATTRIBUTE_UNUSED,
                              struct qemud_client *client ATTRIBUTE_UNUSED,
                              virConnectPtr conn,
diff --git a/daemon/remote_dispatch_args.h b/daemon/remote_dispatch_args.h
index f9537d7..4887d7c 100644
--- a/daemon/remote_dispatch_args.h
+++ b/daemon/remote_dispatch_args.h
@@ -178,3 +178,4 @@
     remote_domain_migrate_set_max_speed_args val_remote_domain_migrate_set_max_speed_args;
     remote_storage_vol_upload_args val_remote_storage_vol_upload_args;
     remote_storage_vol_download_args val_remote_storage_vol_download_args;
+    remote_domain_inject_nmi_args val_remote_domain_inject_nmi_args;
diff --git a/daemon/remote_dispatch_prototypes.h b/daemon/remote_dispatch_prototypes.h
index 18bf41d..3de6046 100644
--- a/daemon/remote_dispatch_prototypes.h
+++ b/daemon/remote_dispatch_prototypes.h
@@ -338,6 +338,14 @@ static int remoteDispatchDomainHasManagedSaveImage(
     remote_error *err,
     remote_domain_has_managed_save_image_args *args,
     remote_domain_has_managed_save_image_ret *ret);
+static int remoteDispatchDomainInjectNmi(
+    struct qemud_server *server,
+    struct qemud_client *client,
+    virConnectPtr conn,
+    remote_message_header *hdr,
+    remote_error *err,
+    remote_domain_inject_nmi_args *args,
+    void *ret);
 static int remoteDispatchDomainInterfaceStats(
     struct qemud_server *server,
     struct qemud_client *client,
diff --git a/daemon/remote_dispatch_table.h b/daemon/remote_dispatch_table.h
index b39f7c2..dacafdb 100644
--- a/daemon/remote_dispatch_table.h
+++ b/daemon/remote_dispatch_table.h
@@ -1052,3 +1052,8 @@
     .args_filter = (xdrproc_t) xdr_remote_storage_vol_download_args,
     .ret_filter = (xdrproc_t) xdr_void,
 },
+{   /* DomainInjectNmi => 210 */
+    .fn = (dispatch_fn) remoteDispatchDomainInjectNmi,
+    .args_filter = (xdrproc_t) xdr_remote_domain_inject_nmi_args,
+    .ret_filter = (xdrproc_t) xdr_void,
+},
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 4655338..58eb682 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -2933,6 +2933,30 @@ done:
 }
 
 static int
+remoteDomainInjectNMI(virDomainPtr domain, unsigned int flags)
+{
+    int rv = -1;
+    remote_domain_inject_nmi_args args;
+    struct private_data *priv = domain->conn->privateData;
+
+    remoteDriverLock(priv);
+
+    make_nonnull_domain (&args.dom, domain);
+    args.flags = flags;
+
+    if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_INJECT_NMI,
+              (xdrproc_t) xdr_remote_domain_inject_nmi_args, (char *) &args,
+              (xdrproc_t) xdr_void, (char *) NULL) == -1)
+        goto done;
+
+    rv = 0;
+
+done:
+    remoteDriverUnlock(priv);
+    return rv;
+}
+
+static int
 remoteDomainSetVcpus (virDomainPtr domain, unsigned int nvcpus)
 {
     int rv = -1;
@@ -11298,7 +11322,7 @@ static virDriver remote_driver = {
     remoteDomainSnapshotDelete, /* domainSnapshotDelete */
     remoteQemuDomainMonitorCommand, /* qemuDomainMonitorCommand */
     remoteDomainOpenConsole, /* domainOpenConsole */
-    NULL, /* domainInjectNMI */
+    remoteDomainInjectNMI, /* domainInjectNMI */
 };
 
 static virNetworkDriver network_driver = {
diff --git a/src/remote/remote_protocol.c b/src/remote/remote_protocol.c
index 5604371..3ff0b1f 100644
--- a/src/remote/remote_protocol.c
+++ b/src/remote/remote_protocol.c
@@ -1463,6 +1463,17 @@ xdr_remote_domain_undefine_args (XDR *xdrs, remote_domain_undefine_args *objp)
 }
 
 bool_t
+xdr_remote_domain_inject_nmi_args (XDR *xdrs, remote_domain_inject_nmi_args *objp)
+{
+
+         if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
+                 return FALSE;
+         if (!xdr_u_int (xdrs, &objp->flags))
+                 return FALSE;
+        return TRUE;
+}
+
+bool_t
 xdr_remote_domain_set_vcpus_args (XDR *xdrs, remote_domain_set_vcpus_args *objp)
 {
 
diff --git a/src/remote/remote_protocol.h b/src/remote/remote_protocol.h
index d9bf151..4da003e 100644
--- a/src/remote/remote_protocol.h
+++ b/src/remote/remote_protocol.h
@@ -2200,6 +2200,13 @@ struct remote_storage_vol_download_args {
         u_int flags;
 };
 typedef struct remote_storage_vol_download_args remote_storage_vol_download_args;
+
+struct remote_domain_inject_nmi_args {
+        remote_nonnull_domain dom;
+        u_int flags;
+};
+typedef struct remote_domain_inject_nmi_args remote_domain_inject_nmi_args;
+
 #define REMOTE_PROGRAM 0x20008086
 #define REMOTE_PROTOCOL_VERSION 1
 
@@ -2413,6 +2420,7 @@ enum remote_procedure {
         REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_SPEED = 207,
         REMOTE_PROC_STORAGE_VOL_UPLOAD = 208,
         REMOTE_PROC_STORAGE_VOL_DOWNLOAD = 209,
+        REMOTE_PROC_DOMAIN_INJECT_NMI = 210,
 };
 typedef enum remote_procedure remote_procedure;
 
@@ -2561,6 +2569,7 @@ extern  bool_t xdr_remote_domain_create_with_flags_ret (XDR *, remote_domain_cre
 extern  bool_t xdr_remote_domain_define_xml_args (XDR *, remote_domain_define_xml_args*);
 extern  bool_t xdr_remote_domain_define_xml_ret (XDR *, remote_domain_define_xml_ret*);
 extern  bool_t xdr_remote_domain_undefine_args (XDR *, remote_domain_undefine_args*);
+extern  bool_t xdr_remote_domain_inject_nmi_args (XDR *, remote_domain_inject_nmi_args*);
 extern  bool_t xdr_remote_domain_set_vcpus_args (XDR *, remote_domain_set_vcpus_args*);
 extern  bool_t xdr_remote_domain_set_vcpus_flags_args (XDR *, remote_domain_set_vcpus_flags_args*);
 extern  bool_t xdr_remote_domain_get_vcpus_flags_args (XDR *, remote_domain_get_vcpus_flags_args*);
@@ -2918,6 +2927,7 @@ extern bool_t xdr_remote_domain_create_with_flags_ret ();
 extern bool_t xdr_remote_domain_define_xml_args ();
 extern bool_t xdr_remote_domain_define_xml_ret ();
 extern bool_t xdr_remote_domain_undefine_args ();
+extern bool_t xdr_remote_domain_inject_nmi_args ();
 extern bool_t xdr_remote_domain_set_vcpus_args ();
 extern bool_t xdr_remote_domain_set_vcpus_flags_args ();
 extern bool_t xdr_remote_domain_get_vcpus_flags_args ();
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 675eccd..1aacf99 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -817,6 +817,11 @@ struct remote_domain_undefine_args {
     remote_nonnull_domain dom;
 };
 
+struct remote_domain_inject_nmi_args {
+    remote_nonnull_domain dom;
+    unsigned int flags;
+};
+
 struct remote_domain_set_vcpus_args {
     remote_nonnull_domain dom;
     int nvcpus;
@@ -2176,8 +2181,9 @@ enum remote_procedure {
     REMOTE_PROC_DOMAIN_GET_BLKIO_PARAMETERS = 206,
     REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_SPEED = 207,
     REMOTE_PROC_STORAGE_VOL_UPLOAD = 208,
-    REMOTE_PROC_STORAGE_VOL_DOWNLOAD = 209
+    REMOTE_PROC_STORAGE_VOL_DOWNLOAD = 209,
 
+    REMOTE_PROC_DOMAIN_INJECT_NMI = 210,
     /*
      * Notice how the entries are grouped in sets of 10 ?
      * Nice isn't it. Please keep it this way when adding more.
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index 944553c..4b75e33 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -1435,3 +1435,7 @@ struct remote_message_header {
         u_int                      serial;
         remote_message_status      status;
 };
+struct remote_domain_inject_nmi_args {
+        remote_nonnull_domain      dom;
+        unsigned int               flags;
+};
-- 
1.7.4

--
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]