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 ]
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 {};
return 0;
}
+Shell::SwitchArguments switched_arguments({"all", "a", "descendants"});
Shell::Action action(
{"children"}, {}, "Display children of an image or its snapshot.", "",
&get_arguments, &execute);
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);
return 0;
}
-Shell::SwitchArguments switched_arguments({at::WHOLE_OBJECT});
Shell::Action action(
{"diff"}, {},
"Print extents that differ since a previous snap, or image creation.", "",
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);
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);
return r;
}
-
Shell::Action action_move(
{"trash", "move"}, {"trash", "mv"}, "Move an image to the trash.", "",
&get_move_arguments, &execute_move);
{"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);
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);