7a3408
From aa17035794369f33a9e4c3a3c625fd65b36e3320 Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <aa17035794369f33a9e4c3a3c625fd65b36e3320@dist-git>
7a3408
From: Michal Privoznik <mprivozn@redhat.com>
7a3408
Date: Thu, 16 Jul 2015 13:45:52 +0200
7a3408
Subject: [PATCH] cmdVcpuPin: Remove dead code
7a3408
7a3408
There's this condition:
7a3408
7a3408
flags & VIR_DOMAIN_AFFECT_CURRENT && virDomainIsActive(dom)
7a3408
7a3408
which can never be true since VIR_DOMAIN_AFFECT_CURRENT has hardcoded
7a3408
value of zero. Therefore virDomainIsActive() is a dead code. However,
7a3408
the condition could make sense if it is rewritten as the following:
7a3408
7a3408
!(flags & VIR_DOMAIN_AFFECT_CONFIG) && virDomainIsActive(dom)
7a3408
7a3408
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7a3408
(cherry picked from commit 416d0e94181086e572107ab9c295b70d98f0782b)
7a3408
7a3408
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1160559
7a3408
7a3408
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 tools/virsh-domain.c | 2 +-
7a3408
 1 file changed, 1 insertion(+), 1 deletion(-)
7a3408
7a3408
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
7a3408
index ac04ded..f7edeeb 100644
7a3408
--- a/tools/virsh-domain.c
7a3408
+++ b/tools/virsh-domain.c
7a3408
@@ -6499,7 +6499,7 @@ cmdVcpuPin(vshControl *ctl, const vshCmd *cmd)
7a3408
 
7a3408
         if (got_vcpu && vcpu >= ncpus) {
7a3408
             if (flags & VIR_DOMAIN_AFFECT_LIVE ||
7a3408
-                (flags & VIR_DOMAIN_AFFECT_CURRENT &&
7a3408
+                (!(flags & VIR_DOMAIN_AFFECT_CONFIG) &&
7a3408
                  virDomainIsActive(dom) == 1))
7a3408
                 vshError(ctl,
7a3408
                          _("vcpu %d is out of range of live cpu count %d"),
7a3408
-- 
7a3408
2.5.0
7a3408