]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common: new 'rbd_default_pool' configuration option
authorJason Dillaman <dillaman@redhat.com>
Tue, 6 Jun 2017 02:08:01 +0000 (22:08 -0400)
committerJason Dillaman <dillaman@redhat.com>
Wed, 7 Jun 2017 20:26:22 +0000 (16:26 -0400)
The 'rbd' pool will no longer be automatically created. Allow
the user to specify a custom default RBD pool name.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/common/config_opts.h
src/common/config_validators.cc
src/common/config_validators.h

index f66dc5158d20923e86c0c5b67f73d8037d00e66e..20e6dd5ea6e1d40a055a71cf75e4076f0f97b082 100644 (file)
@@ -1380,6 +1380,9 @@ OPTION(rbd_auto_exclusive_lock_until_manual_request, OPT_BOOL, true) // whether
 OPTION(rbd_mirroring_resync_after_disconnect, OPT_BOOL, false) // automatically start image resync after mirroring is disconnected due to being laggy
 OPTION(rbd_mirroring_replay_delay, OPT_INT, 0) // time-delay in seconds for rbd-mirror asynchronous replication
 
+OPTION(rbd_default_pool, OPT_STR, "rbd") // default pool for storing images
+OPTION_VALIDATOR(rbd_default_pool)
+
 /*
  * The following options change the behavior for librbd's image creation methods that
  * don't require all of the parameters. These are provided so that older programs
@@ -1401,6 +1404,7 @@ OPTION(rbd_default_order, OPT_INT, 22)
 OPTION(rbd_default_stripe_count, OPT_U64, 0) // changing requires stripingv2 feature
 OPTION(rbd_default_stripe_unit, OPT_U64, 0) // changing to non-object size requires stripingv2 feature
 OPTION(rbd_default_data_pool, OPT_STR, "") // optional default pool for storing image data blocks
+OPTION_VALIDATOR(rbd_default_data_pool)
 
 /**
  * RBD features are only applicable for v2 images. This setting accepts either
index 0f224f94b8dbf285a043691c130077e1fc408c9e..2b095cab05a0871e7987afb40a8c4d698cd52d77 100644 (file)
@@ -9,6 +9,27 @@
 #include <vector>
 #include <boost/algorithm/string.hpp>
 #include <boost/lexical_cast.hpp>
+#include <boost/regex.hpp>
+
+int validate(md_config_t::option_rbd_default_pool_t *,
+             std::string *value, std::string *error_message) {
+  boost::regex pattern("^[^@/]+$");
+  if (!boost::regex_match (*value, pattern)) {
+    *value = "rbd";
+    *error_message = "invalid RBD default pool, resetting to 'rbd'";
+  }
+  return 0;
+}
+
+int validate(md_config_t::option_rbd_default_data_pool_t *,
+             std::string *value, std::string *error_message) {
+  boost::regex pattern("^[^@/]*$");
+  if (!boost::regex_match (*value, pattern)) {
+    *value = "";
+    *error_message = "ignoring invalid RBD data pool";
+  }
+  return 0;
+}
 
 int validate(md_config_t::option_rbd_default_features_t *,
              std::string *value, std::string *error_message) {
index 22cf6f0866c17b1df6dca4707d35a8b4128f6e3b..f647369ec152f1ed5abbf864ca679417a7997225 100644 (file)
  * Global config value validators for the Ceph project
  */
 
+int validate(md_config_t::option_rbd_default_pool_t *type,
+             std::string *value, std::string *error_message);
+int validate(md_config_t::option_rbd_default_data_pool_t *type,
+             std::string *value, std::string *error_message);
 int validate(md_config_t::option_rbd_default_features_t *type,
              std::string *value, std::string *error_message);