[PATCH 3/4] implement the remote protocol

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

 



* daemon/remote.c
* daemon/remote_dispatch_args.h
* daemon/remote_dispatch_prototypes.h
* daemon/remote_dispatch_ret.h
* daemon/remote_dispatch_table.h
* src/remote/remote_driver.c
* src/remote/remote_protocol.c
* src/remote/remote_protocol.h
* src/remote/remote_protocol.x
* src/remote_protocol-structs
---
 daemon/remote.c                     |   28 ++++++++++++++++++++++++++++
 daemon/remote_dispatch_args.h       |    1 +
 daemon/remote_dispatch_prototypes.h |    8 ++++++++
 daemon/remote_dispatch_ret.h        |    1 +
 daemon/remote_dispatch_table.h      |    5 +++++
 src/remote/remote_driver.c          |   26 +++++++++++++++++++++++++-
 src/remote/remote_protocol.c        |   18 ++++++++++++++++++
 src/remote/remote_protocol.h        |   15 +++++++++++++++
 src/remote/remote_protocol.x        |   10 +++++++++-
 src/remote_protocol-structs         |    6 ++++++
 10 files changed, 116 insertions(+), 2 deletions(-)

diff --git a/daemon/remote.c b/daemon/remote.c
index 1660815..9dba325 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -5965,6 +5965,34 @@ static int remoteDispatchDomainIsPersistent(struct qemud_server *server ATTRIBUT
     return 0;
 }

+static int remoteDispatchDomainIsUpdated(struct qemud_server *server ATTRIBUTE_UNUSED,
+                                            struct qemud_client *client ATTRIBUTE_UNUSED,
+                                            virConnectPtr conn,
+                                            remote_message_header *hdr ATTRIBUTE_UNUSED,
+                                            remote_error *err,
+                                            remote_domain_is_updated_args *args,
+                                            remote_domain_is_updated_ret *ret)
+{
+    virDomainPtr domain;
+
+    domain = get_nonnull_domain(conn, args->dom);
+    if (domain == NULL) {
+        remoteDispatchConnError(err, conn);
+        return -1;
+    }
+
+    ret->updated = virDomainIsUpdated(domain);
+
+    if (ret->updated < 0) {
+        virDomainFree(domain);
+        remoteDispatchConnError(err, conn);
+        return -1;
+    }
+
+    virDomainFree(domain);
+    return 0;
+}
+
 static int remoteDispatchInterfaceIsActive(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 971af80..221af88 100644
--- a/daemon/remote_dispatch_args.h
+++ b/daemon/remote_dispatch_args.h
@@ -170,3 +170,4 @@
     remote_domain_set_vcpus_flags_args val_remote_domain_set_vcpus_flags_args;
     remote_domain_get_vcpus_flags_args val_remote_domain_get_vcpus_flags_args;
     remote_domain_open_console_args val_remote_domain_open_console_args;
+    remote_domain_is_updated_args val_remote_domain_is_updated_args;
diff --git a/daemon/remote_dispatch_prototypes.h b/daemon/remote_dispatch_prototypes.h
index 15c7ec7..4a5246f 100644
--- a/daemon/remote_dispatch_prototypes.h
+++ b/daemon/remote_dispatch_prototypes.h
@@ -354,6 +354,14 @@ static int remoteDispatchDomainIsPersistent(
     remote_error *err,
     remote_domain_is_persistent_args *args,
     remote_domain_is_persistent_ret *ret);
+static int remoteDispatchDomainIsUpdated(
+    struct qemud_server *server,
+    struct qemud_client *client,
+    virConnectPtr conn,
+    remote_message_header *hdr,
+    remote_error *err,
+    remote_domain_is_updated_args *args,
+    remote_domain_is_updated_ret *ret);
 static int remoteDispatchDomainLookupById(
     struct qemud_server *server,
     struct qemud_client *client,
diff --git a/daemon/remote_dispatch_ret.h b/daemon/remote_dispatch_ret.h
index 3723b00..c01f3ba 100644
--- a/daemon/remote_dispatch_ret.h
+++ b/daemon/remote_dispatch_ret.h
@@ -137,3 +137,4 @@
     remote_domain_create_with_flags_ret val_remote_domain_create_with_flags_ret;
     remote_domain_get_memory_parameters_ret val_remote_domain_get_memory_parameters_ret;
     remote_domain_get_vcpus_flags_ret val_remote_domain_get_vcpus_flags_ret;
+    remote_domain_is_updated_ret val_remote_domain_is_updated_ret;
diff --git a/daemon/remote_dispatch_table.h b/daemon/remote_dispatch_table.h
index 4cfa1b1..3e55424 100644
--- a/daemon/remote_dispatch_table.h
+++ b/daemon/remote_dispatch_table.h
@@ -1012,3 +1012,8 @@
     .args_filter = (xdrproc_t) xdr_remote_domain_open_console_args,
     .ret_filter = (xdrproc_t) xdr_void,
 },
+{   /* DomainIsUpdated => 202 */
+    .fn = (dispatch_fn) remoteDispatchDomainIsUpdated,
+    .args_filter = (xdrproc_t) xdr_remote_domain_is_updated_args,
+    .ret_filter = (xdrproc_t) xdr_remote_domain_is_updated_ret,
+},
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 0965da8..1e74648 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -1962,6 +1962,30 @@ done:
     return rv;
 }

+static int
+remoteDomainIsUpdated(virDomainPtr domain)
+{
+    int rv = -1;
+    remote_domain_is_updated_args args;
+    remote_domain_is_updated_ret ret;
+    struct private_data *priv = domain->conn->privateData;
+
+    remoteDriverLock(priv);
+
+    make_nonnull_domain (&args.dom, domain);
+
+    if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_IS_UPDATED,
+              (xdrproc_t) xdr_remote_domain_is_updated_args, (char *) &args,
+              (xdrproc_t) xdr_remote_domain_is_updated_ret, (char *) &ret) == -1)
+        goto done;
+
+    rv = ret.updated;
+
+done:
+    remoteDriverUnlock(priv);
+    return rv;
+}
+
 static virDomainPtr
 remoteDomainCreateXML (virConnectPtr conn,
                          const char *xmlDesc,
@@ -10713,7 +10737,7 @@ static virDriver remote_driver = {
     remoteIsSecure, /* isSecure */
     remoteDomainIsActive, /* domainIsActive */
     remoteDomainIsPersistent, /* domainIsPersistent */
-    NULL, /* domainIsUpdated */
+    remoteDomainIsUpdated, /* domainIsUpdated */
     remoteCPUCompare, /* cpuCompare */
     remoteCPUBaseline, /* cpuBaseline */
     remoteDomainGetJobInfo, /* domainGetJobInfo */
diff --git a/src/remote/remote_protocol.c b/src/remote/remote_protocol.c
index 41f5e7d..6e07b70 100644
--- a/src/remote/remote_protocol.c
+++ b/src/remote/remote_protocol.c
@@ -3177,6 +3177,24 @@ xdr_remote_domain_is_persistent_ret (XDR *xdrs, remote_domain_is_persistent_ret
 }

 bool_t
+xdr_remote_domain_is_updated_args (XDR *xdrs, remote_domain_is_updated_args *objp)
+{
+
+         if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
+                 return FALSE;
+        return TRUE;
+}
+
+bool_t
+xdr_remote_domain_is_updated_ret (XDR *xdrs, remote_domain_is_updated_ret *objp)
+{
+
+         if (!xdr_int (xdrs, &objp->updated))
+                 return FALSE;
+        return TRUE;
+}
+
+bool_t
 xdr_remote_network_is_active_args (XDR *xdrs, remote_network_is_active_args *objp)
 {

diff --git a/src/remote/remote_protocol.h b/src/remote/remote_protocol.h
index 8dc89a5..4240963 100644
--- a/src/remote/remote_protocol.h
+++ b/src/remote/remote_protocol.h
@@ -1801,6 +1801,16 @@ struct remote_domain_is_persistent_ret {
 };
 typedef struct remote_domain_is_persistent_ret remote_domain_is_persistent_ret;

+struct remote_domain_is_updated_args {
+        remote_nonnull_domain dom;
+};
+typedef struct remote_domain_is_updated_args remote_domain_is_updated_args;
+
+struct remote_domain_is_updated_ret {
+        int updated;
+};
+typedef struct remote_domain_is_updated_ret remote_domain_is_updated_ret;
+
 struct remote_network_is_active_args {
         remote_nonnull_network net;
 };
@@ -2309,6 +2319,7 @@ enum remote_procedure {
         REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS = 199,
         REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS = 200,
         REMOTE_PROC_DOMAIN_OPEN_CONSOLE = 201,
+        REMOTE_PROC_DOMAIN_IS_UPDATED = 202,
 };
 typedef enum remote_procedure remote_procedure;

@@ -2630,6 +2641,8 @@ extern  bool_t xdr_remote_domain_is_active_args (XDR *, remote_domain_is_active_
 extern  bool_t xdr_remote_domain_is_active_ret (XDR *, remote_domain_is_active_ret*);
 extern  bool_t xdr_remote_domain_is_persistent_args (XDR *, remote_domain_is_persistent_args*);
 extern  bool_t xdr_remote_domain_is_persistent_ret (XDR *, remote_domain_is_persistent_ret*);
+extern  bool_t xdr_remote_domain_is_updated_args (XDR *, remote_domain_is_updated_args*);
+extern  bool_t xdr_remote_domain_is_updated_ret (XDR *, remote_domain_is_updated_ret*);
 extern  bool_t xdr_remote_network_is_active_args (XDR *, remote_network_is_active_args*);
 extern  bool_t xdr_remote_network_is_active_ret (XDR *, remote_network_is_active_ret*);
 extern  bool_t xdr_remote_network_is_persistent_args (XDR *, remote_network_is_persistent_args*);
@@ -2974,6 +2987,8 @@ extern bool_t xdr_remote_domain_is_active_args ();
 extern bool_t xdr_remote_domain_is_active_ret ();
 extern bool_t xdr_remote_domain_is_persistent_args ();
 extern bool_t xdr_remote_domain_is_persistent_ret ();
+extern bool_t xdr_remote_domain_is_updated_args ();
+extern bool_t xdr_remote_domain_is_updated_ret ();
 extern bool_t xdr_remote_network_is_active_args ();
 extern bool_t xdr_remote_network_is_active_ret ();
 extern bool_t xdr_remote_network_is_persistent_args ();
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index e84afe5..e1981fd 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -1600,6 +1600,13 @@ struct remote_domain_is_persistent_ret {
     int persistent;
 };

+struct remote_domain_is_updated_args {
+    remote_nonnull_domain dom;
+};
+
+struct remote_domain_is_updated_ret {
+    int updated;
+};

 struct remote_network_is_active_args {
     remote_nonnull_network net;
@@ -2086,7 +2093,8 @@ enum remote_procedure {
     REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS = 199,
     REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS = 200,

-    REMOTE_PROC_DOMAIN_OPEN_CONSOLE = 201
+    REMOTE_PROC_DOMAIN_OPEN_CONSOLE = 201,
+    REMOTE_PROC_DOMAIN_IS_UPDATED = 202

     /*
      * Notice how the entries are grouped in sets of 10 ?
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index 3054bbf..7ca968f 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -1152,6 +1152,12 @@ struct remote_domain_is_persistent_args {
 struct remote_domain_is_persistent_ret {
	int                        persistent;
 };
+struct remote_domain_is_updated_args {
+	remote_nonnull_domain      dom;
+};
+struct remote_domain_is_updated_ret {
+	int                        updated;
+};
 struct remote_network_is_active_args {
	remote_nonnull_network     net;
 };
--
1.7.3.2

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