
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