watch Watch events on image.
Optional arguments:
- -c [ --conf ] arg path to cluster configuration
- --cluster arg cluster name
- --id arg client id (without 'client.' prefix)
- --user arg client id (without 'client.' prefix)
- -n [ --name ] arg client name
- -m [ --mon_host ] arg monitor host
- --secret arg path to secret key (deprecated)
- -K [ --keyfile ] arg path to secret key
- -k [ --keyring ] arg path to keyring
+ -c [ --conf ] arg path to cluster configuration
+ --cluster arg cluster name
+ --id arg client id (without 'client.' prefix)
+ -n [ --name ] arg client name
+ -m [ --mon_host ] arg monitor host
+ -K [ --keyfile ] arg path to secret key
+ -k [ --keyring ] arg path to keyring
See 'rbd help <command>' for help on a specific command.
$ rbd help | grep '^ [a-z]' | sed 's/^ \([a-z -]*[a-z]\).*/\1/g' | while read -r line; do echo rbd help $line ; rbd help $line; done
--dest-pool arg destination pool name
--dest-namespace arg destination namespace name
--dest arg destination image name
- --order arg object order [12 <= order <= 25] (deprecated)
--object-size arg object size in B/K/M [4K <= object size <= 32M]
--image-feature arg image features
[layering(+), exclusive-lock(+*), object-map(+*),
--dest-pool arg destination pool name
--dest-namespace arg destination namespace name
--dest arg destination image name
- --order arg object order [12 <= order <= 25] (deprecated)
--object-size arg object size in B/K/M [4K <= object size <= 32M]
--image-feature arg image features
[layering(+), exclusive-lock(+*),
-p [ --pool ] arg pool name
--namespace arg namespace name
--image arg image name
- --image-format arg image format [1 (deprecated) or 2]
- --new-format use image format 2
- (deprecated)
- --order arg object order [12 <= order <= 25] (deprecated)
+ --image-format arg image format [default: 2]
--object-size arg object size in B/K/M [4K <= object size <= 32M]
--image-feature arg image features
[layering(+), exclusive-lock(+*), object-map(+*),
--dest-pool arg destination pool name
--dest-namespace arg destination namespace name
--dest arg destination image name
- --order arg object order [12 <= order <= 25] (deprecated)
--object-size arg object size in B/K/M [4K <= object size <= 32M]
--image-feature arg image features
[layering(+), exclusive-lock(+*),
--dest-pool arg destination pool name
--dest-namespace arg destination namespace name
--dest arg destination image name
- --image-format arg image format [1 (deprecated) or 2]
- --new-format use image format 2
- (deprecated)
- --order arg object order [12 <= order <= 25] (deprecated)
+ --image-format arg image format [default: 2]
--object-size arg object size in B/K/M [4K <= object size <= 32M]
--image-feature arg image features
[layering(+), exclusive-lock(+*), object-map(+*),
--sparse-size arg sparse size in B/K/M [default: 4K]
--no-progress disable progress output
--export-format arg format of image file
- -p [ --pool ] arg pool name (deprecated)
- --image arg image name (deprecated)
Image Features:
(*) supports enabling/disabling on existing images
--dest-pool arg destination pool name
--dest-namespace arg destination namespace name
--dest arg destination image name
- --image-format arg image format [1 (deprecated) or 2]
- --new-format use image format 2
- (deprecated)
- --order arg object order [12 <= order <= 25] (deprecated)
+ --image-format arg image format [default: 2]
--object-size arg object size in B/K/M [4K <= object size <= 32M]
--image-feature arg image features
[layering(+), exclusive-lock(+*), object-map(+*),
if (include_format) {
opt->add_options()
(IMAGE_FORMAT.c_str(), po::value<ImageFormat>(),
- "image format [1 (deprecated) or 2]")
+ "image format [default: 2]")
(IMAGE_NEW_FORMAT.c_str(),
po::value<ImageNewFormat>()->zero_tokens(),
- "use image format 2\n(deprecated)");
+ "deprecated[:image-format 2]");
}
opt->add_options()
(IMAGE_ORDER.c_str(), po::value<ImageOrder>(),
- "object order [12 <= order <= 25] (deprecated)")
+ "deprecated[:object-size]")
(IMAGE_OBJECT_SIZE.c_str(), po::value<ImageObjectSize>(),
"object size in B/K/M [4K <= object size <= 32M]")
(IMAGE_FEATURES.c_str(), po::value<ImageFeatures>()->composing(),
void validate(boost::any& v, const std::vector<std::string>& values,
ImageNewFormat *target_type, int dummy) {
- std::cout << "rbd: --new-format is deprecated, use --image-format"
- << std::endl;
v = boost::any(true);
}
void validate(boost::any& v, const std::vector<std::string>& values,
Secret *target_type, int) {
- std::cerr << "rbd: --secret is deprecated, use --keyfile" << std::endl;
po::validators::check_first_occurrence(v);
const std::string &s = po::validators::get_single_string(values);
}
}
+void OptionPrinter::print_optional(const OptionsDescription &global_opts,
+ size_t &name_width, std::ostream &os) {
+ std::string indent2(2, ' ');
+
+ for (size_t i = 0; i < global_opts.options().size(); ++i) {
+ std::string description = global_opts.options()[i]->description();
+ auto result = boost::find_first(description, "deprecated");
+ if (!result.empty()) {
+ continue;
+ }
+ std::stringstream ss;
+ ss << indent2
+ << global_opts.options()[i]->format_name() << " "
+ << global_opts.options()[i]->format_parameter();
+
+ std::cout << ss.str();
+ IndentStream indent_stream(name_width, ss.str().size(), LINE_WIDTH, std::cout);
+ indent_stream << global_opts.options()[i]->description() << std::endl;
+ }
+
+}
+
void OptionPrinter::print_detailed(std::ostream &os) {
std::string indent_prefix(2, ' ');
size_t name_width = compute_name_width(indent_prefix.size());
if (m_optional.options().size() > 0) {
std::cout << OPTIONAL_ARGUMENTS << std::endl;
- for (size_t i = 0; i < m_optional.options().size(); ++i) {
- std::stringstream ss;
- ss << indent_prefix
- << m_optional.options()[i]->format_name() << " "
- << m_optional.options()[i]->format_parameter();
-
- std::cout << ss.str();
- IndentStream indent_stream(name_width, ss.str().size(), LINE_WIDTH, os);
- indent_stream << m_optional.options()[i]->description() << std::endl;
- }
+ print_optional(m_optional, name_width, os);
std::cout << std::endl;
}
}
#include "include/int_types.h"
#include <string>
#include <vector>
+#include <boost/algorithm/string.hpp>
#include <boost/program_options.hpp>
namespace rbd {
void print_short(std::ostream &os, size_t initial_offset);
void print_detailed(std::ostream &os);
+ static void print_optional(const OptionsDescription &global_opts,
+ size_t &name_width, std::ostream &os);
private:
const OptionsDescription &m_positional;
return switch_arguments;
}
+void print_deprecated_warning(po::option_description option, std::string description) {
+ auto pos = description.find_first_of(":");
+ if (pos != std::string::npos) {
+ std::string param = description.substr(pos + 1, description.size() - pos - 2);
+ std::cout << "rbd: " << option.format_name() << " is deprecated, use --"
+ << param << std::endl;
+ }
+}
+
int Shell::execute(int argc, const char **argv) {
std::vector<std::string> arguments;
std::vector<std::string> ceph_global_init_args;
}
int r = (*action->execute)(vm, ceph_global_init_args);
+
+ if (vm.size() > 0) {
+ for (auto opt : vm) {
+ try {
+ auto option = command_opts.find(opt.first, false);
+ auto description = option.description();
+ auto result = boost::find_first(description, "deprecated");
+ if (!result.empty()) {
+ print_deprecated_warning(option, description);
+ }
+ } catch (exception& e) {
+ continue;
+ }
+ }
+ }
+
+ po::options_description global_opts;
+ get_global_options(&global_opts);
+ auto it = ceph_global_init_args.begin();
+ for ( ; it != ceph_global_init_args.end(); ++it) {
+ auto pos = (*it).find_last_of("-");
+ auto prefix_style = po::command_line_style::allow_long;
+ if (pos == 0) {
+ prefix_style = po::command_line_style::allow_dash_for_short;
+ } else if (pos == std::string::npos) {
+ continue;
+ }
+
+ for (size_t i = 0; i < global_opts.options().size(); ++i) {
+ std::string param_name = global_opts.options()[i]->canonical_display_name(
+ prefix_style);
+ auto description = global_opts.options()[i]->description();
+ auto result = boost::find_first(description, "deprecated");
+ if (!result.empty() && *it == param_name) {
+ print_deprecated_warning(*global_opts.options()[i], description);
+ break;
+ }
+ }
+ }
+
if (r != 0) {
return std::abs(r);
}
((at::CONFIG_PATH + ",c").c_str(), po::value<std::string>(), "path to cluster configuration")
("cluster", po::value<std::string>(), "cluster name")
("id", po::value<std::string>(), "client id (without 'client.' prefix)")
- ("user", po::value<std::string>(), "client id (without 'client.' prefix)")
+ ("user", po::value<std::string>(), "deprecated[:id]")
("name,n", po::value<std::string>(), "client name")
("mon_host,m", po::value<std::string>(), "monitor host")
- ("secret", po::value<at::Secret>(), "path to secret key (deprecated)")
+ ("secret", po::value<at::Secret>(), "deprecated[:keyfile]")
("keyfile,K", po::value<std::string>(), "path to secret key")
("keyring,k", po::value<std::string>(), "path to keyring");
}
}
}
- po::options_description global_opts(OptionPrinter::OPTIONAL_ARGUMENTS);
+ po::options_description global_opts;
get_global_options(&global_opts);
- std::cout << std::endl << global_opts << std::endl
+
+ std::cout << std::endl << OptionPrinter::OPTIONAL_ARGUMENTS << ":" << std::endl;
+ OptionPrinter::print_optional(global_opts, name_width, std::cout);
+
+ std::cout << std::endl
<< "See '" << APP_NAME << " help <command>' for help on a specific "
<< "command." << std::endl;
}
if (vm.count(at::IMAGE_ORDER)) {
order = vm[at::IMAGE_ORDER].as<uint64_t>();
- std::cerr << "rbd: --order is deprecated, use --object-size"
- << std::endl;
} else if (vm.count(at::IMAGE_OBJECT_SIZE)) {
object_size = vm[at::IMAGE_OBJECT_SIZE].as<uint64_t>();
order = std::round(std::log2(object_size));
// TODO legacy rbd allowed import to accept both 'image'/'dest' and
// 'pool'/'dest-pool'
- at::add_pool_option(options, at::ARGUMENT_MODIFIER_NONE, " (deprecated)");
- at::add_image_option(options, at::ARGUMENT_MODIFIER_NONE, " (deprecated)");
+ at::add_pool_option(options, at::ARGUMENT_MODIFIER_NONE, " deprecated[:dest-pool]");
+ at::add_image_option(options, at::ARGUMENT_MODIFIER_NONE, " deprecated[:dest]");
}
int execute(const po::variables_map &vm,
std::string deprecated_pool_name;
if (vm.count(at::POOL_NAME)) {
deprecated_pool_name = vm[at::POOL_NAME].as<std::string>();
- std::cerr << "rbd: --pool is deprecated for import, use --dest-pool"
- << std::endl;
}
std::string deprecated_image_name;
if (vm.count(at::IMAGE_NAME)) {
deprecated_image_name = vm[at::IMAGE_NAME].as<std::string>();
- std::cerr << "rbd: --image is deprecated for import, use --dest"
- << std::endl;
} else {
deprecated_image_name = path.substr(path.find_last_of("/") + 1);
}