]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: domain: Introduce qemuDomainObjIsActive helper
authorPeter Krempa <pkrempa@redhat.com>
Thu, 6 Jun 2024 16:17:29 +0000 (18:17 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 20 Jun 2024 07:58:52 +0000 (09:58 +0200)
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@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_domain.c
src/qemu/qemu_domain.h

index 4eba4e91c5cce32fbc14367c09e3294588c886bc..2c8f5b1aadda25a2fe26c17d37fa1a166d2d7794 100644 (file)
@@ -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
index a3089ea4494f4376dd9ea85f497b77438fae2870..d777559119472ddf975c682d064db69a8bd11cb4 100644 (file)
@@ -1113,6 +1113,8 @@ qemuDomainRemoveLogs(virQEMUDriver *driver,
 
 int
 qemuDomainObjWait(virDomainObj *vm);
+bool
+qemuDomainObjIsActive(virDomainObj *vm);
 
 int
 qemuDomainRefreshStatsSchema(virDomainObj *dom);