if [ "$1" = "1" ]; then # $1 = 2 for upgrade
# Configure system to use Open vSwitch
- echo vswitch > /etc/xensource/network.conf
-
- printf "\nYou MUST reboot the server NOW to complete the change to\n"
- printf "Open vSwitch. Attempts to modify networking on the server\n"
- printf "or any hosted VM will fail until after the reboot and could\n"
- printf "leave the server in a state requiring manual recovery.\n\n"
-else
+ /opt/xensource/bin/xe-switch-network-backend vswitch
+else # $1 = 2 for upgrade
mode=$(cat /etc/xensource/network.conf)
if [ "$mode" != "vswitch" ] && [ "$mode" != "openvswitch" ]; then
depmod %{xen_version}
%preun
-if [ "$1" = "0" ]; then # $1 = 1 for upgrade
+if [ "$1" = "0" ]; then # $1 = 0 for uninstall
+ # Configure system to use bridge
+ /opt/xensource/bin/xe-switch-network-backend bridge
+
+ # The "openvswitch" service should have been removed from
+ # "xe-switch-network-backend bridge".
for s in openvswitch openvswitch-xapi-update; do
- chkconfig --del $s || printf "Could not remove $s init script."
+ if chkconfig --list $s >/dev/null 2>&1; then
+ chkconfig --del $s || printf "Could not remove $s init script."
+ fi
done
fi
rm -f /etc/openvswitch/conf.db
rm -f /etc/sysconfig/openvswitch
rm -f /etc/openvswitch/vswitchd.cacert
- rm -f /var/xapi/network.dbcache
# Remove saved XenServer scripts directory, but only if it's empty
rmdir -p /usr/lib/openvswitch/xs-saved 2>/dev/null
-
- # Configure system to use bridge
- echo bridge > /etc/xensource/network.conf
-
- printf "\nYou MUST reboot the server now to complete the change to\n"
- printf "standard Xen networking. Attempts to modify networking on the\n"
- printf "server or any hosted VM will fail until after the reboot and\n"
- printf "could leave the server in a state requiring manual recovery.\n\n"
fi
+exit 0
+
%files
%defattr(-,root,root)
/etc/init.d/openvswitch