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

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

On 02/28/2017 11:32 AM, Jim Fehlig wrote:
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 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

BTW, since this new function simply wraps the existing virDomainObjIsActive with error reporting, maybe a better name is virDomainObjIsActiveWithError. Just a suggestion. Perhaps Cole or others have an opinion about the name.


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)

+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.


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