diff options
4 files changed, 70 insertions, 53 deletions
diff --git a/os-plugins/plugins/qemukvm/XX_qemukvm.sh b/os-plugins/plugins/qemukvm/XX_qemukvm.sh index 7dcaa254..e2d47a80 100644 --- a/os-plugins/plugins/qemukvm/XX_qemukvm.sh +++ b/os-plugins/plugins/qemukvm/XX_qemukvm.sh @@ -1,4 +1,4 @@ -# Copyright (c) 2008, 2009 - OpenSLX GmbH +# Copyright (c) 2008..2010 - OpenSLX GmbH # # This program/file is free software distributed under the GPL version 2. # See http://openslx.org/COPYING @@ -11,52 +11,6 @@ # Script is included from init via the "." load function - thus it has all # variables and functions available -write_networking_conf () -{ -local natnetwork="192.168.101" -local honetwork="192.168.102" -echo " -# udhcpd configuration file written by $0 during OpenSLX stage3 configuration - -# The start and end of the IP lease block -start CNETWORK.20 -end CNETWORK.100 - -# The interface that udhcpd will use -interface NWIF - -# How long an offered address is reserved (leased) in seconds -offer_time 6000 - -# The location of the leases file -lease_file /tmp/qemu-USER/udhcpd.leases - -# The location of the pid file -pidfile /tmp/qemu-USER/udhcpd.pid - -opt dns ${domain_name_servers} -option subnet 255.255.255.0 -opt router CNETWORK.254 -opt wins CNETWORK.10 -option domain virtual.site ${domain_name} - -# 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 -" >/mnt/etc/opt/openslx/udhcpd.qemukvm -echo -e "nataddress=${natnetwork}.254/24\nhoaddress=${honetwork}.254/24" \ - >/mnt/etc/opt/openslx/network.qemukvm -} - # check if the configuration file is available if [ -e /initramfs/plugin-conf/qemukvm.conf ]; then @@ -111,8 +65,12 @@ ${qemukvm_imagesrc}." nonfatal testmkd /mnt/etc/opt/openslx cp /mnt/opt/openslx/plugin-repo/qemukvm/run-virt.include \ /mnt/etc/opt/openslx/run-qemukvm.include - # create a template udhcpd configuration file - write_networking_conf + # create a network configuration template (variables should be setable in + # the future, see vmware plugin) + natnetwork="192.168.101" + honetwork="192.168.102" + echo -e "nataddress=${natnetwork}.254/24\nhoaddress=${honetwork}.254/24" \ + >/mnt/etc/opt/openslx/network.qemukvm # copy the runlevel script (proper place for all distros??) cp /mnt/opt/openslx/plugin-repo/qemukvm/qemukvm /mnt/etc/init.d diff --git a/os-plugins/plugins/qemukvm/files/qemu-ifup b/os-plugins/plugins/qemukvm/files/qemu-ifup index 9cd2dd0b..59bcad85 100644 --- a/os-plugins/plugins/qemukvm/files/qemu-ifup +++ b/os-plugins/plugins/qemukvm/files/qemu-ifup @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2009 - OpenSLX GmbH +# Copyright (c) 2009..2010 - OpenSLX GmbH # # This program is free software distributed under the GPL version 2. # See http://openslx.org/COPYING @@ -28,8 +28,11 @@ case "$1" in tap1) # Configuring DHCP on host tap1 interface and enable IP masquerading [ -d /tmp/qemu-$USER ] || mkdir -p /tmp/qemu-$USER - sed "s,NWIF,tap1,;s,/misc/,/qemu/,;s,USER,$USER,;s,CNETWORK,$nataddress," \ - /etc/opt/openslx/udhcpd.qemukvm >/tmp/qemu-$USER/udhcpd.conf + # cut the last .NNN/MM from nataddress + sed -e "s,NWIF,tap1,;s,/misc/,/qemu/," \ + -e "s,CNETWORK,${nataddress%.*},;s,PIDFILE,/tmp/qemu-$USER/udhcpd.pid," \ + -e "s,LEASEFILE,/tmp/qemu-$USER/udhcpd.leases," \ + /etc/opt/openslx/udhcpd.conf >/tmp/qemu-$USER/udhcpd.conf touch /tmp/qemu-$USER/udhcpd.leases # ip link set tap1 up # ip addr add 192.168.101.254/24 dev tap1 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 index 6aabe8ad..c4c548fb 100644 --- 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 @@ -10,7 +10,7 @@ # General information about OpenSLX can be found at http://openslx.org # # Init hook to create a bridge on the active network interface -# (should be kept identical to the files of virtualbox and qemukvm plugins) +# (should be kept identical to the files of virtualbox and vmware plugins) ############################################################################# local bridge=br0 diff --git a/os-plugins/plugins/qemukvm/init-hooks/60-have-servconfig/vm-dhcpd.sh b/os-plugins/plugins/qemukvm/init-hooks/60-have-servconfig/vm-dhcpd.sh new file mode 100755 index 00000000..153cac68 --- /dev/null +++ b/os-plugins/plugins/qemukvm/init-hooks/60-have-servconfig/vm-dhcpd.sh @@ -0,0 +1,56 @@ +#!/bin/ash +# Copyright (c) 2010 - 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 +# (should be kept identical to the files of virtualbox and vmware plugins) +############################################################################# + +# configuring dhcpd stub for virtual networks +testmkd /mnt/etc/opt/openslx +echo " +# general udhcpd configuration file for virtual machines written by +# $0 during OpenSLX stage3 configuration + +# start and end of the IP lease block +start CNETWORK.20 +end CNETWORK.100 + +# interface that udhcpd will use +interface NWIF + +# how long an offered address is reserved (leased) in seconds +offer_time 6000 + +# location of the leases file +lease_file LEASEDIR/udhcpd.leases + +# location of the pid file +pidfile PIDFILE/udhcpd.pid + +opt dns ${domain_name_servers} +option subnet 255.255.255.0 +opt router CNETWORK.254 +opt wins CNETWORK.10 +option domain virtual.site ${domain_name} + +# 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 +" >/mnt/etc/opt/openslx/udhcpd.conf |