Created
February 11, 2014 19:55
-
-
Save whitekid/8942840 to your computer and use it in GitHub Desktop.
LibvirtHybridOVSBridgeDriver로 구성된 ovs port 구성을 LibvirtOpenVswitchDriver 구성으로 모두 변경하는 스크립트...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for device in `ovs-vsctl list-ports br-int | grep ^qvo`; do | |
dev=${device:3} | |
echo $device | |
prop=`ovs-vsctl -- --columns=external_ids list Interface ${device}` | |
mac=`echo "$prop" | sed 's/.*attached-mac="\([a-z0-9:]*\).*/\1/g'` | |
iface_id=`echo "$prop" | sed 's/.*iface-id="\([a-z0-9-]*\).*/\1/g'` | |
iface_status=`echo "$prop" | sed 's/.*iface-status=\([a-z]*\).*/\1/g'` | |
vm_uuid=`echo "$prop" | sed 's/.*vm-uuid="\([a-z0-9-]*\).*/\1/g'` | |
tag=`ovs-vsctl get port ${device} tag` | |
ovs-vsctl -- --if-exists del-port br-int qvo${dev} | |
ovs-vsctl -- --may-exist add-port br-int tap${dev} \ | |
-- set Interface tap${dev} \ | |
external-ids:iface-id=${iface_id} \ | |
external-ids:iface-status=${iface_status} \ | |
external-ids:attached-mac=${mac} \ | |
external-ids:vm-uuid=${vm_uuid} | |
ovs-vsctl set port tap${dev} tag=${tag} | |
bridge="qbr${dev}" | |
if ! brctl show | grep -q ^${bridge}; then | |
continue | |
fi | |
ip link delete qvo${dev} | |
ip link set ${bridge} down | |
brctl delbr ${bridge} | |
restart_agent="YES" | |
done | |
if [ -n "$restart_agent" ]; then | |
service neutron-plugin-openvswitch-agent restart | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment