On 07/25/2011 03:33 PM, Laine Stump wrote:
On 07/18/2011 06:12 PM, Eric Blake wrote:
> Rename the existing --current flag to the new name --active,
> while adding a new flag --current to expose the new
> VIR_DOMAIN_AFFECT_CURRENT flag of virDomainGetVcpusFlags.
>
> For backwards compability, the output does not change (even
> though the label "current" no longer matches the spelling of
> the option that would trigger that number in isolation), and
> we accept "--current --live" as an undocumented synonym for
> "--active --live" to avoid breaking any existing clients.
>
> * tools/virsh.c (cmdVcpucount): Add --active flag, and rearrange
> existing flag handling to expose VIR_DOMAIN_AFFECT_CURRENT support.
> * tools/virsh.pod (vcpucount): Document this.
> ---
>
> Incorporating my proposal from:
>
https://www.redhat.com/archives/libvir-list/2011-July/msg01099.html
ACK.
Pushed with one fix that I noticed in re-reading the patch:
/* In all cases, try the new API first; if it fails because we
are
- * talking to an older client, try a fallback API before giving
- * up. */
+ * talking to an older client, generally we try a fallback API
+ * before giving up. --current requires the new API, since we
+ * don't know whether the domain is running or inactive. */
+ if (active) {
+ count = virDomainGetVcpusFlags(dom,
+ maximum ?
VIR_DOMAIN_VCPU_MAXIMUM : 0);
This line should have read "if (current)", not "if (active)".
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org