[libvirt] [PATCH 1/2] virsh: really fix the error if vcpu number exceed the guest maxvcpu number

Luyao Huang lhuang at redhat.com
Tue Jul 14 13:10:49 UTC 2015


Commit '848ab68' left a issue: when we try to get a vcpupin info with no
no flags or --current flags, we still will get the wrong error. Because
VIR_DOMAIN_AFFECT_CURRENT is 0, so this check flags & VIR_DOMAIN_AFFECT_CURRENT
will always get false.

Signed-off-by: Luyao Huang <lhuang at redhat.com>
Reported by: Peter Krempa <pkrempa at redhat.com>
---
 tools/virsh-domain.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index ac04ded..00b012b 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -6499,8 +6499,8 @@ cmdVcpuPin(vshControl *ctl, const vshCmd *cmd)
 
         if (got_vcpu && vcpu >= ncpus) {
             if (flags & VIR_DOMAIN_AFFECT_LIVE ||
-                (flags & VIR_DOMAIN_AFFECT_CURRENT &&
-                 virDomainIsActive(dom) == 1))
+                ((flags & (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG))
+                 == VIR_DOMAIN_AFFECT_CURRENT && virDomainIsActive(dom) == 1))
                 vshError(ctl,
                          _("vcpu %d is out of range of live cpu count %d"),
                          vcpu, ncpus);
-- 
1.8.3.1




More information about the libvir-list mailing list