On 07/22/2017 04:55 AM, Yi Wang wrote:
Start a domain whilst undefine it, if starting failed duing
ProcessLaunch,
on which period qemu exited unexpectedly, the operation will lead to failure
of undefine the domain until libvirtd restarted. The reason is that libvirtd
will unlock vm during qemuProcessStart, qemuDomainUndefineFlags can get the
lock and set vm->persistent 0 but not remove the "active" domain.
Signed-off-by: Yi Wang <wang.yi59(a)zte.com.cn>
---
src/conf/domain_conf.h | 1 +
src/qemu/qemu_driver.c | 6 ++++++
src/qemu/qemu_process.c | 3 +++
3 files changed, 10 insertions(+)
Can you apply a couple of recent patches, see:
https://www.redhat.com/archives/libvir-list/2017-August/msg00389.html
and see if those would resolve what you're seeing... without these
changes of course...
Tks -
John
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index af15ee8..f339f84 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2468,6 +2468,7 @@ struct _virDomainObj {
virDomainSnapshotObjPtr current_snapshot;
bool hasManagedSave;
+ bool starting;
void *privateData;
void (*privateDataFreeFunc)(void *);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 6568def..5d9acfc 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7317,6 +7317,12 @@ qemuDomainUndefineFlags(virDomainPtr dom,
if (!(vm = qemuDomObjFromDomain(dom)))
return -1;
+ if (vm->starting) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("cannot undefine during domain starting
up"));
+ goto cleanup;
+ }
+
cfg = virQEMUDriverGetConfig(driver);
if (virDomainUndefineFlagsEnsureACL(dom->conn, vm->def) < 0)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 525521a..7b708be 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5847,6 +5847,8 @@ qemuProcessStart(virConnectPtr conn,
if (!migrateFrom && !snapshot)
flags |= VIR_QEMU_PROCESS_START_NEW;
+ vm->starting = true;
+
if (qemuProcessInit(driver, vm, updatedCPU,
asyncJob, !!migrateFrom, flags) < 0)
goto cleanup;
@@ -5892,6 +5894,7 @@ qemuProcessStart(virConnectPtr conn,
ret = 0;
cleanup:
+ vm->starting = false;
qemuProcessIncomingDefFree(incoming);
return ret;