From: daegon.yang Date: Mon, 18 Dec 2023 06:12:24 +0000 (+0000) Subject: vstart: Pick only CIDR-formatted routes when cephadm enabled X-Git-Tag: v19.3.0~174^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=834556fa332f3b543ecb2737dfbd12ec7de86a19;p=ceph.git vstart: Pick only CIDR-formatted routes when cephadm enabled 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 --- diff --git a/src/vstart.sh b/src/vstart.sh index 634fb74ac874..46c1b85a8d20 100755 --- a/src/vstart.sh +++ b/src/vstart.sh @@ -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