[PATCH 08/12] qemu: domain: Introduce qemuDomainObjIsActive helper

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

 



The helper checks whether VM is active including the internal qemu
state. This helper will become useful in situations when an async job
is in use as VIR_JOB_DESTROY can run along async jobs thus both checks
are necessary.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_domain.c | 18 ++++++++++++++++++
 src/qemu/qemu_domain.h |  2 ++
 2 files changed, 20 insertions(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 8fe1b1924d..64fe1abbc5 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -12397,6 +12397,24 @@ qemuDomainObjWait(virDomainObj *vm)
 }


+/**
+ * qemuDomainObjIsActive:
+ * @vm: domain object
+ *
+ * Return whether @vm is active. Take qemu-driver specifics into account.
+ */
+bool
+qemuDomainObjIsActive(virDomainObj *vm)
+{
+    qemuDomainObjPrivate *priv = vm->privateData;
+
+    if (priv->beingDestroyed)
+        return false;
+
+    return virDomainObjIsActive(vm);
+}
+
+
 /**
  * virDomainRefreshStatsSchema:
  * @driver: qemu driver data
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index a3089ea449..d777559119 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -1113,6 +1113,8 @@ qemuDomainRemoveLogs(virQEMUDriver *driver,

 int
 qemuDomainObjWait(virDomainObj *vm);
+bool
+qemuDomainObjIsActive(virDomainObj *vm);

 int
 qemuDomainRefreshStatsSchema(virDomainObj *dom);
-- 
2.45.2




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

  Powered by Linux