summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbencoh <bencoh@19625182-23af-4830-9084-f181c60b83b7>2010-07-14 15:45:14 +0000
committerbencoh <bencoh@19625182-23af-4830-9084-f181c60b83b7>2010-07-14 15:45:14 +0000
commitb7ad479c3e64fdb62ce005a1ca439476883e67a5 (patch)
treec0750f730b472b873971b6b8270cafeb5010ede2
parentc0f73dbd71a1957c83f51ec2c1b73d8cb1b95704 (diff)
Remove kvm-net.conf, move bridge definition to kvm-wrapper.conf.
Export KVM_BRIDGE in kvm-wrapper.sh so that kvm-ifup/down can use it (thus removing the need for a pair of scrips per bridge). git-svn-id: https://svn.notk.org/bencoh/kvm-wrapper/@12 19625182-23af-4830-9084-f181c60b83b7
-rw-r--r--kvm-wrapper.conf2
-rwxr-xr-xkvm-wrapper.sh6
-rwxr-xr-xnet/kvm-ifdown14
-rwxr-xr-xnet/kvm-ifup18
-rw-r--r--net/kvm-net.conf5
5 files changed, 15 insertions, 30 deletions
diff --git a/kvm-wrapper.conf b/kvm-wrapper.conf
index 4f73e08..c4b386f 100644
--- a/kvm-wrapper.conf
+++ b/kvm-wrapper.conf
@@ -28,7 +28,7 @@ KVM_CPU_NUM="1"
KVM_NETWORK_MODEL="rtl8139"
KVM_MACADDRESS="`random_mac`"
-#KVM_BRIDGE
+KVM_BRIDGE="kvmnat"
KVM_BOOTDEVICE="c"
#KVM_HDA
diff --git a/kvm-wrapper.sh b/kvm-wrapper.sh
index 8214d71..93336b4 100755
--- a/kvm-wrapper.sh
+++ b/kvm-wrapper.sh
@@ -294,10 +294,10 @@ function kvm_start_vm ()
[[ -n "$KVM_INITRD" ]] && LINUXBOOT="$LINUXBOOT -initrd $KVM_INITRD"
[[ -n "$KVM_APPEND" ]] && LINUXBOOT="$LINUXBOOT -append \"$KVM_APPEND\""
- # Are we bridged or nated ? (default nated)
- KVM_NET_TAP="tap"
+ # Network scripts
+ [[ -z "$KVM_BRIDGE" ]] && KVM_BRIDGE="kvmnat"
+ export KVM_BRIDGE
KVM_NET_SCRIPT="$ROOTDIR/net/kvm"
- [[ "$KVM_BRIDGE" == "br0" ]] && KVM_NET_SCRIPT="$ROOTDIR/net/kvm-br0"
KVM_NET_TAP="tap,script=$KVM_NET_SCRIPT-ifup,downscript=$KVM_NET_SCRIPT-ifdown"
# Monitor/serial devices
diff --git a/net/kvm-ifdown b/net/kvm-ifdown
index b1d7c2f..39cbf36 100755
--- a/net/kvm-ifdown
+++ b/net/kvm-ifdown
@@ -1,12 +1,10 @@
#!/bin/sh
-
-. /usr/share/kvm-wrapper/net/kvm-net.conf
+#
+# Script called by kvm on tap interface creation
+#
echo "$0:"
-
-echo "Removing $1 from bridge $BRIDGE"
-ip link set $1 down
-brctl delif "$BRIDGE" $1
-
-exit 0
+echo "Removing $1 from bridge $KVM_BRIDGE"
+ip link set "$1" down
+brctl delif "$KVM_BRIDGE" "$1"
diff --git a/net/kvm-ifup b/net/kvm-ifup
index 87e105e..53c5c3d 100755
--- a/net/kvm-ifup
+++ b/net/kvm-ifup
@@ -1,18 +1,10 @@
#!/bin/sh
-
-# Debian default
-#switch=$(ip route ls | awk '/^default / { for(i=0;i<NF;i++) { if ($(i) == "dev") print $(i+1) }}')
-#/sbin/ifconfig $1 0.0.0.0 up
-#/usr/sbin/brctl addif ${switch} $1
-#exit 0
-
-
-# Configuration with NAT support
-
-. /usr/share/kvm-wrapper/net/kvm-net.conf
+#
+# Script called by kvm on tap interface creation
+#
echo "$0:"
-echo "Adding $1 to bridge interface $BRIDGE"
-brctl addif "$BRIDGE" "$1"
+echo "Adding $1 to bridge interface $KVM_BRIDGE"
+brctl addif "$KVM_BRIDGE" "$1"
ip link set "$1" up
diff --git a/net/kvm-net.conf b/net/kvm-net.conf
deleted file mode 100644
index bedcea2..0000000
--- a/net/kvm-net.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-BRIDGE=kvmnat
-#NETWORK=192.168.172.0
-#HOST=192.168.172.1
-#MASK=255.255.255.0
-#EXTIF=br0