Re: [PATCH 4/6] qemu: check if domain is really active when do setvcpus with --live

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 03/24/2015 05:31 PM, Pavel Hrdina wrote:
On Tue, Mar 24, 2015 at 02:27:42PM +0800, lhuang wrote:
On 03/20/2015 10:39 PM, Pavel Hrdina wrote:
From: Luyao Huang <lhuang@xxxxxxxxxx>

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.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1204006

Signed-off-by: Luyao Huang <lhuang@xxxxxxxxxx>
Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
   src/qemu/qemu_driver.c | 14 ++++++++------
   1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 4942712..c4d96bd 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4881,6 +4881,14 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
       if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
           goto cleanup;
+ if (flags & VIR_DOMAIN_AFFECT_LIVE) {
+        if (!virDomainObjIsActive(vm)) {
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                           _("domain is not running"));
+            goto endjob;
+        }
+    }
+
       if (flags & VIR_DOMAIN_AFFECT_LIVE && !(flags & VIR_DOMAIN_VCPU_GUEST)) {
           if (virCgroupNewEmulator(priv->cgroup, false, &cgroup_temp) < 0)
               goto endjob;
@@ -4947,12 +4955,6 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
           if (ncpuinfo < 0)
               goto endjob;
- if (!virDomainObjIsActive(vm)) {
-            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
-                           _("domain is not running"));
-            goto endjob;
-        }
-
           if (qemuAgentUpdateCPUInfo(nvcpus, cpuinfo, ncpuinfo) < 0)
               goto endjob;
Sorry, i forgot there is a function virDomainLiveConfigHelperMethod(),
move this function just after qemuDomainObjBeginJob() maybe a good way
to fix this issue. Also virDomainLiveConfigHelperMethod() may change
flags, so it should be done more early (as soon as possible after set a
lock to vm).
I've already sent a patch 7/6 to move that function.  I realized that right
after I've sent this series to mailing list.


Pavel

Okay, I think i missed patch 7/6 when i looked these patches :)

Thanks for your reply

Luyao

Luyao

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]