]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: add missing switch arguments for recognition by get_command_spec() 44741/head
authorIlya Dryomov <idryomov@gmail.com>
Wed, 19 Jan 2022 11:54:23 +0000 (12:54 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Sat, 22 Jan 2022 10:10:51 +0000 (11:10 +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>
(cherry picked from commit e1b4811bc324236892e43a6bb841d6278fe1584e)

Conflicts:
src/tools/rbd/ArgumentTypes.h [ snapshot quiesce support
  not in octopus ]
src/tools/rbd/action/Device.cc [ nbd cookie support not in
  octopus ]
src/tools/rbd/action/Migration.cc [ import-only migration
  not supported in octopus ]
src/tools/rbd/action/Wnbd.cc [ wnbd support not in octopus ]

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/Nbd.cc
src/tools/rbd/action/Trash.cc
src/tools/rbd/action/TrashPurgeSchedule.cc

index 0554acceee967a8c3c398787ca5c28a5d998ebde..5cc6955fe509640aad294c2704056e7003f0a210 100644 (file)
@@ -84,7 +84,9 @@ static const std::string NO_ERROR("no-error");
 static const std::string LIMIT("limit");
 
 static const std::set<std::string> SWITCH_ARGUMENTS = {
-  WHOLE_OBJECT, NO_PROGRESS, PRETTY_FORMAT, VERBOSE, NO_ERROR};
+  WHOLE_OBJECT, IMAGE_SHARED, IMAGE_THICK_PROVISION, IMAGE_FLATTEN,
+  NO_PROGRESS, PRETTY_FORMAT, VERBOSE, NO_ERROR
+};
 
 struct ImageSize {};
 struct ImageOrder {};
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 3fdf2ef50aab6695fe9cef9561cd1057c2818160..11edeab27500f82cb98b2111aa3ab5a392a4f6e5 100644 (file)
@@ -163,7 +163,8 @@ int execute_unmap(const po::variables_map &vm,
   return (*get_device_operations(vm)->execute_unmap)(vm, ceph_global_init_args);
 }
 
-Shell::SwitchArguments switched_arguments({"read-only", "exclusive"});
+Shell::SwitchArguments switched_arguments({"exclusive", "force", "read-only"});
+
 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 b5b82f4c0dcaca736925e441f6cabaad664609f9..c0843856d03f7824750a1942f8b895b90530d6b1 100644 (file)
@@ -308,7 +308,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 5c55adea4e765f54e67505ec7375d1db41868712..55f8e36a78cb02bf88e582e9be6d144e4b39edc4 100644 (file)
@@ -267,8 +267,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 b3e6d19168e699b28f08314ce030bde900384fad..a887f0d31da6c458c0a8b2824c1115107fed5ac6 100644 (file)
@@ -514,7 +514,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);
@@ -527,7 +526,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);