1#!/bin/bash
2
3dir=$(dirname "$0")
4. "$dir/xen-hotplug-common.sh"
5. "$dir/xen-network-common.sh"
6
7bridge=$(xenstore_read_default "$XENBUS_PATH/bridge" "$bridge")
8if [ -z "$bridge" ]
9    then
10    nr_bridges=$(($(brctl show | cut -f 1 | grep -v "^$" | wc -l) - 1))
11    if [ "$nr_bridges" != 1 ]
12	then
13	fatal "no bridge specified, and don't know which one to use ($nr_bridges found)"
14    fi
15    bridge=$(brctl show | cut -d "
16" -f 2 | cut -f 1)
17fi
18
19command="$1"
20shift
21
22case "$command" in
23    "online")
24	if [ "$bridge" != "-" ]
25	    then
26	    setup_virtual_bridge_port "$vif"
27	    add_to_bridge "$bridge" "$vif"
28	else
29	    # Just let the normal udev rules for interfaces handle it.
30	    true
31	fi
32	success
33	;;
34
35    "add")
36	success
37	;;
38
39    "remove")
40	;;
41
42    *)
43	echo "Unknown command: $command"
44	echo 'Valid commands are: add, remove, online'
45	exit 1
46esac
47