Bug 1508544

Summary: vdo cli allows all options for all commands
Product: Red Hat Enterprise Linux 7 Reporter: Jakub Krysl <jkrysl>
Component: vdoAssignee: Joe Shimkus <jshimkus>
Status: CLOSED ERRATA QA Contact: Jakub Krysl <jkrysl>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.5CC: awalsh, bjohnsto, jkrysl, jshimkus, limershe
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 6.1.0.75 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 15:46:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jakub Krysl 2017-11-01 16:01:33 UTC
Description of problem:
VDO manpage and help allow only certain options for certain commands. For example "vdo start" has only single command specific option "--forceRebuild". But there is no warning/error when any other options are used and the command succeeds. So for example this is allowed:
# vdo start --name vdo --writePolicy "async"
The write policy option is completely ignored, so the command is exactly the same as
# vdo start --name vdo

I could not find a single command that would produced warning like "Option X not allowed for command Y"

Note: The reasoning behind this bug is to avoid confusion on user side: "I used the option but it does not work!"

Version-Release number of selected component (if applicable):
6.1.0.0.6

How reproducible:
100%

Steps to Reproduce:
1. Check vdo manpage / vdo --help
2. Run command with options that should not be allowed

Actual results:
Command runs successfully ignoring options that are not allowed

Expected results:
Warning used option is not allowed for used command

Additional info:

Comment 4 Joe Shimkus 2017-12-04 17:25:35 UTC
Note that the resolution to this issue involves the discussed switch to using python's argparse library and, as such, changes the operation of the vdo command so that the operation to perform must be the first thing specified; e.g.,

> vdo list --verbose

and not:

> vdo --verbose list

Comment 5 Louis Imershein 2017-12-05 22:37:19 UTC
I will note that this is generally the way we document the commands to behave anyway.  If we were saying it was flipping to the opposite behavior, i would be far more concerned!

Comment 7 Joe Shimkus 2017-12-11 17:04:36 UTC
There are some python exceptions raised during option checking that end up resulting in a python stack trace.  This has been corrected in a subsequent change and will be included in 6.1.0.95 or later.

Comment 8 Jakub Krysl 2017-12-15 13:26:24 UTC
Now if the vdo is given invalid option otherwise valid with other command, this option is not allowed anymore:

# vdo start --name vdo --writePolicy=sync
usage: vdo [-h]

           {activate,changeWritePolicy,create,deactivate,disableCompression,disableDeduplication,enableCompression,enableDeduplication,growLogical,growPhysical,list,modify,printConfigFile,remove,start,status,stop}
           ...
vdo: error: unrecognized arguments: --writePolicy=sync

The listing of commands is subject of another BZ 1525560 and is already getting fixed.

Comment 11 errata-xmlrpc 2018-04-10 15:46:34 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2018:0871