From: Peter Krempa Date: Thu, 6 Jun 2024 16:17:29 +0000 (+0200) Subject: qemu: domain: Introduce qemuDomainObjIsActive helper X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=9eb33b7f038d628580c3c160c7a9d7667e7a77c2;p=libvirt.git qemu: domain: Introduce qemuDomainObjIsActive helper 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 Reviewed-by: Michal Privoznik --- diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 4eba4e91c5..2c8f5b1aad 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);