On Wed, Sep 07, 2016 at 14:25:42 +0530, Shivaprasad G Bhat wrote:
virsh maxvcpus --type kvm output is useless on PPC. Also, in
commit e6806d79 we documented not rely on virConnectGetMaxVcpus
output. Fix the maxvcpus to use virConnectGetDomainCapabilities
now to make it useful. The call is made to use the default emulator
binary and to check for the host machine and arch which is what the
command intends to show anyway.
Signed-off-by: Shivaprasad G Bhat <sbhat(a)linux.vnet.ibm.com>
---
tools/virsh-host.c | 34 +++++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index 57f0c0e..dbdf23d 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -606,18 +606,46 @@ static bool
cmdMaxvcpus(vshControl *ctl, const vshCmd *cmd)
{
[...]
+ if (vcpus < 0)
+ goto fallback;
+
+ exit:
+ vshPrint(ctl, "%d\n", vcpus);
return true;
+ fallback:
+ if ((vcpus = virConnectGetMaxVcpus(priv->conn, type)) < 0)
+ return false;
+ goto exit;
I don't quite like this control flow. I'll respond to this with my
suggested solution.
Peter