]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: add missing switch arguments for recognition by get_command_spec() 44669/head
authorIlya Dryomov <idryomov@gmail.com>
Wed, 19 Jan 2022 11:54:23 +0000 (12:54 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 19 Jan 2022 15:12:09 +0000 (16:12 +0100)
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>
src/tools/rbd/ArgumentTypes.h
src/tools/rbd/action/Children.cc
src/tools/rbd/action/Device.cc
src/tools/rbd/action/Diff.cc
src/tools/rbd/action/Export.cc
src/tools/rbd/action/Migration.cc
src/tools/rbd/action/Nbd.cc
src/tools/rbd/action/Trash.cc
src/tools/rbd/action/TrashPurgeSchedule.cc
src/tools/rbd/action/Wnbd.cc

index 57473f31c6564cb455f4c18e795bafabd23a0f35..39d374c64c3cd5e2ad86e2c4b3aecc851b7b7d64 100644 (file)
@@ -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
 };
 
index f459e92b761c3a0e9b9456e3b9cdd2e28f38f356..58e861b6928bcf31f070a0a6133eb50bde649624 100644 (file)
@@ -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);
index 20cff569f9b61b94bb080690be686747224ae5e5..bfe60c273df79728b63de6fcd9d59cb05c2fa306 100644 (file)
@@ -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);
index 3729469c50dad4f0bced6b3e1919ad2a0371ee96..838ef6cc5109cf1a1a4a30730a2382e503088171 100644 (file)
@@ -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.", "",
index dff10c97e1ac6679105fc0966026972f95bd2abb..ddcf0f2c30cefe0563bcedbb83533558f1e3f6c4 100644 (file)
@@ -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);
index 05b15f1869ccad0a147402484b3fdb5ebbce5d3e..1ce6201d96489c44ce1c9356c75512412fcbbfbd 100644 (file)
@@ -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);
index f36537430c83fdb94c952fc715159c1244fa5321..68345f43dd6c5228ea635928aae2002a701d489a 100644 (file)
@@ -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);
index cb4c8b8a93e50b6ff1d51539f902a7293a900161..538318508570cd6c15831d98bb875dcb5ff58fc9 100644 (file)
@@ -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);
index f090754c4b9713e5e1d153d6426a5fdebfec78d6..0f92e762bc2fde054b36016278440de29a53dabb 100644 (file)
@@ -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);
index 4da6be33b5d5465a45d70c991b5ce8d672a6eb09..ae40fe538e3ce65b298e13ac1fc0ff73e76c7b4c 100644 (file)
@@ -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