|
|
7a3408 |
From ad9d07ce91c6c9aa2a40f744f5b0064da69e0871 Mon Sep 17 00:00:00 2001
|
|
|
7a3408 |
Message-Id: <ad9d07ce91c6c9aa2a40f744f5b0064da69e0871@dist-git>
|
|
|
7a3408 |
From: Luyao Huang <lhuang@redhat.com>
|
|
|
7a3408 |
Date: Thu, 16 Jul 2015 13:45:51 +0200
|
|
|
7a3408 |
Subject: [PATCH] virsh: report error if vcpu number exceed the guest maxvcpu
|
|
|
7a3408 |
number
|
|
|
7a3408 |
|
|
|
7a3408 |
Commit id '81dd81e' caused a regression when attempting to print a
|
|
|
7a3408 |
specific vcpuid that is out of the range of the maximum vcpus for
|
|
|
7a3408 |
the guest, such as:
|
|
|
7a3408 |
|
|
|
7a3408 |
$ virsh vcpupin $dom 1000
|
|
|
7a3408 |
VCPU: CPU Affinity
|
|
|
7a3408 |
----------------------------------
|
|
|
7a3408 |
|
|
|
7a3408 |
$
|
|
|
7a3408 |
|
|
|
7a3408 |
Rather than just recover the old message, let's adjust the message based
|
|
|
7a3408 |
on what would be displayed for a similar failure in the set path, such as:
|
|
|
7a3408 |
|
|
|
7a3408 |
$ virsh vcpupin $dom 1000
|
|
|
7a3408 |
error: vcpu 1000 is out of range of persistent cpu count 2
|
|
|
7a3408 |
|
|
|
7a3408 |
$ virsh vcpupin $dom 1000 --live
|
|
|
7a3408 |
error: vcpu 1000 is out of range of live cpu count 2
|
|
|
7a3408 |
|
|
|
7a3408 |
$
|
|
|
7a3408 |
|
|
|
7a3408 |
Signed-off-by: Luyao Huang <lhuang@redhat.com>
|
|
|
7a3408 |
(cherry picked from commit 848ab685f74afae102e265108518095942ecb293)
|
|
|
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 | 14 ++++++++++++++
|
|
|
7a3408 |
1 file changed, 14 insertions(+)
|
|
|
7a3408 |
|
|
|
7a3408 |
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
|
|
|
7a3408 |
index 27d62e9..ac04ded 100644
|
|
|
7a3408 |
--- a/tools/virsh-domain.c
|
|
|
7a3408 |
+++ b/tools/virsh-domain.c
|
|
|
7a3408 |
@@ -6497,6 +6497,20 @@ cmdVcpuPin(vshControl *ctl, const vshCmd *cmd)
|
|
|
7a3408 |
goto cleanup;
|
|
|
7a3408 |
}
|
|
|
7a3408 |
|
|
|
7a3408 |
+ if (got_vcpu && vcpu >= ncpus) {
|
|
|
7a3408 |
+ if (flags & VIR_DOMAIN_AFFECT_LIVE ||
|
|
|
7a3408 |
+ (flags & VIR_DOMAIN_AFFECT_CURRENT &&
|
|
|
7a3408 |
+ virDomainIsActive(dom) == 1))
|
|
|
7a3408 |
+ vshError(ctl,
|
|
|
7a3408 |
+ _("vcpu %d is out of range of live cpu count %d"),
|
|
|
7a3408 |
+ vcpu, ncpus);
|
|
|
7a3408 |
+ else
|
|
|
7a3408 |
+ vshError(ctl,
|
|
|
7a3408 |
+ _("vcpu %d is out of range of persistent cpu count %d"),
|
|
|
7a3408 |
+ vcpu, ncpus);
|
|
|
7a3408 |
+ goto cleanup;
|
|
|
7a3408 |
+ }
|
|
|
7a3408 |
+
|
|
|
7a3408 |
cpumaplen = VIR_CPU_MAPLEN(maxcpu);
|
|
|
7a3408 |
cpumap = vshMalloc(ctl, ncpus * cpumaplen);
|
|
|
7a3408 |
if ((ncpus = virDomainGetVcpuPinInfo(dom, ncpus, cpumap,
|
|
|
7a3408 |
--
|
|
|
7a3408 |
2.5.0
|
|
|
7a3408 |
|