This is an automated email from the ASF dual-hosted git repository.
harikrishna pushed a commit to branch 4.19
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.19 by this push:
new 05e7a257ca5 VPC VR: return UNKNOWN redundant state if no guest nics
(#11518)
05e7a257ca5 is described below
commit 05e7a257ca5eb3bfb15225948f270288b857fdba
Author: Wei Zhou <[email protected]>
AuthorDate: Fri Aug 29 09:21:33 2025 +0200
VPC VR: return UNKNOWN redundant state if no guest nics (#11518)
* VPC VR: return UNKNOWN redundant state if no guest nics
---
systemvm/debian/opt/cloud/bin/checkrouter.sh | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/systemvm/debian/opt/cloud/bin/checkrouter.sh
b/systemvm/debian/opt/cloud/bin/checkrouter.sh
index c3a73e9e5e3..f127187ceb4 100755
--- a/systemvm/debian/opt/cloud/bin/checkrouter.sh
+++ b/systemvm/debian/opt/cloud/bin/checkrouter.sh
@@ -18,13 +18,33 @@
STATUS=UNKNOWN
+get_guest_nics() {
+ python3 -c "
+import json
+data = json.load(open('/etc/cloudstack/ips.json'))
+for nic, objs in data.items():
+ if isinstance(objs, list):
+ for obj in objs:
+ if obj.get('nw_type') == 'guest' and obj.get('add'):
+ print(nic)
+ "
+}
+
+ROUTER_TYPE=$(cat /etc/cloudstack/cmdline.json | grep type | awk '{print $2;}'
| sed -e 's/[,\"]//g')
+if [ "$ROUTER_TYPE" = "vpcrouter" ];then
+ GUEST_NICS=$(get_guest_nics)
+ if [ "$GUEST_NICS" = "" ];then
+ echo "Status: ${STATUS}"
+ exit
+ fi
+fi
+
if [ "$(systemctl is-active keepalived)" != "active" ]
then
echo "Status: FAULT"
exit
fi
-ROUTER_TYPE=$(cat /etc/cloudstack/cmdline.json | grep type | awk '{print $2;}'
| sed -e 's/[,\"]//g')
if [ "$ROUTER_TYPE" = "router" ]
then
ROUTER_STATE=$(ip -4 addr show dev eth0 | grep inet | wc -l | xargs
bash -c 'if [ $0 == 2 ]; then echo "PRIMARY"; else echo "BACKUP"; fi')