summaryrefslogtreecommitdiffstats
path: root/os-plugins
diff options
context:
space:
mode:
authorDirk von Suchodoletz2009-03-04 00:02:36 +0100
committerDirk von Suchodoletz2009-03-04 00:02:36 +0100
commit4fc25af885fd34b5216b8008222b104d5a561126 (patch)
tree4786d2f01d24095460a0476693b6143758124193 /os-plugins
parentRearranging init-hooks to add a special network bridge hook. (diff)
downloadcore-4fc25af885fd34b5216b8008222b104d5a561126.tar.gz
core-4fc25af885fd34b5216b8008222b104d5a561126.tar.xz
core-4fc25af885fd34b5216b8008222b104d5a561126.zip
Added the general bridge configuration feature as described in ticket
#311: The xenbr function is moved to the appropriate init hook from general functions (cleaning up there). The bridge init hook for the several virtualization tools like vmware, qemukvm, virtualbox use the same filename as the action is to be performed just once ... git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2665 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins')
-rw-r--r--os-plugins/plugins/qemukvm/init-hooks/20-nw-bridge-config/bridge.sh30
-rw-r--r--os-plugins/plugins/virtualbox/init-hooks/20-nw-bridge-config/bridge.sh30
-rwxr-xr-xos-plugins/plugins/vmware/init-hooks/20-nw-bridge-config/bridge.sh29
-rwxr-xr-xos-plugins/plugins/xen/init-hooks/20-nw-bridge-config/xen-bridge.sh42
4 files changed, 131 insertions, 0 deletions
diff --git a/os-plugins/plugins/qemukvm/init-hooks/20-nw-bridge-config/bridge.sh b/os-plugins/plugins/qemukvm/init-hooks/20-nw-bridge-config/bridge.sh
new file mode 100644
index 00000000..7503e3ab
--- /dev/null
+++ b/os-plugins/plugins/qemukvm/init-hooks/20-nw-bridge-config/bridge.sh
@@ -0,0 +1,30 @@
+#!/bin/ash
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# Init hook to create a bridge on the active network interface
+#############################################################################
+
+set -x
+
+local bridge=br0
+local brnwif=${nwif}
+local nwifmac=${macaddr}
+
+# bridge 0 already defined or some other problem
+brctl addbr ${bridge} || exit 0
+brctl stp ${bridge} off
+brctl setfd ${bridge} 0.000000000001
+ip link set addr ${nwifmac} br0
+ip link set dev ${nwif} up
+brctl addif ${bridge} ${nwif}
+
+# fixme: sending back the variable to init does not work properly at the moment
+nwif=${bridge}
diff --git a/os-plugins/plugins/virtualbox/init-hooks/20-nw-bridge-config/bridge.sh b/os-plugins/plugins/virtualbox/init-hooks/20-nw-bridge-config/bridge.sh
new file mode 100644
index 00000000..7503e3ab
--- /dev/null
+++ b/os-plugins/plugins/virtualbox/init-hooks/20-nw-bridge-config/bridge.sh
@@ -0,0 +1,30 @@
+#!/bin/ash
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# Init hook to create a bridge on the active network interface
+#############################################################################
+
+set -x
+
+local bridge=br0
+local brnwif=${nwif}
+local nwifmac=${macaddr}
+
+# bridge 0 already defined or some other problem
+brctl addbr ${bridge} || exit 0
+brctl stp ${bridge} off
+brctl setfd ${bridge} 0.000000000001
+ip link set addr ${nwifmac} br0
+ip link set dev ${nwif} up
+brctl addif ${bridge} ${nwif}
+
+# fixme: sending back the variable to init does not work properly at the moment
+nwif=${bridge}
diff --git a/os-plugins/plugins/vmware/init-hooks/20-nw-bridge-config/bridge.sh b/os-plugins/plugins/vmware/init-hooks/20-nw-bridge-config/bridge.sh
new file mode 100755
index 00000000..437426db
--- /dev/null
+++ b/os-plugins/plugins/vmware/init-hooks/20-nw-bridge-config/bridge.sh
@@ -0,0 +1,29 @@
+#!/bin/ash
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# Init hook to create a bridge on the active network interface
+#############################################################################
+
+local bridge=br0
+local brnwif=${nwif}
+local nwifmac=${macaddr}
+
+# bridge 0 already defined or some other problem
+brctl addbr ${bridge} || exit 0
+brctl stp ${bridge} off
+brctl setfd ${bridge} 0.000000000001
+ip link set addr ${nwifmac} ${bridge}
+ip link set dev ${nwif} up
+brctl addif ${bridge} ${nwif}
+
+# fixme: sending back the variable to init does not work properly at the
+# moment
+nwif=${bridge}
diff --git a/os-plugins/plugins/xen/init-hooks/20-nw-bridge-config/xen-bridge.sh b/os-plugins/plugins/xen/init-hooks/20-nw-bridge-config/xen-bridge.sh
new file mode 100755
index 00000000..7267969c
--- /dev/null
+++ b/os-plugins/plugins/xen/init-hooks/20-nw-bridge-config/xen-bridge.sh
@@ -0,0 +1,42 @@
+#!/bin/ash
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# XEN specific init hook to create a bridge on the active network interface
+#############################################################################
+
+# configure Xen bridge xenbr0 (would it be possible to make it just br0?)
+
+modprobe ${MODPRV} netloop
+local ipls
+local vifnum="0"
+local bridge="xenbr${vifnum}"
+local netdev="eth${vifnum}" # should be ${nwif}
+local pdev="p${netdev}"
+local vdev="veth${vifnum}"
+local vif0="vif0.${vifnum}"
+# fixme: that is the mac address of main ethernet device
+local mac=${macaddr}
+
+brctl addbr ${bridge}
+brctl stp ${bridge} off
+brctl setfd ${bridge} 0.000000000001
+brctl addif ${bridge} ${vif0}
+for ipls in "${netdev} name ${pdev}" "${vdev} name ${netdev}" \
+ "${pdev} down arp off" "${pdev} addr fe:ff:ff:ff:ff:ff" \
+ "${netdev} addr ${mac} arp on" "${netdev} addr ${mac} arp on" \
+ "${bridge} up" "${vif0} up" "${pdev} up" ; do
+ ip link set ${ipls}
+done
+brctl addif ${bridge} ${pdev}
+
+# fixme: sending back the variable to init does not work properly at the
+# moment
+nwif=${bridge}