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>
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