]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
vstart: Pick only CIDR-formatted routes when cephadm enabled 54941/head
authordaegon.yang <daegon.yang@samsung.com>
Mon, 18 Dec 2023 06:12:24 +0000 (06:12 +0000)
committerdaegon.yang <daegon.yang@samsung.com>
Mon, 18 Dec 2023 06:13:21 +0000 (06:13 +0000)
When cephadm is enabled, the script for determining the public_network
value from 'ip route list' output was previously capturing all routes
associated with the specified IP. This included non-CIDR formatted
entries such as specific IP routes (e.g., 8.8.8.8) and gateway
addresses, leading to the selection of multiple, potentially
irrelevant entries. This behavior resulted in an issue where vstart
could not correctly identify the network, causing it to terminate
unexpectedly.

This commit adds a grep command to ensure only CIDR network formats are
identified.

Signed-off-by: daegon.yang <daegon.yang@samsung.com>
src/vstart.sh

index 634fb74ac874daaca1ff6d1131b72501476d96e8..46c1b85a8d20004292ab5a4fdd2fbdb7026f43a4 100755 (executable)
@@ -1587,7 +1587,7 @@ EOF
     fi
     if [ "$cephadm" -gt 0 ]; then
         debug echo Setting mon public_network ...
-        public_network=$(ip route list | grep -w "$IP" | grep -v default | awk '{print $1}')
+        public_network=$(ip route list | grep -w "$IP" | grep -v default | grep -E "/[0-9]+" | awk '{print $1}')
         ceph_adm config set mon public_network $public_network
     fi
 fi