mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
VPC VR: return UNKNOWN redundant state if no guest nics (#11518)
* VPC VR: return UNKNOWN redundant state if no guest nics
This commit is contained in:
parent
f80a9ca482
commit
05e7a257ca
@ -18,13 +18,33 @@
|
|||||||
|
|
||||||
STATUS=UNKNOWN
|
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" ]
|
if [ "$(systemctl is-active keepalived)" != "active" ]
|
||||||
then
|
then
|
||||||
echo "Status: FAULT"
|
echo "Status: FAULT"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ROUTER_TYPE=$(cat /etc/cloudstack/cmdline.json | grep type | awk '{print $2;}' | sed -e 's/[,\"]//g')
|
|
||||||
if [ "$ROUTER_TYPE" = "router" ]
|
if [ "$ROUTER_TYPE" = "router" ]
|
||||||
then
|
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')
|
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')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user