mirror of https://github.com/apache/cloudstack.git
VPC : CS-11503, deleting staticnat works even ip is not there.
this can fix the issue for VPC, but Cloudstack should not send out ipdeassociate before applying ruls on this ip
This commit is contained in:
parent
a0a0113b51
commit
c5f8712b4b
|
|
@ -43,3 +43,17 @@ getVPCcidr () {
|
|||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
removeRulesForIp() {
|
||||
local ip=$1
|
||||
iptables-save -t mangle | grep $ip | grep "\-A" | while read rule
|
||||
do
|
||||
rule=$(echo $rule | sed 's/\-A/\-D/')
|
||||
sudo iptables -t mangle $rule
|
||||
done
|
||||
iptables-save -t filter | grep $ip | grep "\-A" | while read rule
|
||||
do
|
||||
rule=$(echo $rule | sed 's/\-A/\-D/')
|
||||
sudo iptables -t filter $rule
|
||||
done
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,13 @@ ethDev=$(getEthByIp $publicIp)
|
|||
result=$?
|
||||
if [ $result -gt 0 ]
|
||||
then
|
||||
unlock_exit $result $lock $locked
|
||||
if [ "$op" == "-D" ]
|
||||
then
|
||||
removeRulesForIp $publicIp
|
||||
unlock_exit 0 $lock $locked
|
||||
else
|
||||
unlock_exit $result $lock $locked
|
||||
fi
|
||||
fi
|
||||
OUTFILE=$(mktemp)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue