On Wed, Jul 27, 2016 at 18:08:29 +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 qemu > binary and to check for the host machine and arch which is what the > command intends to do anyway. > > Signed-off-by: Shivaprasad G Bhat <sbhat@xxxxxxxxxxxxxxxxxx> > --- > tools/virsh-host.c | 33 +++++++++++++++++++++++++++++---- > 1 file changed, 29 insertions(+), 4 deletions(-) > > diff --git a/tools/virsh-host.c b/tools/virsh-host.c > index 57f0c0e..cf001c6 100644 > --- a/tools/virsh-host.c > +++ b/tools/virsh-host.c > @@ -606,18 +606,43 @@ static bool > cmdMaxvcpus(vshControl *ctl, const vshCmd *cmd) > { > const char *type = NULL; > - int vcpus; > + unsigned int vcpus; > + char *caps = NULL; > + const unsigned int flags = 0; /* No flags so far */ > + xmlDocPtr xml = NULL; > + xmlXPathContextPtr ctxt = NULL; > + bool ret = false; > virshControlPtr priv = ctl->privData; > > if (vshCommandOptStringReq(ctl, cmd, "type", &type) < 0) > return false; > > - if ((vcpus = virConnectGetMaxVcpus(priv->conn, type)) < 0) > - return false; > + caps = virConnectGetDomainCapabilities(priv->conn, NULL, NULL, NULL, type, flags); > + if (!caps) { > + vshError(ctl, "%s", _("failed to get domain capabilities")); > + goto cleanup; > + } This will break compatibility when connecting to older versions of the daemon which don't support the virConnectGetDomainCapabilities. Peter -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list