summaryrefslogtreecommitdiffstats
path: root/src/tools/rbd/action/Group.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/rbd/action/Group.cc')
-rw-r--r--src/tools/rbd/action/Group.cc85
1 files changed, 45 insertions, 40 deletions
diff --git a/src/tools/rbd/action/Group.cc b/src/tools/rbd/action/Group.cc
index d97e120d438..100bdc19496 100644
--- a/src/tools/rbd/action/Group.cc
+++ b/src/tools/rbd/action/Group.cc
@@ -28,6 +28,9 @@ static const std::string DEST_GROUP_NAME("dest-group");
static const std::string GROUP_POOL_NAME("group-" + at::POOL_NAME);
static const std::string IMAGE_POOL_NAME("image-" + at::POOL_NAME);
+static const std::string GROUP_NAMESPACE_NAME("group-" + at::NAMESPACE_NAME);
+static const std::string IMAGE_NAMESPACE_NAME("image-" + at::NAMESPACE_NAME);
+
void add_group_option(po::options_description *opt,
at::ArgumentModifier modifier) {
std::string name = GROUP_NAME;
@@ -107,8 +110,8 @@ int execute_create(const po::variables_map &vm,
int r = utils::get_pool_generic_snapshot_names(
vm, at::ARGUMENT_MODIFIER_NONE, &arg_index, at::POOL_NAME, &pool_name,
- &namespace_name, GROUP_NAME, "group", &group_name, nullptr, true,
- utils::SNAPSHOT_PRESENCE_NONE, utils::SPEC_VALIDATION_FULL);
+ at::NAMESPACE_NAME, &namespace_name, GROUP_NAME, "group", &group_name,
+ nullptr, true, utils::SNAPSHOT_PRESENCE_NONE, utils::SPEC_VALIDATION_FULL);
if (r < 0) {
return r;
}
@@ -187,8 +190,8 @@ int execute_remove(const po::variables_map &vm,
int r = utils::get_pool_generic_snapshot_names(
vm, at::ARGUMENT_MODIFIER_NONE, &arg_index, at::POOL_NAME, &pool_name,
- &namespace_name, GROUP_NAME, "group", &group_name, nullptr, true,
- utils::SNAPSHOT_PRESENCE_NONE, utils::SPEC_VALIDATION_FULL);
+ at::NAMESPACE_NAME, &namespace_name, GROUP_NAME, "group", &group_name,
+ nullptr, true, utils::SNAPSHOT_PRESENCE_NONE, utils::SPEC_VALIDATION_FULL);
if (r < 0) {
return r;
}
@@ -221,8 +224,8 @@ int execute_rename(const po::variables_map &vm,
int r = utils::get_pool_generic_snapshot_names(
vm, at::ARGUMENT_MODIFIER_NONE, &arg_index, at::POOL_NAME, &pool_name,
- &namespace_name, GROUP_NAME, "group", &group_name, nullptr, true,
- utils::SNAPSHOT_PRESENCE_NONE, utils::SPEC_VALIDATION_FULL);
+ at::NAMESPACE_NAME, &namespace_name, GROUP_NAME, "group", &group_name,
+ nullptr, true, utils::SNAPSHOT_PRESENCE_NONE, utils::SPEC_VALIDATION_FULL);
if (r < 0) {
return r;
}
@@ -233,9 +236,9 @@ int execute_rename(const po::variables_map &vm,
r = utils::get_pool_generic_snapshot_names(
vm, at::ARGUMENT_MODIFIER_DEST, &arg_index, at::DEST_POOL_NAME,
- &dest_pool_name, &dest_namespace_name, DEST_GROUP_NAME, "group",
- &dest_group_name, nullptr, true, utils::SNAPSHOT_PRESENCE_NONE,
- utils::SPEC_VALIDATION_FULL);
+ &dest_pool_name, at::DEST_NAMESPACE_NAME, &dest_namespace_name,
+ DEST_GROUP_NAME, "group", &dest_group_name, nullptr, true,
+ utils::SNAPSHOT_PRESENCE_NONE, utils::SPEC_VALIDATION_FULL);
if (r < 0) {
return r;
}
@@ -283,8 +286,8 @@ int execute_info(const po::variables_map &vm,
int r = utils::get_pool_generic_snapshot_names(
vm, at::ARGUMENT_MODIFIER_NONE, &arg_index, at::POOL_NAME, &pool_name,
- &namespace_name, GROUP_NAME, "group", &group_name, nullptr, true,
- utils::SNAPSHOT_PRESENCE_NONE, utils::SPEC_VALIDATION_FULL);
+ at::NAMESPACE_NAME, &namespace_name, GROUP_NAME, "group", &group_name,
+ nullptr, true, utils::SNAPSHOT_PRESENCE_NONE, utils::SPEC_VALIDATION_FULL);
if (r < 0) {
return r;
}
@@ -335,8 +338,9 @@ int execute_add(const po::variables_map &vm,
int r = utils::get_pool_generic_snapshot_names(
vm, at::ARGUMENT_MODIFIER_NONE, &arg_index, GROUP_POOL_NAME,
- &group_pool_name, &group_namespace_name, GROUP_NAME, "group", &group_name,
- nullptr, true, utils::SNAPSHOT_PRESENCE_NONE, utils::SPEC_VALIDATION_FULL);
+ &group_pool_name, GROUP_NAMESPACE_NAME, &group_namespace_name,
+ GROUP_NAME, "group", &group_name, nullptr, true,
+ utils::SNAPSHOT_PRESENCE_NONE, utils::SPEC_VALIDATION_FULL);
if (r < 0) {
return r;
}
@@ -347,9 +351,9 @@ int execute_add(const po::variables_map &vm,
r = utils::get_pool_generic_snapshot_names(
vm, at::ARGUMENT_MODIFIER_NONE, &arg_index, IMAGE_POOL_NAME,
- &image_pool_name, &image_namespace_name, at::IMAGE_NAME, "image",
- &image_name, nullptr, true, utils::SNAPSHOT_PRESENCE_NONE,
- utils::SPEC_VALIDATION_FULL);
+ &image_pool_name, IMAGE_NAMESPACE_NAME, &image_namespace_name,
+ at::IMAGE_NAME, "image", &image_name, nullptr, true,
+ utils::SNAPSHOT_PRESENCE_NONE, utils::SPEC_VALIDATION_FULL);
if (r < 0) {
return r;
}
@@ -393,8 +397,9 @@ int execute_remove_image(const po::variables_map &vm,
int r = utils::get_pool_generic_snapshot_names(
vm, at::ARGUMENT_MODIFIER_NONE, &arg_index, GROUP_POOL_NAME,
- &group_pool_name, &group_namespace_name, GROUP_NAME, "group", &group_name,
- nullptr, true, utils::SNAPSHOT_PRESENCE_NONE, utils::SPEC_VALIDATION_FULL);
+ &group_pool_name, GROUP_NAMESPACE_NAME, &group_namespace_name,
+ GROUP_NAME, "group", &group_name, nullptr, true,
+ utils::SNAPSHOT_PRESENCE_NONE, utils::SPEC_VALIDATION_FULL);
if (r < 0) {
return r;
}
@@ -410,9 +415,9 @@ int execute_remove_image(const po::variables_map &vm,
r = utils::get_pool_generic_snapshot_names(
vm, at::ARGUMENT_MODIFIER_NONE, &arg_index, IMAGE_POOL_NAME,
- &image_pool_name, &image_namespace_name, at::IMAGE_NAME, "image",
- &image_name, nullptr, image_id.empty(), utils::SNAPSHOT_PRESENCE_NONE,
- utils::SPEC_VALIDATION_FULL);
+ &image_pool_name, IMAGE_NAMESPACE_NAME, &image_namespace_name,
+ at::IMAGE_NAME, "image", &image_name, nullptr, image_id.empty(),
+ utils::SNAPSHOT_PRESENCE_NONE, utils::SPEC_VALIDATION_FULL);
if (r < 0) {
return r;
}
@@ -464,8 +469,8 @@ int execute_list_images(const po::variables_map &vm,
int r = utils::get_pool_generic_snapshot_names(
vm, at::ARGUMENT_MODIFIER_NONE, &arg_index, at::POOL_NAME, &pool_name,
- &namespace_name, GROUP_NAME, "group", &group_name, nullptr, true,
- utils::SNAPSHOT_PRESENCE_NONE, utils::SPEC_VALIDATION_FULL);
+ at::NAMESPACE_NAME, &namespace_name, GROUP_NAME, "group", &group_name,
+ nullptr, true, utils::SNAPSHOT_PRESENCE_NONE, utils::SPEC_VALIDATION_FULL);
if (r < 0) {
return r;
}
@@ -563,8 +568,9 @@ int execute_group_snap_create(const po::variables_map &vm,
int r = utils::get_pool_generic_snapshot_names(
vm, at::ARGUMENT_MODIFIER_NONE, &arg_index, at::POOL_NAME, &pool_name,
- &namespace_name, GROUP_NAME, "group", &group_name, &snap_name, true,
- utils::SNAPSHOT_PRESENCE_REQUIRED, utils::SPEC_VALIDATION_FULL);
+ at::NAMESPACE_NAME, &namespace_name, GROUP_NAME, "group", &group_name,
+ &snap_name, true, utils::SNAPSHOT_PRESENCE_REQUIRED,
+ utils::SPEC_VALIDATION_FULL);
if (r < 0) {
return r;
}
@@ -604,8 +610,9 @@ int execute_group_snap_remove(const po::variables_map &vm,
int r = utils::get_pool_generic_snapshot_names(
vm, at::ARGUMENT_MODIFIER_NONE, &arg_index, at::POOL_NAME, &pool_name,
- &namespace_name, GROUP_NAME, "group", &group_name, &snap_name, true,
- utils::SNAPSHOT_PRESENCE_REQUIRED, utils::SPEC_VALIDATION_FULL);
+ at::NAMESPACE_NAME, &namespace_name, GROUP_NAME, "group", &group_name,
+ &snap_name, true, utils::SNAPSHOT_PRESENCE_REQUIRED,
+ utils::SPEC_VALIDATION_FULL);
if (r < 0) {
return r;
}
@@ -640,8 +647,9 @@ int execute_group_snap_rename(const po::variables_map &vm,
int r = utils::get_pool_generic_snapshot_names(
vm, at::ARGUMENT_MODIFIER_NONE, &arg_index, at::POOL_NAME, &pool_name,
- &namespace_name, GROUP_NAME, "group", &group_name, &source_snap_name, true,
- utils::SNAPSHOT_PRESENCE_REQUIRED, utils::SPEC_VALIDATION_FULL);
+ at::NAMESPACE_NAME, &namespace_name, GROUP_NAME, "group", &group_name,
+ &source_snap_name, true, utils::SNAPSHOT_PRESENCE_REQUIRED,
+ utils::SPEC_VALIDATION_FULL);
if (r < 0) {
return r;
}
@@ -696,8 +704,8 @@ int execute_group_snap_list(const po::variables_map &vm,
int r = utils::get_pool_generic_snapshot_names(
vm, at::ARGUMENT_MODIFIER_NONE, &arg_index, at::POOL_NAME, &pool_name,
- &namespace_name, GROUP_NAME, "group", &group_name, nullptr, true,
- utils::SNAPSHOT_PRESENCE_NONE, utils::SPEC_VALIDATION_FULL);
+ at::NAMESPACE_NAME, &namespace_name, GROUP_NAME, "group", &group_name,
+ nullptr, true, utils::SNAPSHOT_PRESENCE_NONE, utils::SPEC_VALIDATION_FULL);
if (r < 0) {
return r;
}
@@ -764,8 +772,9 @@ int execute_group_snap_info(const po::variables_map &vm,
int r = utils::get_pool_generic_snapshot_names(
vm, at::ARGUMENT_MODIFIER_NONE, &arg_index, at::POOL_NAME, &pool_name,
- &namespace_name, GROUP_NAME, "group", &group_name, &group_snap_name, true,
- utils::SNAPSHOT_PRESENCE_REQUIRED, utils::SPEC_VALIDATION_FULL);
+ at::NAMESPACE_NAME, &namespace_name, GROUP_NAME, "group", &group_name,
+ &group_snap_name, true, utils::SNAPSHOT_PRESENCE_REQUIRED,
+ utils::SPEC_VALIDATION_FULL);
if (r < 0) {
return r;
}
@@ -872,8 +881,9 @@ int execute_group_snap_rollback(const po::variables_map &vm,
int r = utils::get_pool_generic_snapshot_names(
vm, at::ARGUMENT_MODIFIER_NONE, &arg_index, at::POOL_NAME, &pool_name,
- &namespace_name, GROUP_NAME, "group", &group_name, &snap_name, true,
- utils::SNAPSHOT_PRESENCE_REQUIRED, utils::SPEC_VALIDATION_FULL);
+ at::NAMESPACE_NAME, &namespace_name, GROUP_NAME, "group", &group_name,
+ &snap_name, true, utils::SNAPSHOT_PRESENCE_REQUIRED,
+ utils::SPEC_VALIDATION_FULL);
if (r < 0) {
return r;
}
@@ -954,9 +964,6 @@ void get_add_arguments(po::options_description *positional,
add_prefixed_pool_option(options, "image");
add_prefixed_namespace_option(options, "image");
at::add_image_option(options, at::ARGUMENT_MODIFIER_NONE);
-
- at::add_pool_option(options, at::ARGUMENT_MODIFIER_NONE,
- " unless overridden");
}
void get_remove_image_arguments(po::options_description *positional,
@@ -979,8 +986,6 @@ void get_remove_image_arguments(po::options_description *positional,
add_prefixed_namespace_option(options, "image");
at::add_image_option(options, at::ARGUMENT_MODIFIER_NONE);
- at::add_pool_option(options, at::ARGUMENT_MODIFIER_NONE,
- " unless overridden");
at::add_image_id_option(options);
}