diff options
author | Dirk von Suchodoletz | 2009-03-06 01:39:59 +0100 |
---|---|---|
committer | Dirk von Suchodoletz | 2009-03-06 01:39:59 +0100 |
commit | ebd0e5ee18b6d8c7af9324406e1ae0500ee826bf (patch) | |
tree | 8f074c5974a7b6f46275baf87ab0d7010cee3f27 /os-plugins | |
parent | The ModulPath seems not needed to be set (so better comment it out to be (diff) | |
download | core-ebd0e5ee18b6d8c7af9324406e1ae0500ee826bf.tar.gz core-ebd0e5ee18b6d8c7af9324406e1ae0500ee826bf.tar.xz core-ebd0e5ee18b6d8c7af9324406e1ae0500ee826bf.zip |
More work on the qemukvm plugin ...
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2686 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins')
-rw-r--r-- | os-plugins/plugins/qemukvm/OpenSLX/OSPlugin/qemukvm.pm | 3 | ||||
-rw-r--r-- | os-plugins/plugins/qemukvm/XX_qemukvm.sh | 50 | ||||
-rw-r--r-- | os-plugins/plugins/qemukvm/files/qemu-ifup | 33 | ||||
-rw-r--r-- | os-plugins/plugins/qemukvm/files/qemu-ifup.sudo | 45 |
4 files changed, 49 insertions, 82 deletions
diff --git a/os-plugins/plugins/qemukvm/OpenSLX/OSPlugin/qemukvm.pm b/os-plugins/plugins/qemukvm/OpenSLX/OSPlugin/qemukvm.pm index bf05976c..dc650293 100644 --- a/os-plugins/plugins/qemukvm/OpenSLX/OSPlugin/qemukvm.pm +++ b/os-plugins/plugins/qemukvm/OpenSLX/OSPlugin/qemukvm.pm @@ -123,9 +123,6 @@ sub installationPhase # Copy the later /etc/qemu-ifup copyFile("$self->{openslxBasePath}/lib/plugins/qemukvm/files/qemu-ifup", "$self->{pluginRepositoryPath}/"); - # Copy the sudo stuff wrapped in /etc/qemu-ifup - copyFile("$self->{openslxBasePath}/lib/plugins/qemukvm/files/qemu-ifup.sudo", - "$self->{pluginRepositoryPath}/"); return; } diff --git a/os-plugins/plugins/qemukvm/XX_qemukvm.sh b/os-plugins/plugins/qemukvm/XX_qemukvm.sh index 54ee0d74..81e2b0d3 100644 --- a/os-plugins/plugins/qemukvm/XX_qemukvm.sh +++ b/os-plugins/plugins/qemukvm/XX_qemukvm.sh @@ -33,35 +33,25 @@ lease_file /var/lib/misc/udhcpd.leases # The location of the pid file pidfile /var/run/udhcpd.pid -opt dns $domain_name_servers +opt dns ${domain_name_servers} option subnet 255.255.255.0 opt router 192.168.10.2 opt wins 192.168.10.10 -option domain $domain_name +option domain virtual.site ${domain_name} -# Currently supported options, for more info, see options.c -#subnet -#timezone -#router -#timesvr -#namesvr -#dns -#logsvr -#cookiesvr -#lprsvr -#bootsize -#domain -#swapsvr -#rootpath -#ipttl -#mtu -#broadcast -#wins -#lease -#ntpsrv -#tftp +# Additional options known to udhcpd +#subnet #timezone +#router #timesvr +#namesvr #dns +#logsvr #cookiesvr +#lprsvr #bootsize +#domain #swapsvr +#rootpath #ipttl +#mtu #broadcast +#wins #lease +#ntpsrv #tftp #bootfile -" >$file +" >${cfgfile} } # check if the configuration file is available @@ -84,6 +74,8 @@ was either\n not found or couldn't be loaded for other reasons. Thus using \ qemu(-kvm)\n makes not much sense." exit 1 fi + # load the tunnel device module + modprobe tun 2>/dev/null # load needed variables . /initramfs/plugin-conf/qemukvm.conf @@ -123,13 +115,11 @@ ${qemukvm_imagesrc}." nonfatal testmkd /mnt/var/lib/misc touch /mnt/var/lib/misc/udhcpd.leases - # copy the /etc/qemu-ifup script + # copy the /etc/qemu-ifup script and enable extended rights for running + # the emulator via sudo cp /mnt/opt/openslx/plugin-repo/qemukvm/qemu-ifup /mnt/etc/qemu-ifup - cp /mnt/opt/openslx/plugin-repo/qemukvm/qemu-ifup.sudo \ - /mnt/etc/opt/openslx - chmod u+x /mnt/etc/opt/openslx/qemu-ifup.sudo - echo "%users ALL=NOPASSWD: /etc/opt/openslx/qemu-ifup.sudo" \ - >>/mnt/etc/sudoers + chmod u+x /mnt/etc/qemu-ifup + echo "ALL ALL=NOPASSWD: $fptoqemu" >>/mnt/etc/sudoers fi else [ $DEBUGLEVEL -gt 0 ] && echo " * Configuration of qemukvm plugin failed" diff --git a/os-plugins/plugins/qemukvm/files/qemu-ifup b/os-plugins/plugins/qemukvm/files/qemu-ifup index 26707b8b..b6b9337c 100644 --- a/os-plugins/plugins/qemukvm/files/qemu-ifup +++ b/os-plugins/plugins/qemukvm/files/qemu-ifup @@ -10,11 +10,36 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # qemu-ifup -# - Wrapper script for running certain stuff priviledged +# - Script used for network setup of qemukvm in Stage4 # ----------------------------------------------------------------------------- -# Run the real action script with sudo - this script should have been added -# during SLX stage3 to the sudoers list. +# Use the udhcpcd as DHCP server and brctl as provided by default in OpenSLX +# environments. +brctlcmd="LD_LIBRARY_PATH=/opt/openslx/uclib-rootfs/lib\ + /opt/openslx/uclib-rootfs/usr/sbin/brctl" +dhcpdcmd="LD_LIBRARY_PATH=/opt/openslx/uclib-rootfs/lib\ + /opt/openslx/uclib-rootfs/usr/sbin/udhcpd" + +# Just decide by the virtual network device used which kind of connection +# should be set up (passed in $1): tap0 = bridge, tap1 = nat, tap2 = hostonly. +case "$1" in + tap0) + # Adding the tap0 interface to the existing bridge configured in stage3 + eval $brctlcmd addif br0 tap0 + ;; + tap1) + # Configuring DHCP on host tap1 interface and enable IP masquerading + mkdir /var/lib/qemu + sed "s,NWIF,tap1,;s,/misc,/qemu," /etc/opt/openslx/udhcpd.qemukvm \ + >/var/lib/qemu/udhcpd.conf + eval $dhcpdcmd /var/lib/qemu/udhcpd.conf + echo "1" >/proc/sys/net/ipv4/conf/br0/forwarding + echo "1" >/proc/sys/net/ipv4/conf/tap1/forwarding + iptables -t nat -A POSTROUTING -i tap1 -o br0 -j MASQUERADE + ;; + tap2) + : + ;; +esac -sudo /etc/opt/openslx/qemu-ifup.sudo diff --git a/os-plugins/plugins/qemukvm/files/qemu-ifup.sudo b/os-plugins/plugins/qemukvm/files/qemu-ifup.sudo deleted file mode 100644 index 0c9187b5..00000000 --- a/os-plugins/plugins/qemukvm/files/qemu-ifup.sudo +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# 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 suggestions, praise, or complaints to feedback@openslx.org -# -# General information about OpenSLX can be found at http://openslx.org/ -# ----------------------------------------------------------------------------- -# qemu-ifup.sudo -# - Script used for network setup of qemukvm in Stage4 -# ----------------------------------------------------------------------------- - -# Use the udhcpcd as DHCP server and brctl as provided by default in OpenSLX -# environments. -brctlcmd="LD_LIBRARY_PATH=/opt/openslx/uclib-rootfs/lib\ - /opt/openslx/uclib-rootfs/usr/sbin/brctl" -dhcpdcmd="LD_LIBRARY_PATH=/opt/openslx/uclib-rootfs/lib\ - /opt/openslx/uclib-rootfs/usr/sbin/udhcpd" - -# Just decide by the virtual network device used which kind of connection -# should be set up (passed in $1): tap0 = bridge, tap1 = nat, tap2 = hostonly. -case "$1" in - tap0) - # Adding the tap0 interface to the existing bridge configured in stage3 - eval $brctlcmd addif br0 tap0 - ;; - tap1) - # Configuring DHCP on host tap1 interface and enable IP masquerading - mkdir /var/lib/qemu - sed "s,NWIF,tap1,;s,/misc,/qemu," /etc/opt/openslx/udhcpd.qemukvm \ - >/var/lib/qemu/udhcpd.conf - eval $dhcpdcmd /var/lib/qemu/udhcpd.conf - echo "1" >/proc/sys/net/ipv4/conf/br0/forwarding - echo "1" >/proc/sys/net/ipv4/conf/tap1/forwarding - iptables -t nat -A POSTROUTING -i tap1 -o br0 -j MASQUERADE - ;; - tap2) - : - ;; -esac - - |