mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
bug 6981: merge from 2.1.x bug 6807
status 6981: resolved fixed
This commit is contained in:
parent
900d597002
commit
04f89d89ec
@ -122,11 +122,32 @@ remove_an_ip () {
|
|||||||
local pubIp=$2
|
local pubIp=$2
|
||||||
local ipNoMask=$(echo $2 | awk -F'/' '{print $1}')
|
local ipNoMask=$(echo $2 | awk -F'/' '{print $1}')
|
||||||
local mask=$(echo $2 | awk -F'/' '{print $2}')
|
local mask=$(echo $2 | awk -F'/' '{print $2}')
|
||||||
[ "$mask" == "" ] && mask="32"
|
local existingIpMask=$(ssh -p 3922 -o StrictHostKeyChecking=no -i $cert root@$dRIp "
|
||||||
ssh -p 3922 -o StrictHostKeyChecking=no -i $cert root@$dRIp "\
|
ip addr show dev $correctVif | grep inet | awk '{print \$2}' | grep -w $ipNoMask
|
||||||
ip addr del dev $correctVif "$ipNoMask/$mask"
|
")
|
||||||
|
[ "$existingIpMask" == "" ] && return 0
|
||||||
|
local existingMask=$(echo $existingIpMask | awk -F'/' '{print $2}')
|
||||||
|
if [ "$existingMask" == "32" ]
|
||||||
|
then
|
||||||
|
ssh -p 3922 -o StrictHostKeyChecking=no -i $cert root@$dRIp "
|
||||||
|
ip addr del dev $correctVif $existingIpMask
|
||||||
"
|
"
|
||||||
if [ $? -gt 0 -a $? -ne 2 ]
|
result=$?
|
||||||
|
fi
|
||||||
|
if [ "$existingMask" != "32" ]
|
||||||
|
then
|
||||||
|
ssh -p 3922 -o StrictHostKeyChecking=no -i $cert root@$dRIp "
|
||||||
|
replaceIpMask=\`ip addr show dev $correctVif | grep inet | grep -v $existingIpMask | awk '{print \$2}' | sort -t/ -k2 -n|tail -1\`
|
||||||
|
ip addr del dev $correctVif $existingIpMask;
|
||||||
|
if [ -n \"\$replaceIpMask\" ]; then
|
||||||
|
ip addr del dev $correctVif \$replaceIpMask;
|
||||||
|
replaceIp=\`echo \$replaceIpMask | awk -F/ '{print \$1}'\`;
|
||||||
|
ip addr add dev $correctVif \$replaceIp/$existingMask;
|
||||||
|
fi
|
||||||
|
"
|
||||||
|
result=$?
|
||||||
|
fi
|
||||||
|
if [ $result -gt 0 -a $result -ne 2 ]
|
||||||
then
|
then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user