From 834556fa332f3b543ecb2737dfbd12ec7de86a19 Mon Sep 17 00:00:00 2001 From: "daegon.yang" Date: Mon, 18 Dec 2023 06:12:24 +0000 Subject: [PATCH] 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 --- src/vstart.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vstart.sh b/src/vstart.sh index 634fb74ac874d..46c1b85a8d200 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 -- 2.39.5