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

[libvirt] [PATCH 1/3] libxl: Implement virDomainObjCheckIsActive



Add function which raises error if domain is
not active

Signed-off-by: Sagar Ghuge <ghugesss gmail com>
---
 src/conf/domain_conf.c | 15 +++++++++++++++
 src/conf/domain_conf.h |  1 +
 2 files changed, 16 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 97d42fe..a44454c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2997,6 +2997,21 @@ virDomainObjWait(virDomainObjPtr vm)
 }
 
 
+int
+virDomainObjCheckIsActive(virDomainObjPtr vm)
+{
+    if (!virDomainObjIsActive(vm)) {
+        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                       _("domain is not running"));
+        return -1;
+    }
+
+    return 0;
+}
+
+
+
+
 /**
  * Waits for domain condition to be triggered for a specific period of time.
  *
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 1e53cc3..cfeb1ba 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2559,6 +2559,7 @@ bool virDomainObjTaint(virDomainObjPtr obj,
 
 void virDomainObjBroadcast(virDomainObjPtr vm);
 int virDomainObjWait(virDomainObjPtr vm);
+int virDomainObjCheckIsActive(virDomainObjPtr vm);
 int virDomainObjWaitUntil(virDomainObjPtr vm,
                           unsigned long long whenms);
 
-- 
2.9.3


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