[PATCH v2 6/9] remote: Implement virDomainGetState

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

 



---
Notes:
    Version 2:
    - rebased
    - unsigned int flags

 daemon/remote_generator.pl |    3 ++-
 src/remote/remote_driver.c |   35 ++++++++++++++++++++++++++++++++++-
 2 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/daemon/remote_generator.pl b/daemon/remote_generator.pl
index ff279d5..736a352 100755
--- a/daemon/remote_generator.pl
+++ b/daemon/remote_generator.pl
@@ -780,7 +780,8 @@ elsif ($opt_k) {
                           "GetType",
                           "NodeDeviceGetParent",
                           "NodeGetSecurityModel",
-                          "SecretGetValue");
+                          "SecretGetValue",
+                          "DomainGetState");
     } elsif ($structprefix eq "qemu") {
         @ungeneratable = ("MonitorCommand");
     }
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 90d95d6..e3bfa29 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -2324,6 +2324,39 @@ done:
 }
 
 static int
+remoteDomainGetState(virDomainPtr domain,
+                     int *state,
+                     int *reason,
+                     unsigned int flags)
+{
+    int rv = -1;
+    remote_domain_get_state_args args;
+    remote_domain_get_state_ret ret;
+    struct private_data *priv = domain->conn->privateData;
+
+    remoteDriverLock(priv);
+
+    make_nonnull_domain(&args.dom, domain);
+    args.flags = flags;
+
+    memset(&ret, 0, sizeof ret);
+    if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_STATE,
+             (xdrproc_t) xdr_remote_domain_get_state_args, (char *) &args,
+             (xdrproc_t) xdr_remote_domain_get_state_ret, (char *) &ret) == -1)
+        goto done;
+
+    *state = ret.state;
+    if (reason)
+        *reason = ret.reason;
+
+    rv = 0;
+
+done:
+    remoteDriverUnlock(priv);
+    return rv;
+}
+
+static int
 remoteNodeGetSecurityModel (virConnectPtr conn, virSecurityModelPtr secmodel)
 {
     remote_node_get_security_model_ret ret;
@@ -6417,7 +6450,7 @@ static virDriver remote_driver = {
     remoteDomainSetBlkioParameters, /* domainSetBlkioParameters */
     remoteDomainGetBlkioParameters, /* domainGetBlkioParameters */
     remoteDomainGetInfo, /* domainGetInfo */
-    NULL, /* domainGetState */
+    remoteDomainGetState, /* domainGetState */
     remoteDomainSave, /* domainSave */
     remoteDomainRestore, /* domainRestore */
     remoteDomainCoreDump, /* domainCoreDump */
-- 
1.7.5.rc3

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