On 02/24/2017 01:03 AM, Sagar Ghuge wrote:
Add function which raises error if domain is
not active
Signed-off-by: Sagar Ghuge <ghugesss(a)gmail.com>
---
src/conf/domain_conf.c | 15 +++++++++++++++
src/conf/domain_conf.h | 1 +
2 files changed, 16 insertions(+)
This patch doesn't touch any libxl code, so the commit summary should be
conf: Implement virDomainObjCheckIsActive
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);
I realize functions aren't listed in alphabetical order, but placement here
seems a bit odd. Maybe add it after the existing declaration of
virDomainObjIsActive(). Also, I think this function should return a bool instead
of int.
Regards,
Jim
int virDomainObjWaitUntil(virDomainObjPtr vm,
unsigned long long whenms);