Skip to content

Commit

Permalink
Merge pull request #236 from IBM/jinlings
Browse files Browse the repository at this point in the history
removed fdb when vm deleted
  • Loading branch information
Catherine2019 authored Jan 18, 2021
2 parents fa46e57 + 44c765b commit 93dcb11
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions scripts/kvm/clear_vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ count=$(echo $vm_xml | xmllint --xpath 'count(/domain/devices/interface)' -)
for (( i=1; i <= $count; i++ )); do
vif_dev=$(echo $vm_xml | xmllint --xpath "string(/domain/devices/interface[$i]/target/@dev)" -)
br_name=$(echo $vm_xml | xmllint --xpath "string(/domain/devices/interface[$i]/source/@bridge)" -)
mac_addr=$(echo $vm_xml | xmllint --xpath "string(/domain/devices/interface[$i]/mac/@address)" -)
if [ "$use_lb" = "false" ]; then
br_name=br$SCI_CLIENT_ID
result=$(icp-tower --ovs-bridge=$br_name gate remove --interface $vif_dev)
sidecar span log $span "Internal: $vif_dev is deleted" "result: $result"
else
vni=${br_name#br}
./clear_link.sh $vni
./rm_fdb.sh $mac_addr
./clear_sg_chain.sh $vif_dev
fi
sidecar span log $span "Callback: clear_vnic.sh '$vif_dev'"
Expand Down
3 changes: 1 addition & 2 deletions scripts/kvm/launch_vm.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -xv
#!/bin/bash

cd $(dirname $0)
source ../cloudrc
Expand Down Expand Up @@ -65,7 +65,6 @@ if [ "$ephemeral_size" -gt 0 ]; then
virsh attach-disk $vm_ID $ephemeral vdb --config
fi
vlans=$(jq .vlans <<< $metadata)
echo "Vlans is $vlans" >> /tmp/cloudland_launch_vlans.log
nvlan=$(jq length <<< $vlans)
i=0
while [ $i -lt $nvlan ]; do
Expand Down
7 changes: 7 additions & 0 deletions scripts/kvm/rm_fdb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

cd `dirname $0`
source ../cloudrc
[ $# -lt 1 ] && die "$0 <mac_addr>"
mac_addr=$1
sudo /usr/sbin/bridge fdb del $mac_addr dev $zlayer2_interface

0 comments on commit 93dcb11

Please sign in to comment.