On 07/14/2015 10:37 AM, Michal Privoznik wrote:
There's this condition:
flags & VIR_DOMAIN_AFFECT_CURRENT && virDomainIsActive(dom)
which can never be true since VIR_DOMAIN_AFFECT_CURRENT has hardcoded
value of zero. Therefore virDomainIsActive() is a dead code. However,
the condition could make sense if it is rewritten as the following:
!(flags & VIR_DOMAIN_AFFECT_CONFIG) && virDomainIsActive(dom)
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tools/virsh-domain.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
I had seen and filtered locally but didn't send since I was working
through perhaps removing some sa_assert()'s
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index ac04ded..f7edeeb 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -6499,7 +6499,7 @@ cmdVcpuPin(vshControl *ctl, const vshCmd *cmd)
if (got_vcpu && vcpu >= ncpus) {
if (flags & VIR_DOMAIN_AFFECT_LIVE ||
- (flags & VIR_DOMAIN_AFFECT_CURRENT &&
+ (!(flags & VIR_DOMAIN_AFFECT_CONFIG) &&
virDomainIsActive(dom) == 1))
Wouldn't another option be:
(current && virDomainIsActive(dom) == 1)
Which is what I think was trying to be tested anyway
ACK to both patches in any case,
John
vshError(ctl,
_("vcpu %d is out of range of live cpu count %d"),