Bug 1300947

Summary: engine-backup user experience need to be improved
Product: [oVirt] ovirt-engine Reporter: Sandro Bonazzola <sbonazzo>
Component: Backup-Restore.EngineAssignee: Yedidyah Bar David <didi>
Status: CLOSED CURRENTRELEASE QA Contact: Aleksei Slaikovskii <aslaikov>
Severity: medium Docs Contact:
Priority: low    
Version: 3.6.2.6CC: bugs, fabrice.bacchella, lsvaty, michal.skrivanek, pstehlik, sbonazzo, ylavi
Target Milestone: ovirt-4.1.0-alphaKeywords: Improvement
Target Release: 4.1.0.2Flags: rule-engine: ovirt-4.1+
lsvaty: testing_plan_complete-
rule-engine: planning_ack+
sbonazzo: devel_ack+
pstehlik: testing_ack+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-01 14:44:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Integration RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1329323    

Description Sandro Bonazzola 2016-01-22 07:51:03 UTC
Description of problem:
engine-backup user experience need to be improved:
[root@ovirt ~]# engine-backup 
FATAL: --mode=<backup|restore> is missing
[root@ovirt ~]# engine-backup --mode=backup
FATAL: --file is missing
readlink: missing operand
Try 'readlink --help' for more information.
/usr/bin/engine-backup: line 1405: : No such file or directory
Notifying engine
/usr/bin/engine-backup: line 1472: : No such file or directory
/usr/bin/engine-backup: line 1405: : No such file or directory
FATAL: Failed notifying engine


I would expect to have the output of --help if any of the required options is missing.

Looking at engine-backup --help:

/usr/bin/engine-backup [--mode=MODE] [--scope=SCOPE] [--file=FILE] [--log=FILE]

looks like all the parameters are optional but all of them are required for engine-backup to work:


[root@ovirt ~]# engine-backup 
FATAL: --mode=<backup|restore> is missing

# engine-backup --mode=backup --scope=all
FATAL: --file is missing
readlink: missing operand
Try 'readlink --help' for more information.
/usr/bin/engine-backup: line 1405: : No such file or directory
Notifying engine
/usr/bin/engine-backup: line 1472: : No such file or directory
/usr/bin/engine-backup: line 1405: : No such file or directory
FATAL: Failed notifying engine


[root@ovirt ~]# engine-backup --mode=backup --scope=all --file=backup
FATAL: --log is missing
readlink: missing operand
Try 'readlink --help' for more information.
/usr/bin/engine-backup: line 1405: : No such file or directory
Notifying engine
/usr/bin/engine-backup: line 1472: : No such file or directory
/usr/bin/engine-backup: line 1405: : No such file or directory
FATAL: Failed notifying engine


[root@ovirt ~]# engine-backup --mode=backup --scope=all --file=backup --log=log
Backing up:
Notifying engine
- Files
- Engine database 'engine'
Packing into file 'backup'
Notifying engine
Done.

Comment 1 Yedidyah Bar David 2016-01-24 07:06:00 UTC
Much of the noise is already fixed by bug 1296520.

Not sure I agree with showing --help on errors. It's very long, and distracts from the actual error. Perhaps add 'Please see --help' or something.

It might make sense to have more options, or even all of them, have defaults. Say,

--file /var/lib/ovirt-engine/engine-backup/engine-backup-TIMESTAMP.RANDOM.bck
(or maintain a list of file extension per --archive-compressor and use .tar.EXT instead of .bck)

--log /var/log/ovirt-engine/engine-backup/engine-backup-TIMESTAMP.RANDOM.log

--mode backup?
not sure about that one. Most similar programs require passing such an option (either as an option (tar) or as part of the name (zip/unzip)).

IIRC this was discussed in the past, not sure about the outcome.

Also, this is the behavior since the first version (in 3.3), not sure what's urgent to include it in 3.6. If we do want to, consider also bug 1296520 (which is for 4.0 currently).

Comment 2 Yedidyah Bar David 2016-01-24 09:20:18 UTC
(In reply to Yedidyah Bar David from comment #1)
> --mode backup?
> not sure about that one. Most similar programs require passing such an
> option (either as an option (tar) or as part of the name (zip/unzip)).

We can also add a wrapper engine-restore that runs engine-backup --mode=restore.
If we go that route (of requiring as few options as possible).

Comment 3 Sandro Bonazzola 2016-02-05 06:36:42 UTC
I'm fine with just telling to look at --help instead of printing it. 
Ok to re-target to 4.0 not being urgent.
It make sense to use a default for --log making it optional.
Everything else may stay as it is right now, just making clear in the --help what's not optional, changing
/usr/bin/engine-backup [--mode=MODE] [--scope=SCOPE] [--file=FILE] [--log=FILE]
to
/usr/bin/engine-backup --mode=MODE --scope=SCOPE --file=FILE [--log=FILE]

(see https://en.wikipedia.org/wiki/Usage_message#Examples on optional and required arguments)

Comment 4 Sandro Bonazzola 2016-04-27 07:52:16 UTC
*** Bug 1329383 has been marked as a duplicate of this bug. ***

Comment 5 Yedidyah Bar David 2016-05-29 13:01:02 UTC
*** Bug 1340419 has been marked as a duplicate of this bug. ***

Comment 6 Yedidyah Bar David 2016-05-29 13:04:24 UTC
Decided to just fix the usage text for now.

As mentioned, most noise was already fixed by bug 1296520.

While I would personally prefer to have defaults for most everything, I can anticipate endless arguments/bugs/reports for whatever choice we make (hard-coded directories, current directory, etc), so would ignore this for now.

Comment 7 Sandro Bonazzola 2016-12-12 14:03:21 UTC
The fix for this issue should be included in oVirt 4.1.0 beta 1 released on December 1st. If not included please move back to modified.

Comment 8 Aleksei Slaikovskii 2016-12-16 10:51:11 UTC
This wont be automated, basic sanity will be sufficient for verification process.

$ engine-backup --help
engine-backup: back up and restore ovirt-engine environment
USAGE:
    /usr/bin/engine-backup --mode=MODE --scope=SCOPE --file=FILE --log=FILE [options]
...