]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
vstart.sh: make sure that --localhost does only bind to 127.0.0.1 in all cases 53319/head
authorLeonid Usov <leonid.usov@ibm.com>
Wed, 6 Sep 2023 16:29:48 +0000 (19:29 +0300)
committerLeonid Usov <leonid.usov@ibm.com>
Mon, 9 Oct 2023 00:09:28 +0000 (03:09 +0300)
Signed-off-by: Leonid Usov <leonid.usov@ibm.com>
src/vstart.sh

index a33bcde3234bd10aaaa105e6abdca26268d1e04e..99ecdf510e9b7f74078ba60cccb8e45f6e527483 100755 (executable)
@@ -174,6 +174,7 @@ pmem_enabled=0
 zoned_enabled=0
 io_uring_enabled=0
 with_jaeger=0
+force_addr=0
 
 with_mgr_dashboard=true
 if [[ "$(get_cmake_variable WITH_MGR_DASHBOARD_FRONTEND)" != "ON" ]] ||
@@ -344,6 +345,7 @@ case $1 in
         ;;
     -l | --localhost)
         ip="127.0.0.1"
+        force_addr=1
         ;;
     -i)
         [ -z "$2" ] && usage_exit
@@ -737,6 +739,12 @@ prepare_conf() {
         msgr_conf="ms bind msgr2 = false
                    ms bind msgr1 = true"
     fi
+    if [ $force_addr -eq 1 ]; then
+        msgr_conf+="
+                   public bind addr = $IP
+                   public addr = $IP
+                   cluster addr = $IP"
+    fi
 
     wconf <<EOF
 ; generated by vstart.sh on `date`
@@ -915,6 +923,26 @@ EOF
         osd pool default crimson = true
 EOF
     fi
+
+    # this is most probably a bug in ceph_mon
+    # but public_bind_addr set in [global] doesn't work
+    # when mon_host is also provided, resulting
+    # in different public and bind addresses (ports)
+    # As a result, no client can connect to the mon.
+    # The problematic code is in ceph_mon.cc, it looks like
+    #
+    #   // check if the public_bind_addr option is set
+    #  if (!g_conf()->public_bind_addr.is_blank_ip()) {
+    #    bind_addrs = make_mon_addrs(g_conf()->public_bind_addr);
+    #  }
+    #
+    if [ $force_addr -eq 1 ]; then
+        wconf <<EOF
+        ; this is to counter the explicit public_bind_addr in the [global] section
+        ; see src/vstart.sh for more info
+        public bind addr =
+EOF
+    fi   
 }
 
 write_logrotate_conf() {