[libvirt] [PATCH] virsh-domain: Mark --live and --config mutually exclusive in vcpucount

Eric Blake eblake at redhat.com
Fri Nov 8 18:11:10 UTC 2013


On 11/07/2013 03:18 AM, Peter Krempa wrote:
> (cc'd Eric as a gentle ping)

Thanks.

>>>> I seem to recall specifically allowing '--live --config' as a way of
>>>> requesting multiple values in one command call (similar to how vcpucount
>>>> with no flags grabs every possible value).  I need to think about this
>>>> more, and double check historical behavior, to make sure we aren't
>>>> adding a regression.  Please hold off until after 1.1.4 for this one
>>>> (and ping me if I haven't responded with more details in a week, since
>>>> I'm currently busy on another patch).
>>
>> Any thoughts now that the release is out?

Let's look at the logic in an older version:

git show v0.9.0:tools/virsh.c

cmdVcpucount supported only --maximum, --current, --config, and --live,
with mutual exclusion for maximum/current, config/live, and then a check
that either no flags were present or else exactly 2 flags were present.
 (Weird, but that's what it was).  Thus, the valid call modes were:

vcpucount $dom => show four lines for all 4 combinations (with an error
message in place of a line for settings not possible, such as the config
lines on a transient domain)
vcpucount $dom --maximum --config => show one line
vcpucount $dom --maximum --live => show one line
vcpucount $dom --current --config => show one line
vcpucount $dom --current --live => show one line
all other combinations => error

0.9.4 changed things by adding --active and repurposing --config so that
it allowed back-compat use while also being more consistent with other
--live/--config/--current three-way choices.

>>
>>>
>>> If you look closely at the code, you'll see that there's no option to
>>> request multiple values other than not specifying any option when a
>>> table of the cpus is printed.

Indeed.  This is still true even in the 1.1.4 release, even where we
added --active and repurposed --current.

Okay, I've now played with your patch installed, and verified that the
pre-0.9.4 back-compat options that are supposed to work still do.  We no
longer reject attempts to use just one flag (vcpucount test --live is
now shorthand for vcpucount test --live --active); but that's not the
fault of this patch.  So it looks like all you really do is reject a
three-option combination, which matches our documentation that you
either omit all flags to get all lines printed, or specify at most 2
flags to print a specific line.

ACK.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20131108/5d7a4de4/attachment-0001.sig>


More information about the libvir-list mailing list