diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2022-01-19 12:54:23 +0100 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2022-01-19 16:12:09 +0100 |
commit | e1b4811bc324236892e43a6bb841d6278fe1584e (patch) | |
tree | 53998bca33913299dff9eb531b3ee206490360dd | |
parent | 51a347456dead2c327a08926a7042bfa685b397c (diff) | |
download | ceph-e1b4811bc324236892e43a6bb841d6278fe1584e.tar.gz |
rbd: add missing switch arguments for recognition by get_command_spec()
Currently this
$ rbd --all children img
doesn't work, while this
$ rbd children --all img
or this
$ rbd children img --all
does. The issue is that -a/--all isn't on the list of known switch
arguments. The "rbd children" example may seem contrived but for more
complicated commands such as "rbd device map" mixing switches and
positional arguments occurs naturally:
$ rbd device --device-type nbd --options try-netlink --show-cookie map img
Fixes: https://tracker.ceph.com/issues/53935
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
-rw-r--r-- | src/tools/rbd/ArgumentTypes.h | 3 | ||||
-rw-r--r-- | src/tools/rbd/action/Children.cc | 1 | ||||
-rw-r--r-- | src/tools/rbd/action/Device.cc | 4 | ||||
-rw-r--r-- | src/tools/rbd/action/Diff.cc | 1 | ||||
-rw-r--r-- | src/tools/rbd/action/Export.cc | 1 | ||||
-rw-r--r-- | src/tools/rbd/action/Migration.cc | 2 | ||||
-rw-r--r-- | src/tools/rbd/action/Nbd.cc | 2 | ||||
-rw-r--r-- | src/tools/rbd/action/Trash.cc | 2 | ||||
-rw-r--r-- | src/tools/rbd/action/TrashPurgeSchedule.cc | 2 | ||||
-rw-r--r-- | src/tools/rbd/action/Wnbd.cc | 2 |
10 files changed, 10 insertions, 10 deletions
diff --git a/src/tools/rbd/ArgumentTypes.h b/src/tools/rbd/ArgumentTypes.h index 57473f31c65..39d374c64c3 100644 --- a/src/tools/rbd/ArgumentTypes.h +++ b/src/tools/rbd/ArgumentTypes.h @@ -87,7 +87,8 @@ static const std::string SKIP_QUIESCE("skip-quiesce"); static const std::string IGNORE_QUIESCE_ERROR("ignore-quiesce-error"); static const std::set<std::string> SWITCH_ARGUMENTS = { - WHOLE_OBJECT, NO_PROGRESS, PRETTY_FORMAT, VERBOSE, NO_ERR, SKIP_QUIESCE, + WHOLE_OBJECT, IMAGE_SHARED, IMAGE_THICK_PROVISION, IMAGE_FLATTEN, + NO_PROGRESS, PRETTY_FORMAT, VERBOSE, NO_ERR, SKIP_QUIESCE, IGNORE_QUIESCE_ERROR }; diff --git a/src/tools/rbd/action/Children.cc b/src/tools/rbd/action/Children.cc index f459e92b761..58e861b6928 100644 --- a/src/tools/rbd/action/Children.cc +++ b/src/tools/rbd/action/Children.cc @@ -157,6 +157,7 @@ int execute(const po::variables_map &vm, return 0; } +Shell::SwitchArguments switched_arguments({"all", "a", "descendants"}); Shell::Action action( {"children"}, {}, "Display children of an image or its snapshot.", "", &get_arguments, &execute); diff --git a/src/tools/rbd/action/Device.cc b/src/tools/rbd/action/Device.cc index 20cff569f9b..bfe60c273df 100644 --- a/src/tools/rbd/action/Device.cc +++ b/src/tools/rbd/action/Device.cc @@ -247,7 +247,9 @@ int execute_detach(const po::variables_map &vm, return (*get_device_operations(vm)->execute_detach)(vm, ceph_global_init_args); } -Shell::SwitchArguments switched_arguments({"read-only", "exclusive"}); +Shell::SwitchArguments switched_arguments({"exclusive", "force", "quiesce", + "read-only", "show-cookie"}); + Shell::Action action_list( {"device", "list"}, {"showmapped"}, "List mapped rbd images.", "", &get_list_arguments, &execute_list); diff --git a/src/tools/rbd/action/Diff.cc b/src/tools/rbd/action/Diff.cc index 3729469c50d..838ef6cc510 100644 --- a/src/tools/rbd/action/Diff.cc +++ b/src/tools/rbd/action/Diff.cc @@ -132,7 +132,6 @@ int execute(const po::variables_map &vm, return 0; } -Shell::SwitchArguments switched_arguments({at::WHOLE_OBJECT}); Shell::Action action( {"diff"}, {}, "Print extents that differ since a previous snap, or image creation.", "", diff --git a/src/tools/rbd/action/Export.cc b/src/tools/rbd/action/Export.cc index dff10c97e1a..ddcf0f2c30c 100644 --- a/src/tools/rbd/action/Export.cc +++ b/src/tools/rbd/action/Export.cc @@ -311,7 +311,6 @@ int execute_diff(const po::variables_map &vm, return 0; } -Shell::SwitchArguments switched_arguments({at::WHOLE_OBJECT}); Shell::Action action_diff( {"export-diff"}, {}, "Export incremental diff to file.", "", &get_arguments_diff, &execute_diff); diff --git a/src/tools/rbd/action/Migration.cc b/src/tools/rbd/action/Migration.cc index 05b15f1869c..1ce6201d964 100644 --- a/src/tools/rbd/action/Migration.cc +++ b/src/tools/rbd/action/Migration.cc @@ -406,6 +406,8 @@ int execute_commit(const po::variables_map &vm, return 0; } +Shell::SwitchArguments switched_arguments({"import-only"}); + Shell::Action action_prepare( {"migration", "prepare"}, {}, "Prepare image migration.", at::get_long_features_help(), &get_prepare_arguments, &execute_prepare); diff --git a/src/tools/rbd/action/Nbd.cc b/src/tools/rbd/action/Nbd.cc index f36537430c8..68345f43dd6 100644 --- a/src/tools/rbd/action/Nbd.cc +++ b/src/tools/rbd/action/Nbd.cc @@ -415,8 +415,6 @@ int execute_unmap_deprecated(const po::variables_map &vm, return execute_unmap(vm, ceph_global_args); } -Shell::SwitchArguments switched_arguments({"read-only", "exclusive"}); - Shell::Action action_show_deprecated( {"nbd", "list"}, {"nbd", "ls"}, "List the nbd devices already used.", "", &get_list_arguments_deprecated, &execute_list_deprecated, false); diff --git a/src/tools/rbd/action/Trash.cc b/src/tools/rbd/action/Trash.cc index cb4c8b8a93e..53831850857 100644 --- a/src/tools/rbd/action/Trash.cc +++ b/src/tools/rbd/action/Trash.cc @@ -518,7 +518,6 @@ int execute_restore(const po::variables_map &vm, return r; } - Shell::Action action_move( {"trash", "move"}, {"trash", "mv"}, "Move an image to the trash.", "", &get_move_arguments, &execute_move); @@ -531,7 +530,6 @@ Shell::Action action_purge( {"trash", "purge"}, {}, "Remove all expired images from trash.", "", &get_purge_arguments, &execute_purge); -Shell::SwitchArguments switched_arguments({"long", "l"}); Shell::Action action_list( {"trash", "list"}, {"trash", "ls"}, "List trash images.", "", &get_list_arguments, &execute_list); diff --git a/src/tools/rbd/action/TrashPurgeSchedule.cc b/src/tools/rbd/action/TrashPurgeSchedule.cc index f090754c4b9..0f92e762bc2 100644 --- a/src/tools/rbd/action/TrashPurgeSchedule.cc +++ b/src/tools/rbd/action/TrashPurgeSchedule.cc @@ -332,6 +332,8 @@ int execute_status(const po::variables_map &vm, return 0; } +Shell::SwitchArguments switched_arguments({"recursive", "R"}); + Shell::Action add_action( {"trash", "purge", "schedule", "add"}, {}, "Add trash purge schedule.", "", &get_arguments_add, &execute_add); diff --git a/src/tools/rbd/action/Wnbd.cc b/src/tools/rbd/action/Wnbd.cc index 4da6be33b5d..ae40fe538e3 100644 --- a/src/tools/rbd/action/Wnbd.cc +++ b/src/tools/rbd/action/Wnbd.cc @@ -224,8 +224,6 @@ int execute_detach(const po::variables_map &vm, return -EOPNOTSUPP; } -Shell::SwitchArguments switched_arguments({"read-only", "exclusive"}); - } // namespace wnbd } // namespace action } // namespace rbd |