From 4e65ca9800ea97a9dbee257b9a40dcbaeb99bb88 Mon Sep 17 00:00:00 2001 From: Dirk von Suchodoletz Date: Mon, 2 Jun 2008 15:50:09 +0000 Subject: Little bit of cleanup in vmware plugin and dealing with the restricted capabilities of vmware-dhcpd server ... git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1834 95ad53e4-c205-0410-b2fa-d234c58c8868 --- os-plugins/plugins/vmware/OpenSLX/Distro/Base.pm | 15 ++--- os-plugins/plugins/vmware/OpenSLX/Distro/Debian.pm | 15 ++--- os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm | 15 ++--- os-plugins/plugins/vmware/OpenSLX/Distro/Suse.pm | 15 ++--- .../plugins/vmware/OpenSLX/OSPlugin/vmware.pm | 12 ++-- os-plugins/plugins/vmware/XX_vmware.sh | 64 +++++++++------------- 6 files changed, 58 insertions(+), 78 deletions(-) diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/Base.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/Base.pm index 25e14e1c..2dfc2700 100644 --- a/os-plugins/plugins/vmware/OpenSLX/Distro/Base.pm +++ b/os-plugins/plugins/vmware/OpenSLX/Distro/Base.pm @@ -99,6 +99,9 @@ sub fillRunlevelScript echo "1" > /proc/sys/net/ipv4/conf/eth0/forwarding 2>/dev/null #iptables -A -s vmnet1 -d eth0 fi + $location/vmnet-dhcpd -cf /etc/vmware/dhcpd-vmnet1.conf -lf \\ + /var/run/vmware/dhcpd-vmnet1.leases \\ + -pf /var/run/vmnet-dhcpd-vmnet1.pid vmnet1 fi } # incomplete ... @@ -112,14 +115,9 @@ sub fillRunlevelScript # /etc/vmware/vmnet-natd-8.mac simply contains a mac like 00:50:56:F1:30:50 $location/vmnet-natd -d /var/run/vmnet-natd-8.pid \\ -m /etc/vmware/vmnet-natd-8.mac -c /etc/vmware/nat.conf - dhcpif="\$dhcpif vmnet8" - fi - } - runvmdhcpd() { - if [ -n "\$dhcpif" ] ; then - # the path might be directly point to the plugin dir - $location/vmnet-dhcpd -cf /etc/vmware/dhcpd.conf -lf \\ - /var/run/vmware/dhcpd.leases -pf /var/run/vmnet-dhcpd-vmnet8.pid \$dhcpif + $location/vmnet-dhcpd -cf /etc/vmware/dhcpd-vmnet8.conf -lf \\ + /var/run/vmware/dhcpd-vmnet8.leases \\ + -pf /var/run/vmnet-dhcpd-vmnet8.pid vmnet8 fi } case \$1 in @@ -131,7 +129,6 @@ sub fillRunlevelScript setup_vmnet0 setup_vmnet1 setup_vmnet8 - runvmdhcpd ;; stop) # message output should match the given vendor-os diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/Debian.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/Debian.pm index 6056fc38..5991d6ad 100644 --- a/os-plugins/plugins/vmware/OpenSLX/Distro/Debian.pm +++ b/os-plugins/plugins/vmware/OpenSLX/Distro/Debian.pm @@ -89,6 +89,9 @@ sub fillRunlevelScript echo "1" > /proc/sys/net/ipv4/conf/eth0/forwarding 2>/dev/null #iptables -A -s vmnet1 -d eth0 fi + $location/vmnet-dhcpd -cf /etc/vmware/dhcpd-vmnet1.conf -lf \\ + /var/run/vmware/dhcpd-vmnet1.leases \\ + -pf /var/run/vmnet-dhcpd-vmnet1.pid vmnet1 fi } # incomplete ... @@ -104,14 +107,9 @@ sub fillRunlevelScript # /etc/vmware/vmnet-natd-8.mac simply contains a mac like 00:50:56:F1:30:50 $location/vmnet-natd -d /var/run/vmnet-natd-8.pid \\ -m /etc/vmware/vmnet-natd-8.mac -c /etc/vmware/nat.conf - dhcpif="\$dhcpif vmnet8" - fi - } - runvmdhcpd() { - if [ -n "\$dhcpif" ] ; then - # the path might be directly point to the plugin dir - $location/vmnet-dhcpd -cf /etc/vmware/dhcpd.conf -lf \\ - /var/run/vmware/dhcpd.leases -pf /var/run/vmnet-dhcpd-vmnet8.pid \$dhcpif + $location/vmnet-dhcpd -cf /etc/vmware/dhcpd-vmnet8.conf \\ + -lf /var/run/vmware/dhcpd-vmnet8.leases \\ + -pf /var/run/vmnet-dhcpd-vmnet1.pid vmnet8 fi } # initialize the lsb status messages @@ -126,7 +124,6 @@ sub fillRunlevelScript setup_vmnet0 || log_warning_msg "Problems setting up vmnet0 interface" setup_vmnet1 || log_warning_msg "Problems setting up vmnet1 interface" setup_vmnet8 || log_warning_msg "Problems setting up vmnet8 interface" - runvmdhcpd || log_warning_msg "Problems starting vmware dhcpd" log_end_msg $? ;; stop) diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm index bb8c124a..c11994f1 100644 --- a/os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm +++ b/os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm @@ -82,6 +82,9 @@ sub fillRunlevelScript echo "1" > /proc/sys/net/ipv4/conf/eth0/forwarding 2>/dev/null #iptables -A -s vmnet1 -d eth0 fi + $location/vmnet-dhcpd -cf /etc/vmware/dhcpd-vmnet8.conf \\ + -lf /var/run/vmware/dhcpd-vmnet1.leases \\ + -pf /var/run/vmnet-dhcpd-vmnet1.pid vmnet1 fi } # incomplete ... @@ -95,14 +98,9 @@ sub fillRunlevelScript # /etc/vmware/vmnet-natd-8.mac simply contains a mac like 00:50:56:F1:30:50 $location/vmnet-natd -d /var/run/vmnet-natd-8.pid \\ -m /etc/vmware/vmnet-natd-8.mac -c /etc/vmware/nat.conf - dhcpif="\$dhcpif vmnet8" - fi - } - runvmdhcpd() { - if [ -n "\$dhcpif" ] ; then - # the path might be directly point to the plugin dir - $location/vmnet-dhcpd -cf /etc/vmware/dhcpd.conf -lf \\ - /var/run/vmware/dhcpd.leases -pf /var/run/vmnet-dhcpd-vmnet8.pid \$dhcpif + $location/vmnet-dhcpd -cf /etc/vmware/dhcpd-vmnet8.conf \\ + -lf /var/run/vmware/dhcpd-vmnet8.leases \\ + -pf /var/run/vmnet-dhcpd-vmnet8.pid vmnet8 fi } @@ -115,7 +113,6 @@ sub fillRunlevelScript setup_vmnet0 || eerror "Problems setting up vmnet0 interface" setup_vmnet1 || eerror "Problems setting up vmnet1 interface" setup_vmnet8 || eerror "Problems setting up vmnet8 interface" - runvmdhcpd eend $? } diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/Suse.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/Suse.pm index e649f27c..7e09e3c9 100644 --- a/os-plugins/plugins/vmware/OpenSLX/Distro/Suse.pm +++ b/os-plugins/plugins/vmware/OpenSLX/Distro/Suse.pm @@ -89,6 +89,9 @@ sub fillRunlevelScript echo "1" > /proc/sys/net/ipv4/conf/eth0/forwarding 2>/dev/null #iptables -A -s vmnet1 -d eth0 fi + $location/vmnet-dhcpd -cf /etc/vmware/dhcpd-vmnet1.conf \\ + -lf /var/run/vmware/dhcpd-vmnet1.leases \\ + -pf /var/run/vmnet-dhcpd-vmnet1.pid vmnet1 fi } # incomplete ... @@ -104,14 +107,9 @@ sub fillRunlevelScript # /etc/vmware/vmnet-natd-8.mac simply contains a mac like 00:50:56:F1:30:50 $location/vmnet-natd -d /var/run/vmnet-natd-8.pid \\ -m /etc/vmware/vmnet-natd-8.mac -c /etc/vmware/nat.conf - dhcpif="\$dhcpif vmnet8" - fi - } - runvmdhcpd() { - if [ -n "\$dhcpif" ] ; then - # the path might be directly point to the plugin dir - $location/vmnet-dhcpd -cf /etc/vmware/dhcpd.conf -lf \\ - /var/run/vmware/dhcpd.leases -pf /var/run/vmnet-dhcpd-vmnet8.pid \$dhcpif + $location/vmnet-dhcpd -cf /etc/vmware/dhcpd-vmnet8.conf \\ + -lf /var/run/vmware/dhcpd-vmnet8.leases \\ + -pf /var/run/vmnet-dhcpd-vmnet8.pid vmnet8 fi } # load the helper stuff @@ -128,7 +126,6 @@ sub fillRunlevelScript setup_vmnet0 setup_vmnet1 setup_vmnet8 - runvmdhcpd rc_status -v ;; stop) diff --git a/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm b/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm index aa3bb832..4207a12d 100644 --- a/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm +++ b/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm @@ -41,7 +41,9 @@ sub getInfo return { description => unshiftHereDoc(<<' End-of-Here'), - !!! descriptive text missing here !!! + Module for enabling services of VMware Inc. on an OpenSLX stateless + client. This plugin might use pre-existing installations of VMware + tools or install addional variants and versions. End-of-Here precedence => 70, }; @@ -337,7 +339,7 @@ sub _localInstallation if (-e "/usr/lib/vmware/bin/vmplayer") { ## - ## Get and write version informations + ## Get and write version information # get version information about installed vmplayer open(FH, "/usr/lib/vmware/bin/vmplayer"); @@ -368,11 +370,11 @@ sub _localInstallation ## Copy needed files # copy 'normal' needed files - my @files = qw( nvram.5.0); + my @files = qw(nvram.5.0); foreach my $file (@files) { copyFile("$pluginFilesPath/$file", "$installationPath"); } - # copy depends on version and rename it to runvmware, safes one check in stage3 + # copy depends on version and rename it to runvmware, saves one check in stage3 if ($vmversion < "6") { print "\n\nDEBUG: player version $vmversion, we use -v1\n\n"; copyFile("$pluginFilesPath/runvmware-player-v1", "$installationPath", "runvmware"); @@ -395,7 +397,7 @@ sub _localInstallation } ## - ## replacement with our, faster wrapper script + ## replacement with our faster wrapper script # rename the default vmplayer script and copy it. remove function takes # care about plugin remove. We only need this part if vmplayer diff --git a/os-plugins/plugins/vmware/XX_vmware.sh b/os-plugins/plugins/vmware/XX_vmware.sh index 6df821eb..3d3f3cc3 100644 --- a/os-plugins/plugins/vmware/XX_vmware.sh +++ b/os-plugins/plugins/vmware/XX_vmware.sh @@ -13,10 +13,8 @@ # # TODO: nvram,functions -# check if we really need locations and config if we create our own -# vmware start script ... -# to be decided where: Stage1 or here in Stage3 --> -# write /etc/vmware/locations, /etc/vmware/config, /etc/init.d/vmware +# write /etc/vmware/config (if a non-standard location of vmware basedir is +# to be configured), /etc/init.d/vmware # check if the configuration file is available if [ -e /initramfs/plugin-conf/vmware.conf ]; then @@ -56,24 +54,24 @@ stage3 setup" > /mnt/etc/vmware/slxvmconfig # write the common dhcpd.conf header for vmnet1,8 if [ -n "$vmware_vmnet1" -o -n "$vmware_vmnet8" ] ; then # use the dns servers known to the vmware host - # TODO: to be checked!! local dnslist=$(echo "$domain_name_servers"|sed "s/ /,/g") - echo "# /etc/vmware/dhcpd.conf written in stage3 ..." \ - > /mnt/etc/vmware/dhcpd.conf + echo "# Common dhcpd.conf header written in stage3 ..." \ + > /mnt/etc/vmware/dhcpd-head.conf echo "allow unknown-clients;" \ - >> /mnt/etc/vmware/dhcpd.conf + >> /mnt/etc/vmware/dhcpd-head.conf echo "default-lease-time 1800;" \ - >> /mnt/etc/vmware/dhcpd.conf + >> /mnt/etc/vmware/dhcpd-head.conf echo "max-lease-time 7200;" \ - >> /mnt/etc/vmware/dhcpd.conf + >> /mnt/etc/vmware/dhcpd-head.conf echo "option domain-name-servers $dnslist;" \ - >> /mnt/etc/vmware/dhcpd.conf + >> /mnt/etc/vmware/dhcpd-head.conf echo "option domain-name \"vm.local\";" \ - >> /mnt/etc/vmware/dhcpd.conf + >> /mnt/etc/vmware/dhcpd-head.conf fi # variable might contain ",NAT" which is to be taken off if [ -n "$vmware_vmnet1" ] ; then + cp /mnt/etc/vmware/dhcpd-head.conf /mnt/etc/vmware/dhcpd-vmnet1.conf local vmnet1=${vmware_vmnet1%,*} # x.x.x.x/yy,NAT => 'x.x.x.x/yy' local vmnat=${vmware_vmnet1#$vmnet1*} # x.x.x.x/yy,NAT => ',NAT' local vmip=${vmnet1%/*} # x.x.x.x/yy => 'x.x.x.x'"> @@ -82,40 +80,41 @@ stage3 setup" > /mnt/etc/vmware/slxvmconfig echo -e "vmnet1=$vmnet1" >> /mnt/etc/vmware/slxvmconfig [ -n "$vmnat" ] && echo "vmnet1nat=true" >> /mnt/etc/vmware/slxvmconfig echo -e "\n# definition for virtual vmnet1 interface" \ - >> /mnt/etc/vmware/dhcpd.conf + >> /mnt/etc/vmware/dhcpd-vmnet1.conf echo -e "subnet $(ipcalc -n $vmnet1|sed s/.*=//) netmask \ $(ipcalc -m $vmnet1|sed s/.*=//) {" \ - >> /mnt/etc/vmware/dhcpd.conf + >> /mnt/etc/vmware/dhcpd-vmnet1.conf echo -e "\trange ${vmsub}.10 ${vmsub}.20;" \ - >> /mnt/etc/vmware/dhcpd.conf + >> /mnt/etc/vmware/dhcpd-vmnet1.conf echo -e "\toption broadcast-address $(ipcalc -b $vmnet1|sed s/.*=//);" \ - >> /mnt/etc/vmware/dhcpd.conf + >> /mnt/etc/vmware/dhcpd-vmnet1.conf echo -e "\toption routers $vmip;" \ - >> /mnt/etc/vmware/dhcpd.conf + >> /mnt/etc/vmware/dhcpd-vmnet1.conf echo -e "}" \ - >> /mnt/etc/vmware/dhcpd.conf + >> /mnt/etc/vmware/dhcpd-vmnet1.conf mknod /dev/vmnet1 c 119 1 fi # vmware nat interface configuration if [ -n "$vmware_vmnet8" ] ; then + cp /mnt/etc/vmware/dhcpd-head.conf /mnt/etc/vmware/dhcpd-vmnet8.conf local vmip=${vmware_vmnet8%/*} local vmpx=${vmware_vmnet8#*/} local vmsub=$(echo $vmip |sed 's,\(.*\)\..*,\1,') # x.x.x.x => x.x.x"> echo -e "vmnet8=$vmip/$vmpx" >> /mnt/etc/vmware/slxvmconfig echo -e "\n# definition for virtual vmnet8 interface" \ - >> /mnt/etc/vmware/dhcpd.conf + >> /mnt/etc/vmware/dhcpd-vmnet8.conf echo -e "subnet $(ipcalc -n $vmip/$vmpx|sed s/.*=//) netmask \ $(ipcalc -m $vmip/$vmpx|sed s/.*=//) {" \ - >> /mnt/etc/vmware/dhcpd.conf + >> /mnt/etc/vmware/dhcpd-vmnet8.conf echo -e "\trange ${vmsub}.10 ${vmsub}.20;" \ - >> /mnt/etc/vmware/dhcpd.conf + >> /mnt/etc/vmware/dhcpd-vmnet8.conf echo -e "\toption broadcast-address $(ipcalc -b $vmip/$vmpx|sed s/.*=//);" \ - >> /mnt/etc/vmware/dhcpd.conf + >> /mnt/etc/vmware/dhcpd-vmnet8.conf echo -e "\toption routers $vmip;" \ - >> /mnt/etc/vmware/dhcpd.conf + >> /mnt/etc/vmware/dhcpd-vmnet8.conf echo -e "}" \ - >> /mnt/etc/vmware/dhcpd.conf + >> /mnt/etc/vmware/dhcpd-vmnet8.conf echo -e "# Linux NAT configuration file" \ > /mnt/etc/vmware/nat.conf echo -e "[host]" \ @@ -149,13 +148,6 @@ $(ipcalc -m $vmip/$vmpx|sed s/.*=//) {" \ # * VM images in /usr/share/vmware - then simply link # * VM images via additional mount (mount source NFS, NBD, ...) - # TODO: shouldn't that handled by the vmchooser plugin!?! - # since we have the vmchooser plugin yes... => commented out - # map slxgrp to pool, so it's better to understand - #pool=${slxgrp} - # if we dont have slxgrp defined - #[ -z "${pool}" ] && pool="default" - # get source of vmware image server (get type, server and path) if strinstr "/" "${vmware_imagesrc}" ; then vmimgprot=$(uri_token ${vmware_imagesrc} prot) @@ -201,7 +193,8 @@ $(ipcalc -m $vmip/$vmpx|sed s/.*=//) {" \ done # make vmware dhcpd more silent - touch /mnt/var/run/vmware/dhcpd.leases + touch /mnt/var/run/vmware/dhcpd-vmnet1.leases \ + /mnt/var/run/vmware/dhcpd-vmnet8.leases # create the needed devices which effects all vmware options # they are not created automatically via module load @@ -237,16 +230,14 @@ $(ipcalc -m $vmip/$vmpx|sed s/.*=//) {" \ echo -e "\tmount -t usbfs usbfs /proc/bus/usb 2>/dev/null" \ >>/mnt/etc/${D_INITDIR}/boot.slx - # TODO: perhaps we can a) kick out vmdir # b) configure vmdir by plugin configuration # TODO: How to start it. See Wiki. Currently a) implemnted # a) we get get information and start the programm with - # /var/X11R6/bin/run-vmware.sh "$imagename" "$name_for_vmwindow" "$ostype_of_vm" "$kind_of_network" + # /var/X11R6/bin/run-vmware.sh "$imagename" "$name_for_vmwindow" \ + # "$ostype_of_vm" "$kind_of_network" # b) we write a wrapper and get the xml-file as attribute - # A) wait for answer of Bastian - ## ## Copy version depending files cp /mnt/opt/openslx/plugin-repo/vmware/${vmware_kind}/runvmware \ /mnt/var/X11R6/bin/run-vmware.sh @@ -262,7 +253,6 @@ $(ipcalc -m $vmip/$vmpx|sed s/.*=//) {" \ chmod 644 /mnt/etc/vmware/config fi - [ $DEBUGLEVEL -gt 0 ] && echo " * done with 'vmware' os-plugin ..." fi -- cgit v1.2.3-55-g7522