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

[libvirt] [PATCH 6/8] remote: Implement virDomainGetState



---
 src/remote/remote_driver.c |   31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 9796bb5..3baedf0 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -2861,6 +2861,35 @@ done:
 }
 
 static int
+remoteDomainGetState(virDomainPtr domain, int *state, int *reason)
+{
+    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);
+
+    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
 remoteDomainSave (virDomainPtr domain, const char *to)
 {
     int rv = -1;
@@ -11222,7 +11251,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


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