|
|
3e5111 |
From 1cf501e2f4cb1e6840ddb8a8f7b051936f0f8b18 Mon Sep 17 00:00:00 2001
|
|
|
3e5111 |
Message-Id: <1cf501e2f4cb1e6840ddb8a8f7b051936f0f8b18@dist-git>
|
|
|
3e5111 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
3e5111 |
Date: Thu, 20 Apr 2017 11:33:10 +0200
|
|
|
3e5111 |
Subject: [PATCH] qemu: hotplug: Don't save status XML when monitor is closed
|
|
|
3e5111 |
|
|
|
3e5111 |
In the vcpu hotplug code if exit from the monitor failed we would still
|
|
|
3e5111 |
attempt to save the status XML. When the daemon is terminated the
|
|
|
3e5111 |
monitor socket is closed. In such case, the written status XML would not
|
|
|
3e5111 |
contain the monitor path and thus be invalid.
|
|
|
3e5111 |
|
|
|
3e5111 |
Avoid this issue by only saving status XML on success of the monitor
|
|
|
3e5111 |
command.
|
|
|
3e5111 |
|
|
|
3e5111 |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1439452
|
|
|
3e5111 |
(cherry picked from commit 355f5ab998994d40e011cec491483506bbefe04f)
|
|
|
3e5111 |
---
|
|
|
3e5111 |
src/qemu/qemu_hotplug.c | 29 ++++++++++++++++-------------
|
|
|
3e5111 |
1 file changed, 16 insertions(+), 13 deletions(-)
|
|
|
3e5111 |
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
|
|
|
3e5111 |
index 79d0dc94e..120bcdc62 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_hotplug.c
|
|
|
3e5111 |
+++ b/src/qemu/qemu_hotplug.c
|
|
|
3e5111 |
@@ -5386,6 +5386,7 @@ qemuDomainRemoveVcpuAlias(virQEMUDriverPtr driver,
|
|
|
3e5111 |
|
|
|
3e5111 |
static int
|
|
|
3e5111 |
qemuDomainHotplugDelVcpu(virQEMUDriverPtr driver,
|
|
|
3e5111 |
+ virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
virDomainObjPtr vm,
|
|
|
3e5111 |
unsigned int vcpu)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
@@ -5427,6 +5428,11 @@ qemuDomainHotplugDelVcpu(virQEMUDriverPtr driver,
|
|
|
3e5111 |
if (qemuDomainRemoveVcpu(driver, vm, vcpu) < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
|
|
|
3e5111 |
+ qemuDomainVcpuPersistOrder(vm->def);
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
|
|
|
3e5111 |
+ goto cleanup;
|
|
|
3e5111 |
+
|
|
|
3e5111 |
ret = 0;
|
|
|
3e5111 |
|
|
|
3e5111 |
cleanup:
|
|
|
3e5111 |
@@ -5437,6 +5443,7 @@ qemuDomainHotplugDelVcpu(virQEMUDriverPtr driver,
|
|
|
3e5111 |
|
|
|
3e5111 |
static int
|
|
|
3e5111 |
qemuDomainHotplugAddVcpu(virQEMUDriverPtr driver,
|
|
|
3e5111 |
+ virQEMUDriverConfigPtr cfg,
|
|
|
3e5111 |
virDomainObjPtr vm,
|
|
|
3e5111 |
unsigned int vcpu)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
@@ -5497,6 +5504,11 @@ qemuDomainHotplugAddVcpu(virQEMUDriverPtr driver,
|
|
|
3e5111 |
if (qemuDomainValidateVcpuInfo(vm) < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
|
|
|
3e5111 |
+ qemuDomainVcpuPersistOrder(vm->def);
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
|
|
|
3e5111 |
+ goto cleanup;
|
|
|
3e5111 |
+
|
|
|
3e5111 |
ret = 0;
|
|
|
3e5111 |
|
|
|
3e5111 |
cleanup:
|
|
|
3e5111 |
@@ -5611,7 +5623,6 @@ qemuDomainSetVcpusLive(virQEMUDriverPtr driver,
|
|
|
3e5111 |
qemuDomainObjPrivatePtr priv = vm->privateData;
|
|
|
3e5111 |
qemuCgroupEmulatorAllNodesDataPtr emulatorCgroup = NULL;
|
|
|
3e5111 |
ssize_t nextvcpu = -1;
|
|
|
3e5111 |
- int rc = 0;
|
|
|
3e5111 |
int ret = -1;
|
|
|
3e5111 |
|
|
|
3e5111 |
if (qemuCgroupEmulatorAllNodesAllow(priv->cgroup, &emulatorCgroup) < 0)
|
|
|
3e5111 |
@@ -5619,27 +5630,19 @@ qemuDomainSetVcpusLive(virQEMUDriverPtr driver,
|
|
|
3e5111 |
|
|
|
3e5111 |
if (enable) {
|
|
|
3e5111 |
while ((nextvcpu = virBitmapNextSetBit(vcpumap, nextvcpu)) != -1) {
|
|
|
3e5111 |
- if ((rc = qemuDomainHotplugAddVcpu(driver, vm, nextvcpu)) < 0)
|
|
|
3e5111 |
- break;
|
|
|
3e5111 |
+ if (qemuDomainHotplugAddVcpu(driver, cfg, vm, nextvcpu) < 0)
|
|
|
3e5111 |
+ goto cleanup;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
} else {
|
|
|
3e5111 |
for (nextvcpu = virDomainDefGetVcpusMax(vm->def) - 1; nextvcpu >= 0; nextvcpu--) {
|
|
|
3e5111 |
if (!virBitmapIsBitSet(vcpumap, nextvcpu))
|
|
|
3e5111 |
continue;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if ((rc = qemuDomainHotplugDelVcpu(driver, vm, nextvcpu)) < 0)
|
|
|
3e5111 |
- break;
|
|
|
3e5111 |
+ if (qemuDomainHotplugDelVcpu(driver, cfg, vm, nextvcpu) < 0)
|
|
|
3e5111 |
+ goto cleanup;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
- qemuDomainVcpuPersistOrder(vm->def);
|
|
|
3e5111 |
-
|
|
|
3e5111 |
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
|
|
|
3e5111 |
- goto cleanup;
|
|
|
3e5111 |
-
|
|
|
3e5111 |
- if (rc < 0)
|
|
|
3e5111 |
- goto cleanup;
|
|
|
3e5111 |
-
|
|
|
3e5111 |
ret = 0;
|
|
|
3e5111 |
|
|
|
3e5111 |
cleanup:
|
|
|
3e5111 |
--
|
|
|
3e5111 |
2.12.2
|
|
|
3e5111 |
|