Create a qemuDomainRemoveInactiveLocked which is a copy of
qemuDomainRemoveInactive except that instead of calling
virDomainObjListRemove it calls virDomainObjListRemoveLocked.
Signed-off-by: Wang Yechao <wang.yechao255(a)zte.com.cn>
---
src/qemu/qemu_domain.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 191113a..22436d2 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -8394,6 +8394,28 @@ qemuDomainRemoveInactive(virQEMUDriverPtr driver,
/**
+ * qemuDomainRemoveInactiveLocked:
+ *
+ * The caller must hold a lock to the vm and must hold the
+ * lock on driver->domains in order to call the remove obj
+ * from locked list method.
+ */
+static void
+qemuDomainRemoveInactiveLocked(virQEMUDriverPtr driver,
+ virDomainObjPtr vm)
+{
+ if (vm->persistent) {
+ /* Short-circuit, we don't want to remove a persistent domain */
+ return;
+ }
+
+ qemuDomainRemoveInactiveCommon(driver, vm);
+
+ virDomainObjListRemoveLocked(driver->domains, vm);
+}
+
+
+/**
* qemuDomainRemoveInactiveJob:
*
* Just like qemuDomainRemoveInactive but it tries to grab a
--
1.8.3.1