]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/pick_address: fill in ipv4/6 and msgr1/msgr2 via config options
authorSage Weil <sage@redhat.com>
Fri, 1 Jun 2018 19:13:29 +0000 (14:13 -0500)
committerSage Weil <sage@redhat.com>
Tue, 3 Jul 2018 18:01:23 +0000 (13:01 -0500)
This allows users to simply pass in CLUSTER or PUBLIC and the function
fills in the rest.  (Or, if the caller is particular, they can pass in
the other flags too.)

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/options.cc
src/common/pick_address.cc

index 49ccafa02419b8f0ed548b8ae2292def2678c8c3..6e021c193c9ce3d3985e7f52e047d3d512d6b2bb 100644 (file)
@@ -924,9 +924,29 @@ std::vector<Option> get_global_options() {
     .set_default(100_M)
     .set_description(""),
 
+    Option("ms_bind_ipv4", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
+    .set_default(true)
+    .set_description("Bind servers to IPV4 address(es)")
+    .add_see_also("ms_bind_ipv6"),
+
     Option("ms_bind_ipv6", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
     .set_default(false)
-    .set_description(""),
+    .set_description("Bind servers to IPV6 address(es)")
+    .add_see_also("ms_bind_ipv4"),
+
+    Option("ms_bind_prefer_ipv4", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
+    .set_default(false)
+    .set_description("Prefer IPV4 over IPV6 address(es)"),
+
+    Option("ms_bind_msgr1", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
+    .set_default(true)
+    .set_description("Bind servers to msgr1 (legacy) protocol address(es)")
+    .add_see_also("ms_bind_msgr2"),
+
+    Option("ms_bind_msgr2", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
+    .set_default(false)
+    .set_description("Bind servers to msgr2 (nautilus+) protocol address(es)")
+    .add_see_also("ms_bind_msgr1"),
 
     Option("ms_bind_port_min", Option::TYPE_INT, Option::LEVEL_ADVANCED)
     .set_default(6800)
index 6cc8ca8b458b001da3a64bc7955e85c2d3f5522f..47d02aed3477578612d10fd3384b608bb61596da 100644 (file)
@@ -272,12 +272,33 @@ int pick_addresses(
   unsigned msgrv = flags & (CEPH_PICK_ADDRESS_MSGR1 |
                            CEPH_PICK_ADDRESS_MSGR2);
   if (msgrv == 0) {
-    return -EINVAL;
+    if (cct->_conf->get_val<bool>("ms_bind_msgr1")) {
+      msgrv |= CEPH_PICK_ADDRESS_MSGR1;
+    }
+    if (cct->_conf->get_val<bool>("ms_bind_msgr2")) {
+      msgrv |= CEPH_PICK_ADDRESS_MSGR2;
+    }
+    if (msgrv == 0) {
+      return -EINVAL;
+    }
   }
   unsigned ipv = flags & (CEPH_PICK_ADDRESS_IPV4 |
                          CEPH_PICK_ADDRESS_IPV6);
   if (ipv == 0) {
-    return -EINVAL;
+    if (cct->_conf->get_val<bool>("ms_bind_ipv4")) {
+      ipv |= CEPH_PICK_ADDRESS_IPV4;
+    }
+    if (cct->_conf->get_val<bool>("ms_bind_ipv6")) {
+      ipv |= CEPH_PICK_ADDRESS_IPV6;
+    }
+    if (ipv == 0) {
+      return -EINVAL;
+    }
+    if (cct->_conf->get_val<bool>("ms_bind_prefer_ipv4")) {
+      flags |= CEPH_PICK_ADDRESS_PREFER_IPV4;
+    } else {
+      flags &= ~CEPH_PICK_ADDRESS_PREFER_IPV4;
+    }
   }
 
   entity_addr_t addr;