[libvirt] [PATCH 8/8] virsh-domain: Simplify usage of --current, --live and --config flags
Eric Blake
eblake at redhat.com
Thu Mar 21 03:59:11 UTC 2013
On 03/07/2013 05:53 AM, Peter Krempa wrote:
> This patch uses the new helper to avoid the more complex check for
> domain state modification flags.
> ---
> tools/virsh-domain.c | 260 ++++++++++++++++++++++-----------------------------
> 1 file changed, 111 insertions(+), 149 deletions(-)
>
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index 8dad85d..4c00db3 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -1068,18 +1068,15 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
> bool live = vshCommandOptBool(cmd, "live");
> bool ret = false;
>
> - if (current) {
> - if (live || config) {
> - vshError(ctl, "%s", _("--current must be specified exclusively"));
> - return false;
> - }
> + VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
> + VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
> +
> + if (current)
> flags = VIR_DOMAIN_AFFECT_CURRENT;
We already know that VIR_DOMAIN_AFFECT_CURRENT == 0; if flags was
pre-initialized to 0, this assignment is redundant. But I guess it
doesn't hurt.
> + /* neither option is specified */
> + if (!current && !live && !config && !maximum)
Generally, 'neither option' implies a choice between 2, but here you are
choosing between 4. A better wording might be 'no options were specified'.
As my complaints don't affect correctness of your patch as-is,
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/20130320/a9ab2390/attachment-0001.sig>
More information about the libvir-list
mailing list