Commit daf2ebb (xenserver: Use xe-switch-network-stack in RPM spec
file.) changed the spec file to use xe-switch-network-backend instead of
directly modifying "/etc/xensource/network.conf". It incorrectly
assumed that the command was in the search path. It also didn't take
into account that the command will remove the "openvswitch" service with
chkconfig. This commit fixes those errors.
Signed-off-by: Justin Pettit <jpettit@nicira.com>
if [ "$1" = "1" ]; then # $1 = 2 for upgrade
# Configure system to use Open vSwitch
if [ "$1" = "1" ]; then # $1 = 2 for upgrade
# Configure system to use Open vSwitch
- xe-switch-network-backend vswitch
-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
mode=$(cat /etc/xensource/network.conf)
if [ "$mode" != "vswitch" ] && [ "$mode" != "openvswitch" ]; then
depmod %{xen_version}
%preun
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
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
# Remove saved XenServer scripts directory, but only if it's empty
rmdir -p /usr/lib/openvswitch/xs-saved 2>/dev/null
# 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
- xe-switch-network-backend bridge
%files
%defattr(-,root,root)
/etc/init.d/openvswitch
%files
%defattr(-,root,root)
/etc/init.d/openvswitch