|
|
6ae9ed |
From 285de183e4643a0173405bce5ae0703bbf61df08 Mon Sep 17 00:00:00 2001
|
|
|
6ae9ed |
Message-Id: <285de183e4643a0173405bce5ae0703bbf61df08@dist-git>
|
|
|
6ae9ed |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
6ae9ed |
Date: Wed, 24 Aug 2016 16:11:31 -0400
|
|
|
6ae9ed |
Subject: [PATCH] qemu: domain: Prepare for VCPUs vanishing while libvirt is
|
|
|
6ae9ed |
not running
|
|
|
6ae9ed |
|
|
|
6ae9ed |
https://bugzilla.redhat.com/show_bug.cgi?id=1097930
|
|
|
6ae9ed |
https://bugzilla.redhat.com/show_bug.cgi?id=1224341
|
|
|
6ae9ed |
|
|
|
6ae9ed |
Similarly to devices the guest may allow unplug of the VCPU if libvirt
|
|
|
6ae9ed |
is down. To avoid problems, refresh the vcpu state on reconnect. Don't
|
|
|
6ae9ed |
mess with the vcpu state otherwise.
|
|
|
6ae9ed |
|
|
|
6ae9ed |
(cherry picked from commit 133be0a9e27dc28dacba4b651b8633f1a85eead9)
|
|
|
6ae9ed |
---
|
|
|
6ae9ed |
src/qemu/qemu_domain.c | 9 ++++++++-
|
|
|
6ae9ed |
src/qemu/qemu_domain.h | 3 ++-
|
|
|
6ae9ed |
src/qemu/qemu_driver.c | 4 ++--
|
|
|
6ae9ed |
src/qemu/qemu_process.c | 7 +++++--
|
|
|
6ae9ed |
4 files changed, 17 insertions(+), 6 deletions(-)
|
|
|
6ae9ed |
|
|
|
6ae9ed |
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
|
|
6ae9ed |
index 259fd79..add8379 100644
|
|
|
6ae9ed |
--- a/src/qemu/qemu_domain.c
|
|
|
6ae9ed |
+++ b/src/qemu/qemu_domain.c
|
|
|
6ae9ed |
@@ -5714,16 +5714,20 @@ qemuDomainSupportsNewVcpuHotplug(virDomainObjPtr vm)
|
|
|
6ae9ed |
* @driver: qemu driver data
|
|
|
6ae9ed |
* @vm: domain object
|
|
|
6ae9ed |
* @asyncJob: current asynchronous job type
|
|
|
6ae9ed |
+ * @state: refresh vcpu state
|
|
|
6ae9ed |
*
|
|
|
6ae9ed |
* Updates vCPU information private data of @vm. Due to historical reasons this
|
|
|
6ae9ed |
* function returns success even if some data were not reported by qemu.
|
|
|
6ae9ed |
*
|
|
|
6ae9ed |
+ * If @state is true, the vcpu state is refreshed as reported by the monitor.
|
|
|
6ae9ed |
+ *
|
|
|
6ae9ed |
* Returns 0 on success and -1 on fatal error.
|
|
|
6ae9ed |
*/
|
|
|
6ae9ed |
int
|
|
|
6ae9ed |
qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver,
|
|
|
6ae9ed |
virDomainObjPtr vm,
|
|
|
6ae9ed |
- int asyncJob)
|
|
|
6ae9ed |
+ int asyncJob,
|
|
|
6ae9ed |
+ bool state)
|
|
|
6ae9ed |
{
|
|
|
6ae9ed |
virDomainVcpuDefPtr vcpu;
|
|
|
6ae9ed |
qemuDomainVcpuPrivatePtr vcpupriv;
|
|
|
6ae9ed |
@@ -5791,6 +5795,9 @@ qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver,
|
|
|
6ae9ed |
VIR_FREE(vcpupriv->alias);
|
|
|
6ae9ed |
VIR_STEAL_PTR(vcpupriv->alias, info[i].alias);
|
|
|
6ae9ed |
vcpupriv->enable_id = info[i].id;
|
|
|
6ae9ed |
+
|
|
|
6ae9ed |
+ if (hotplug && state)
|
|
|
6ae9ed |
+ vcpu->online = !!info[i].qom_path;
|
|
|
6ae9ed |
}
|
|
|
6ae9ed |
|
|
|
6ae9ed |
ret = 0;
|
|
|
6ae9ed |
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
|
|
|
6ae9ed |
index c3ae169..76b6904 100644
|
|
|
6ae9ed |
--- a/src/qemu/qemu_domain.h
|
|
|
6ae9ed |
+++ b/src/qemu/qemu_domain.h
|
|
|
6ae9ed |
@@ -662,7 +662,8 @@ pid_t qemuDomainGetVcpuPid(virDomainObjPtr vm, unsigned int vcpuid);
|
|
|
6ae9ed |
int qemuDomainValidateVcpuInfo(virDomainObjPtr vm);
|
|
|
6ae9ed |
int qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver,
|
|
|
6ae9ed |
virDomainObjPtr vm,
|
|
|
6ae9ed |
- int asyncJob);
|
|
|
6ae9ed |
+ int asyncJob,
|
|
|
6ae9ed |
+ bool state);
|
|
|
6ae9ed |
|
|
|
6ae9ed |
bool qemuDomainSupportsNicdev(virDomainDefPtr def,
|
|
|
6ae9ed |
virDomainNetDefPtr net);
|
|
|
6ae9ed |
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
|
6ae9ed |
index 1b433f8..35ed8ec 100644
|
|
|
6ae9ed |
--- a/src/qemu/qemu_driver.c
|
|
|
6ae9ed |
+++ b/src/qemu/qemu_driver.c
|
|
|
6ae9ed |
@@ -4646,7 +4646,7 @@ qemuDomainHotplugAddVcpu(virQEMUDriverPtr driver,
|
|
|
6ae9ed |
|
|
|
6ae9ed |
vcpuinfo->online = true;
|
|
|
6ae9ed |
|
|
|
6ae9ed |
- if (qemuDomainRefreshVcpuInfo(driver, vm, QEMU_ASYNC_JOB_NONE) < 0)
|
|
|
6ae9ed |
+ if (qemuDomainRefreshVcpuInfo(driver, vm, QEMU_ASYNC_JOB_NONE, false) < 0)
|
|
|
6ae9ed |
goto cleanup;
|
|
|
6ae9ed |
|
|
|
6ae9ed |
if (qemuDomainValidateVcpuInfo(vm) < 0)
|
|
|
6ae9ed |
@@ -4695,7 +4695,7 @@ qemuDomainHotplugDelVcpu(virQEMUDriverPtr driver,
|
|
|
6ae9ed |
goto cleanup;
|
|
|
6ae9ed |
}
|
|
|
6ae9ed |
|
|
|
6ae9ed |
- if (qemuDomainRefreshVcpuInfo(driver, vm, QEMU_ASYNC_JOB_NONE) < 0)
|
|
|
6ae9ed |
+ if (qemuDomainRefreshVcpuInfo(driver, vm, QEMU_ASYNC_JOB_NONE, false) < 0)
|
|
|
6ae9ed |
goto cleanup;
|
|
|
6ae9ed |
|
|
|
6ae9ed |
if (qemuDomainValidateVcpuInfo(vm) < 0) {
|
|
|
6ae9ed |
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
|
|
6ae9ed |
index cdfd1e3..1726608 100644
|
|
|
6ae9ed |
--- a/src/qemu/qemu_process.c
|
|
|
6ae9ed |
+++ b/src/qemu/qemu_process.c
|
|
|
6ae9ed |
@@ -3353,6 +3353,9 @@ qemuProcessReconnect(void *opaque)
|
|
|
6ae9ed |
ignore_value(virSecurityManagerCheckAllLabel(driver->securityManager,
|
|
|
6ae9ed |
obj->def));
|
|
|
6ae9ed |
|
|
|
6ae9ed |
+ if (qemuDomainRefreshVcpuInfo(driver, obj, QEMU_ASYNC_JOB_NONE, true) < 0)
|
|
|
6ae9ed |
+ goto error;
|
|
|
6ae9ed |
+
|
|
|
6ae9ed |
if (virSecurityManagerReserveLabel(driver->securityManager, obj->def, obj->pid) < 0)
|
|
|
6ae9ed |
goto error;
|
|
|
6ae9ed |
|
|
|
6ae9ed |
@@ -5193,7 +5196,7 @@ qemuProcessLaunch(virConnectPtr conn,
|
|
|
6ae9ed |
goto cleanup;
|
|
|
6ae9ed |
|
|
|
6ae9ed |
VIR_DEBUG("Refreshing VCPU info");
|
|
|
6ae9ed |
- if (qemuDomainRefreshVcpuInfo(driver, vm, asyncJob) < 0)
|
|
|
6ae9ed |
+ if (qemuDomainRefreshVcpuInfo(driver, vm, asyncJob, false) < 0)
|
|
|
6ae9ed |
goto cleanup;
|
|
|
6ae9ed |
|
|
|
6ae9ed |
if (qemuDomainValidateVcpuInfo(vm) < 0)
|
|
|
6ae9ed |
@@ -5990,7 +5993,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|
|
6ae9ed |
}
|
|
|
6ae9ed |
|
|
|
6ae9ed |
VIR_DEBUG("Detecting VCPU PIDs");
|
|
|
6ae9ed |
- if (qemuDomainRefreshVcpuInfo(driver, vm, QEMU_ASYNC_JOB_NONE) < 0)
|
|
|
6ae9ed |
+ if (qemuDomainRefreshVcpuInfo(driver, vm, QEMU_ASYNC_JOB_NONE, false) < 0)
|
|
|
6ae9ed |
goto error;
|
|
|
6ae9ed |
|
|
|
6ae9ed |
if (qemuDomainValidateVcpuInfo(vm) < 0)
|
|
|
6ae9ed |
--
|
|
|
6ae9ed |
2.10.0
|
|
|
6ae9ed |
|