https://bugzilla.redhat.com/show_bug.cgi?id=1204006
Commit e105dc9 fix setting vcpus for offline domain, but forget check
if vm is active when pass VIR_DOMAIN_AFFECT_LIVE flags.
# virsh setvcpus test3 4 --live
error: Failed to create controller cpu for group: No such file or directory
add a check if we pass VIR_DOMAIN_AFFECT_LIVE flags.
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
src/qemu/qemu_driver.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 6d9217b..40d2776 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4888,6 +4888,12 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
goto cleanup;
if (flags & VIR_DOMAIN_AFFECT_LIVE && !(flags &
VIR_DOMAIN_VCPU_GUEST)) {
+ if (!virDomainObjIsActive(vm)) {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("domain is not running"));
+ goto endjob;
+ }
+
if (virCgroupNewEmulator(priv->cgroup, false, &cgroup_temp) < 0)
goto endjob;
--
1.8.3.1