SHA256
1
0
forked from pool/xen
OBS User unknown
2009-01-25 00:23:36 +00:00
committed by Git OBS Bridge
parent b32658940a
commit 8a8c811c02
25 changed files with 2270 additions and 51 deletions

View File

@@ -38,7 +38,7 @@ test "x$1" = "x-o" && shift
DEBUG=no
RUN_FROM_RC=no
while [ $# -gt 0 ]; do
case $1 in
case $1 in
debug) DEBUG=yes ;;
rc) RUN_FROM_RC=yes ;;
*) debug unknown option $1 ;;
@@ -100,14 +100,20 @@ xm_list()
# For the specified vm, return a list of vifs that are connected to $INTERFACE
list_vifs()
{
id=$1
vifs=()
for vif in $(ls -1 "/sys/class/net/$INTERFACE/brif/"); do
tmp="`echo ${vif} | egrep "^(tap|vif)$id\..*"`"
if [ ! -z ${tmp} ]; then
vifs=(${vifs[@]} ${tmp})
fi
done
id=$1
vifs=()
for vif in $(ls -1 "/sys/class/net/$INTERFACE/brif/" 2>/dev/null) ; do
eval BRIDGE_PORTS="" `grep "^[[:space:]]*BRIDGE_PORTS=" \
"/etc/sysconfig/network/ifcfg-$INTERFACE" 2>/dev/null`
for p in $BRIDGE_PORTS ; do
test "x$p" = "x$vif" && continue 2
done
case $vif in
(tap${id}\.*|vif${id}\.*)
vifs=(${vifs[@]} ${vif})
;;
esac
done
echo "${vifs[@]}"
}
@@ -126,19 +132,22 @@ case $SCRIPTNAME in
*if-up.d*)
exit_if_xend_not_running
for IF in $(ls -1 "${RUN_FILES_BASE}/xen/") ; do
. "${RUN_FILES_BASE}/xen/$INTERFACE" || continue
if test -f "${RUN_FILES_BASE}/xen/$INTERFACE" ; then
. "${RUN_FILES_BASE}/xen/$INTERFACE"
for vif in ${VIFS}; do
test -d "/sys/class/net/${vif}" || continue
if ! is_iface_up ${vif} ; then
ip link set dev ${vif} up
fi
brctl addif ${INTERFACE} ${vif} 2>&1 > /dev/null
test -d "/sys/class/net/${INTERFACE}/brif/${vif}" && \
continue
if ! is_iface_up ${vif} ; then
ip link set dev ${vif} up || continue
fi
brctl addif ${INTERFACE} ${vif} &>/dev/null
done
# remove sysconfig state
rm -f "${RUN_FILES_BASE}/xen/$INTERFACE"
done
# remove sysconfig state
rm -f "${RUN_FILES_BASE}/xen/$INTERFACE"
fi
;;
*if-down.d*)
exit_if_xend_not_running