ia64/xen-unstable

view tools/hotplug/Linux/external-device-migrate @ 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 4bfc67b09e9c
children
line source
1 #!/bin/bash
3 # Copyright (c) 2005 IBM Corporation
4 #
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of version 2.1 of the GNU Lesser General Public
7 # License as published by the Free Software Foundation.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 #
19 set -x
21 # This script is called by XenD for migration of external devices
22 # It does not handle the migration of those devices itself, but
23 # passes the requests on to further applications
24 # It handles the low-level command line parsing and some of the
25 # synchronization
27 dir=$(dirname "$0")
28 . "$dir/logging.sh"
31 function ext_dev_migrate_usage() {
32 cat <<EOF
33 Pass the following command line parameters to the script:
35 -step <n> : n-th migration step
36 -host <host> : the destination host
37 -domname <domain name> : name of the domain that is migrating
38 -type <device type> : the type of device that is migrating
39 -subtype <dev. subtype>: the subtype of the device
40 -recover : indicates recovery request; an error
41 occurred during migration
42 -help : display this help screen
43 EOF
44 }
46 # Parse the command line paramters. The following parameters must be
47 # passed as the first ones in the sequence:
48 # -step [required]
49 # -host [required]
50 # -domname [required]
51 # -type [required]
52 # -subtype [optional]
53 # -recover [optional]
54 # The remaining ones will be passed to the called function.
55 function evaluate_params()
56 {
57 local step host domname typ recover filename func stype
58 stype=""
59 while [ $# -ge 1 ]; do
60 case "$1" in
61 -step) step=$2; shift; shift;;
62 -host) host=$2; shift; shift;;
63 -domname) domname=$2; shift; shift;;
64 -type) typ=$2; shift; shift;;
65 -subtype) stype=$2; shift; shift;;
66 -recover) recover=1; shift;;
67 -help) ext_dev_migrate_usage; exit 0;;
68 *) break;;
69 esac
70 done
72 if [ "$step" = "" -o \
73 "$host" = "" -o \
74 "$typ" = "" -o \
75 "$domname" = "" ]; then
76 echo "Error: Parameter(s) missing (-step/-host/-type/-domname)" 1>&2
77 echo "" 1>&2
78 echo "$0 -help for usage." 1>&2
79 exit 1
80 fi
82 filename="$dir/$typ$stype-migration.sh"
83 if [ ! -r $filename ]; then
84 echo "Error: Could not find script '$filename'"
85 return
86 fi
87 . "$filename"
89 if [ "$recover" = "1" ]; then
90 func="$typ"_recover
91 eval $func $host $domname $step $*
92 else
93 func="$typ"_migration_step
94 eval $func $host $domname $step $*
95 fi
96 }
98 evaluate_params "$@"