ia64/xen-unstable

view tools/hotplug/Linux/xen-hotplug-cleanup @ 19497:2f6ed9318c03

network-bridge: Fix do_ifup in the case of ${bridge} != ${netdev}

On RHEL5.2, ifup ${bridge} fails if ${bridge} != ${netdev},
because RHEL5.2's ifup ${bridge} runs the following sequence:

1. Search CONFIG that has the same mac address of ${bridge}.=20
ifcfg-${netdev} is found.
2. Run "ip link set dev ${netdev} up".
# ${bridge} is expected.
3. Output "Failed to bring up ${netdev}."
Because ${netdev} does not exist.

Thus, do_ifup() should not use ifup if ${bridge} != ${netdev}.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Apr 02 11:48:10 2009 +0100 (2009-04-02)
parents c9a35fb19e75
children 415505139333
line source
1 #! /bin/bash
3 dir=$(dirname "$0")
4 . "$dir/xen-hotplug-common.sh"
6 # Claim the lock protecting /etc/xen/scripts/block. This stops a race whereby
7 # paths in the store would disappear underneath that script as it attempted to
8 # read from the store checking for device sharing.
9 # Any other scripts that do similar things will have to have their lock
10 # claimed too.
11 # This is pretty horrible, but there's not really a nicer way of solving this.
12 claim_lock "block"
14 # split backend/DEVCLASS/VMID/DEVID on slashes
15 path_array=( ${XENBUS_PATH//\// } )
16 # get /vm/UUID path
17 vm=$(xenstore_read_default "/local/domain/${path_array[2]}/vm" "")
18 # construct /vm/UUID/device/DEVCLASS/DEVID
19 if [ "$vm" != "" ]; then
20 vm_dev="$vm/device/${path_array[1]}/${path_array[3]}"
21 else
22 vm_dev=
23 fi
25 # remove device frontend store entries
26 xenstore-rm -t \
27 $(xenstore-read "$XENBUS_PATH/frontend" 2>/dev/null) 2>/dev/null || true
29 # remove device backend store entries
30 xenstore-rm -t "$XENBUS_PATH" 2>/dev/null || true
31 xenstore-rm -t "error/$XENBUS_PATH" 2>/dev/null || true
33 # remove device path from /vm/UUID
34 [ "$vm_dev" != "" ] && xenstore-rm -t "$vm_dev" 2>/dev/null || true
36 release_lock "block"