If no user is specified for "lctl changelog_deregister", usage
should be printed correctly.
Also, sanity.sh test_106e is modified to verify this fix.
Fixes:
a15eb4f13224e ("LU-13055 mdd: per-user changelog names and mask")
Signed-off-by: Emoly Liu <emoly@whamcloud.com>
Change-Id: Ia7f1b18e82f6b4174b9435cd67aba5f591d43ce1
Reviewed-on: https://review.whamcloud.com/44432
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Mike Pershin <mpershin@whamcloud.com>
Reviewed-by: James Nunez <jnunez@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
# Create a user
changelog_register || error "changelog_register failed"
- # Delete a future user (expect fail)
local MDT0=$(facet_svc $SINGLEMDS)
- do_facet $SINGLEMDS $LCTL --device $MDT0 changelog_deregister "cl77"
- local rc=$?
+ local rc
+ # No user (expect fail)
+ do_facet $SINGLEMDS $LCTL --device $MDT0 changelog_deregister
+ rc=$?
+ if [ $rc -eq 0 ]; then
+ error "Should fail without user"
+ elif [ $rc -ne 4 ]; then
+ error "changelog_deregister failed with $rc, expect 4(CMD_HELP)"
+ fi
+
+ # Delete a future user (expect fail)
+ do_facet $SINGLEMDS $LCTL --device $MDT0 changelog_deregister "cl77"
+ rc=$?
if [ $rc -eq 0 ]; then
error "Deleted non-existant user cl77"
elif [ $rc -ne 2 ]; then
if (cur_device < 0 || !device)
return CMD_HELP;
- optind = 1;
while ((c = getopt_long(argc, argv, "hu:", long_opts, NULL)) != -1) {
switch (c) {
case 'u':
}
}
- if (1 == optind) {
+ if (1 == optind && argc > 1) {
/* first check if pure ID was passed */
id = atoi(argv[optind]);
/* nameless cl<ID> format or cl<ID>-... format, only ID matters */
optind++;
}
- if (optind < argc)
+ if (optind < argc || argc == 1)
return CMD_HELP;
data.ioc_dev = cur_device;