diff options
author | Dirk von Suchodoletz | 2010-02-11 00:45:43 +0100 |
---|---|---|
committer | Dirk von Suchodoletz | 2010-02-11 00:45:43 +0100 |
commit | 8366523dedf9197d58c2c7030d98f2b7d470d06c (patch) | |
tree | 70639e415c177152a320251bb1b0ede772665028 /os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm | |
parent | same improvement as rf00b265a but for pbs (diff) | |
download | core-8366523dedf9197d58c2c7030d98f2b7d470d06c.tar.gz core-8366523dedf9197d58c2c7030d98f2b7d470d06c.tar.xz core-8366523dedf9197d58c2c7030d98f2b7d470d06c.zip |
Cleaning up the runlevel mess of vmware plugin ... Not finished yet.
Diffstat (limited to 'os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm')
-rw-r--r-- | os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm | 174 |
1 files changed, 0 insertions, 174 deletions
diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm index a57e5c8e..2e1197d8 100644 --- a/os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm +++ b/os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm @@ -25,178 +25,4 @@ use OpenSLX::Basics; ### interface methods ################################################################################ -sub fillRunlevelScript -{ - my $self = shift; - my $location = shift; - my $kind = shift; - - my $script = unshiftHereDoc(<<" End-of-Here"); - #!/sbin/runscript - # Gentoo compatible (hopefully) start/stop script, generated via stage1 'vmware' - # plugin installation - # - # inspiration taken from vmware start script: - # Copyright 1998-2007 VMware, Inc. All rights reserved. - # - # This script manages the services needed to run VMware software - - # dependency definitions - depend() { - # use syslog - # need ... - } - - # helper functions - load_modules() { - End-of-Here - - # load modules - if ($kind eq 'local' || $kind eq 'local25' || $kind eq 'local30') { - if ($kind eq 'local30') { - $script .= unshiftHereDoc(<<" End-of-Here"); - # vmplayer 3.0 specific stuff - insmod /lib/modules/\$(uname -r)/misc/vsock.ko || return 1 - insmod /lib/modules/\$(uname -r)/misc/vmci.ko || return 1 - End-of-Here - } - $script .= unshiftHereDoc(<<" End-of-Here"); - # to be filled in via the stage1 configuration script - insmod /lib/modules/\$(uname -r)/misc/vmmon.ko || return 1 - insmod /lib/modules/\$(uname -r)/misc/vmnet.ko || return 1 - insmod /lib/modules/\$(uname -r)/misc/vmblock.ko 2>/dev/null || return 0 - End-of-Here - } elsif ($kind eq 'vmpl1.0') { - $script .= unshiftHereDoc(<<" End-of-Here"); - vmware_kind_path=/opt/openslx/plugin-repo/vmware/${kind}/ - module_src_path=\${vmware_kind_path}/vmroot/modules - insmod \${module_src_path}/vmmon.ko - insmod \${module_src_path}/vmnet.ko - End-of-Here - } elsif ($kind eq "vmpl2.0") { - $script .= unshiftHereDoc(<<" End-of-Here"); - vmware_kind_path=/opt/openslx/plugin-repo/vmware/${kind}/ - module_src_path=\${vmware_kind_path}/vmroot/modules - insmod \${module_src_path}/vmmon.ko - insmod \${module_src_path}/vmnet.ko - insmod \${module_src_path}/vmblock.ko - End-of-Here - } elsif ($kind eq 'vmpl2.5') { - $script .= unshiftHereDoc(<<" End-of-Here"); - vmware_kind_path=/opt/openslx/plugin-repo/vmware/${kind}/ - module_src_path=\${vmware_kind_path}/vmroot/modules - insmod \${module_src_path}/vmmon.ko - insmod \${module_src_path}/vmnet.ko - insmod \${module_src_path}/vmblock.ko - End-of-Here - } elsif ($kind eq 'vmpl3.0') { - $script .= unshiftHereDoc(<<" End-of-Here"); - vmware_kind_path=/opt/openslx/plugin-repo/vmware/${kind}/ - module_src_path=\${vmware_kind_path}/vmroot/modules - insmod \${module_src_path}/vmmon.ko - insmod \${module_src_path}/vmnet.ko - insmod \${module_src_path}/vmblock.ko - insmod \${module_src_path}/vsock.ko - insmod \${module_src_path}/vmci.ko - End-of-Here - } - - # unload modules - $script .= unshiftHereDoc(<<" End-of-Here"); - } - - unload_modules() { - # to be filled with the proper list within via the stage1 - # configuration script - rmmod vmmon vmblock vmnet vmmon vmci vsock 2>/dev/null - } - End-of-Here - - - - # setup vmnet0 and vmnet8 - # depends on specific stage3 setting. I let this if in the code - # because else this whole if-reducing process will become more - # complicated and the code will get less understandable - $script .= unshiftHereDoc(<<" End-of-Here"); - # the bridged interface - setup_vmnet0() { - if [ -n "\$vmnet0" ] ; then - # the path might be directly point to the plugin dir - End-of-Here - if ($kind eq 'vmpl2.5' || $kind eq 'vmpl3.0' || $kind eq 'local25' || $kind eq 'local30') { - $script .= " $location/vmnet-bridge -d /var/run/vmnet-bridge-0.pid -n 0\n"; - } else { - $script .= " $location/vmnet-bridge -d /var/run/vmnet-bridge-0.pid /dev/vmnet0 eth0\n"; - } - $script .= unshiftHereDoc(<<" End-of-Here"); - fi - } - # we definately prefer the hostonly interface for NATed operation too - # distinction is made via enabled forwarding - setup_vmnet1() { - if [ -n "\$vmnet1" ] ; then - #test -c /dev/vmnet1 || mknod c 119 1 /dev/vmnet1 - # the path might be directly point to the plugin dir - $location/vmnet-netifup -d /var/run/vmnet-netifup-vmnet1.pid \\ - /dev/vmnet1 vmnet1 - dhcpif="\$dhcpif vmnet1" - ip addr add \$vmnet1 dev vmnet1 - ip link set vmnet1 up - if [ -n "\$vmnet1nat" ] ; then - # needs refinement interface name for eth0 is known in stage3 already - echo "1" > /proc/sys/net/ipv4/conf/vmnet1/forwarding 2>/dev/null - 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 2>/dev/null # or logfile - fi - } - # incomplete ... - setup_vmnet8() { - if [ -n "\$vmnet8" ] ; then - $location/vmnet-netifup -d /var/run/vmnet-netifup-vmnet8.pid \\ - /dev/vmnet8 vmnet8 - ip addr add \$vmnet8 dev vmnet8 - ip link set vmnet8 up - # /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 2>/dev/null # or logfile - $location/vmnet-dhcpd -cf /etc/vmware/dhcpd-vmnet8.conf \\ - -lf /var/run/vmware/dhcpd-vmnet8.leases \\ - -pf /var/run/vmnet-dhcpd-vmnet8.pid vmnet8 2>/dev/null # or logfile - fi - } - - # start/stop functions - start() { - ebegin "Starting vmware background services ..." - # include default directories - . /etc/opt/openslx/openslx.conf - # load the configuration file - . \${OPENSLX_DEFAULT_CONFDIR}/plugins/vmware/vmware.conf - load_modules || eerror "The loading of vmware modules failed" - setup_vmnet0 || eerror "Problems setting up vmnet0 interface" - setup_vmnet1 || eerror "Problems setting up vmnet1 interface" - setup_vmnet8 || eerror "Problems setting up vmnet8 interface" - eend $? - } - - stop() { - # message output should match the given vendor-os - ebegin "Stopping vmware background services ..." - killall vmnet-netifup vmnet-natd vmnet-bridge vmware vmplayer \\ - vmware-tray vmnet-dhcpd 2>/dev/null - # wait for shutting down of interfaces. vmnet needs kinda - # long - sleep 1 - unload_modules - eend $? - } - End-of-Here - return $script; -} - 1; |