mirror of https://github.com/apache/cloudstack.git
cleanup ebtables rules if vm is manually deleted
This commit is contained in:
parent
8becb77674
commit
45ea2b2ad6
|
|
@ -130,9 +130,8 @@ def destroy_network_rules_for_vm(vm_name, vif=None):
|
|||
return 'true'
|
||||
|
||||
def destroy_ebtables_rules(vm_name, vif):
|
||||
if vif is None:
|
||||
return
|
||||
delcmd = "ebtables -t nat -L PREROUTING | grep " + vif
|
||||
|
||||
delcmd = "ebtables -t nat -L PREROUTING | grep " + vm_name
|
||||
delcmds = []
|
||||
try:
|
||||
delcmds = execute(delcmd).split('\n')
|
||||
|
|
@ -142,7 +141,7 @@ def destroy_ebtables_rules(vm_name, vif):
|
|||
pass
|
||||
postcmds = []
|
||||
try:
|
||||
postcmd = "ebtables -t nat -L POSTROUTING | grep " + vif
|
||||
postcmd = "ebtables -t nat -L POSTROUTING | grep " + vm_name
|
||||
postcmds = execute(postcmd).split('\n')
|
||||
postcmds.pop()
|
||||
postcmds = ["-D POSTROUTING " + x for x in postcmds]
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ arping_vm() {
|
|||
|
||||
# ping the default route
|
||||
ping_default_route() {
|
||||
defaultRoute=`grep GATEWAY /etc/sysconfig/network | awk -F"=" '{ print $2 }'`
|
||||
defaultRoute=`route |grep default|awk '{print $2}'`
|
||||
ping -c 1 -n -q $defaultRoute > /dev/null
|
||||
return $?
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue