|
|
9119d9 |
From ab2daea383e32d94c6429bc59105cbff1986d6b3 Mon Sep 17 00:00:00 2001
|
|
|
9119d9 |
Message-Id: <ab2daea383e32d94c6429bc59105cbff1986d6b3@dist-git>
|
|
|
9119d9 |
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
|
|
9119d9 |
Date: Wed, 21 Jan 2015 11:39:35 +0100
|
|
|
9119d9 |
Subject: [PATCH] Fix vmdef usage while in monitor in qemuDomainHotplugVcpus
|
|
|
9119d9 |
MIME-Version: 1.0
|
|
|
9119d9 |
Content-Type: text/plain; charset=UTF-8
|
|
|
9119d9 |
Content-Transfer-Encoding: 8bit
|
|
|
9119d9 |
|
|
|
9119d9 |
https://bugzilla.redhat.com/show_bug.cgi?id=1161024
|
|
|
9119d9 |
|
|
|
9119d9 |
Exit the monitor right after we've done with it to get
|
|
|
9119d9 |
the virDomainObjPtr lock back, otherwise we might be accessing
|
|
|
9119d9 |
vm->def while it's being cleaned up by qemuProcessStop.
|
|
|
9119d9 |
|
|
|
9119d9 |
If the domain crashed while we were in the monitor, exit
|
|
|
9119d9 |
early instead of changing vm->def which is now the persistent
|
|
|
9119d9 |
definition.
|
|
|
9119d9 |
|
|
|
9119d9 |
(cherry picked from commit 051add2ff90f7b7f821e274fd318e1d845144157)
|
|
|
9119d9 |
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
|
|
9119d9 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
9119d9 |
---
|
|
|
9119d9 |
src/qemu/qemu_driver.c | 14 ++++++++++----
|
|
|
9119d9 |
1 file changed, 10 insertions(+), 4 deletions(-)
|
|
|
9119d9 |
|
|
|
9119d9 |
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
|
9119d9 |
index a62e429..97d850b 100644
|
|
|
9119d9 |
--- a/src/qemu/qemu_driver.c
|
|
|
9119d9 |
+++ b/src/qemu/qemu_driver.c
|
|
|
9119d9 |
@@ -4462,7 +4462,7 @@ static int qemuDomainHotplugVcpus(virQEMUDriverPtr driver,
|
|
|
9119d9 |
if (rc == 0)
|
|
|
9119d9 |
goto unsupported;
|
|
|
9119d9 |
if (rc < 0)
|
|
|
9119d9 |
- goto cleanup;
|
|
|
9119d9 |
+ goto exit_monitor;
|
|
|
9119d9 |
|
|
|
9119d9 |
vcpus++;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
@@ -4473,7 +4473,7 @@ static int qemuDomainHotplugVcpus(virQEMUDriverPtr driver,
|
|
|
9119d9 |
if (rc == 0)
|
|
|
9119d9 |
goto unsupported;
|
|
|
9119d9 |
if (rc < 0)
|
|
|
9119d9 |
- goto cleanup;
|
|
|
9119d9 |
+ goto exit_monitor;
|
|
|
9119d9 |
|
|
|
9119d9 |
vcpus--;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
@@ -4490,6 +4490,10 @@ static int qemuDomainHotplugVcpus(virQEMUDriverPtr driver,
|
|
|
9119d9 |
* fatal */
|
|
|
9119d9 |
if ((ncpupids = qemuMonitorGetCPUInfo(priv->mon, &cpupids)) <= 0) {
|
|
|
9119d9 |
virResetLastError();
|
|
|
9119d9 |
+ goto exit_monitor;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ if (qemuDomainObjExitMonitor(driver, vm) < 0) {
|
|
|
9119d9 |
+ ret = -1;
|
|
|
9119d9 |
goto cleanup;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
|
|
|
9119d9 |
@@ -4610,10 +4614,10 @@ static int qemuDomainHotplugVcpus(virQEMUDriverPtr driver,
|
|
|
9119d9 |
cpupids = NULL;
|
|
|
9119d9 |
|
|
|
9119d9 |
cleanup:
|
|
|
9119d9 |
- qemuDomainObjExitMonitor(driver, vm);
|
|
|
9119d9 |
- vm->def->vcpus = vcpus;
|
|
|
9119d9 |
VIR_FREE(cpupids);
|
|
|
9119d9 |
VIR_FREE(mem_mask);
|
|
|
9119d9 |
+ if (virDomainObjIsActive(vm))
|
|
|
9119d9 |
+ vm->def->vcpus = vcpus;
|
|
|
9119d9 |
virDomainAuditVcpu(vm, oldvcpus, nvcpus, "update", rc == 1);
|
|
|
9119d9 |
if (cgroup_vcpu)
|
|
|
9119d9 |
virCgroupFree(&cgroup_vcpu);
|
|
|
9119d9 |
@@ -4622,6 +4626,8 @@ static int qemuDomainHotplugVcpus(virQEMUDriverPtr driver,
|
|
|
9119d9 |
unsupported:
|
|
|
9119d9 |
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
|
|
9119d9 |
_("cannot change vcpu count of this domain"));
|
|
|
9119d9 |
+ exit_monitor:
|
|
|
9119d9 |
+ ignore_value(qemuDomainObjExitMonitor(driver, vm));
|
|
|
9119d9 |
goto cleanup;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
|
|
|
9119d9 |
--
|
|
|
9119d9 |
2.2.1
|
|
|
9119d9 |
|