summaryrefslogtreecommitdiffstats
path: root/os-plugins
diff options
context:
space:
mode:
authorDirk von Suchodoletz2008-03-16 20:50:31 +0100
committerDirk von Suchodoletz2008-03-16 20:50:31 +0100
commitff1dbeab165bdc5b5f3c8c146896551e78f4ff99 (patch)
tree31caab6debd68219a2026b6fa57890d00d12eb36 /os-plugins
parentMoving setup of client mode (variable desktop::kind) and displaymanager (diff)
downloadcore-ff1dbeab165bdc5b5f3c8c146896551e78f4ff99.tar.gz
core-ff1dbeab165bdc5b5f3c8c146896551e78f4ff99.tar.xz
core-ff1dbeab165bdc5b5f3c8c146896551e78f4ff99.zip
Working on the vmware plugin (see comments within the files ...)
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1637 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins')
-rw-r--r--os-plugins/plugins/vmware/OpenSLX/Distro/base.pm42
-rw-r--r--os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm40
-rw-r--r--os-plugins/plugins/vmware/XX_vmware.sh44
-rw-r--r--os-plugins/plugins/vmware/files/README8
-rw-r--r--os-plugins/plugins/vmware/files/dhcpd.conf1
-rwxr-xr-xos-plugins/plugins/vmware/files/vmware-startscript117
6 files changed, 251 insertions, 1 deletions
diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/base.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/base.pm
new file mode 100644
index 00000000..7bcdc1f0
--- /dev/null
+++ b/os-plugins/plugins/vmware/OpenSLX/Distro/base.pm
@@ -0,0 +1,42 @@
+# Copyright (c) 2008 - 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/
+# -----------------------------------------------------------------------------
+# base.pm
+# - provides empty base of the OpenSLX OSPlugin Distro API for the vmware
+# plugin.
+# -----------------------------------------------------------------------------
+package OpenSLX::Distro::base;
+
+use strict;
+use warnings;
+
+our $VERSION = 1.01; # API-version . implementation-version
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+sub new
+{
+ confess "Creating OpenSLX::OSPlugin::Distro::Base-objects directly makes no sense!";
+}
+
+sub initialize
+{
+ my $self = shift;
+ my $engine = shift;
+
+ return 1;
+}
+
+
+1;
diff --git a/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm b/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm
index 28193dff..ab975506 100644
--- a/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm
+++ b/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm
@@ -47,7 +47,8 @@ sub getInfo
}
sub getAttrInfo
-{ # returns a hash-ref with information about all attributes supported
+{
+ # returns a hash-ref with information about all attributes supported
# by this specific plugin
my $self = shift;
@@ -87,6 +88,43 @@ sub getAttrInfo
content_descr => 'Allowed values: path or URI',
default => '',
},
+ # attribute 'bridge' defines if bridged network mode should be
+ # switched on
+ 'vmware::bridge' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Should the bridging (direct access of the vmware clients
+ to the ethernet the host is connected to) be enabled
+ End-of-Here
+ content_descr => 'Allowed values: 0 or 1',
+ default => '',
+ },
+ # attribute 'vmnet1' defines if the host connection network mode
+ # should be switched on and NAT should be enabled
+ 'vmware::vmnet1' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Format ServerIP/Netprefix without NAT
+ Format ServerIP/Netprefix,NAT enables NAT/Masquerading
+ End-of-Here
+ content_descr => 'Allowed value: IP/Prefix[,NAT]',
+ default => '',
+ },
+ # attribute 'vmnet8' defines if vmware specific NATed network mode
+ # should be switched on
+ 'vmware::vmnet8' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Format ServerIP/Netprefix
+ End-of-Here
+ content_descr => 'Allowed value: IP/Prefix',
+ default => '',
+ },
+ # is to be discussed how to handle this - there is no single set of
+ # vmware files!!
# attribute 'binaries' defines whether or not VMware binaries shall
# be provided (by downloading them).
'vmware::binaries' => {
diff --git a/os-plugins/plugins/vmware/XX_vmware.sh b/os-plugins/plugins/vmware/XX_vmware.sh
index f0c75bfd..342718d4 100644
--- a/os-plugins/plugins/vmware/XX_vmware.sh
+++ b/os-plugins/plugins/vmware/XX_vmware.sh
@@ -38,6 +38,50 @@ if [ -e /initramfs/plugin-conf/vmware.conf ]; then
. /etc/functions
# D_INITDIR is defined in the following file:
. /etc/sysconfig/config
+
+ # prepare all needed vmware configuration files
+ testmkd /mnt/etc/vmware
+ # write the /etc/vmware/slxvmconfig file
+ # check for the several variables and write the several files
+ echo -e "# configuration file for vmware background services written in \
+stage3 setup" > /mnt/etc/vmware/slxvmconfig
+ if [ "bridge" = 1 ] ; then
+ echo "vmnet0=true" >> /mnt/etc/vmware/slxvmconfig
+ fi
+ # write the common dhcpd.conf header
+ if [ -n "vmnet1" -o -n "vmnet8" ] ; then
+ local dnslist=
+ echo "# /etc/vmware/dhcpd.conf written in stage3 ...\nallow \
+unknown-clients;\ndefault-lease-time 1800;\nmax-lease-time 7200;\n\
+option domain-name-servers $dnslist;\noption domain-name \"vm.local\";" \
+ > /mnt/etc/vmware/dhcpd.conf
+ fi
+ if [ -n "vmnet1" ] ; then
+ local vmnt=${vmnet1%,*}
+ vmnet1=${vmnet%,*}
+ local vmip=${vmnet1%/*}
+ local vmpx=${vmnet1#*/}
+ echo "vmnet1=$vmip/$vmpx" >> /mnt/etc/vmware/slxvmconfig
+ [ -n "$vmnt" ] && echo "vmnet1nat=true" >> /mnt/etc/vmware/slxvmconfig
+ echo "subnet $(ipcalc -n $vmip/$vmpx|sed s/.*=//) netmask \
+$(ipcalc -n $vmip/$vmpx|sed s/.*=//) {\n\trange $rstart $rend;\n\
+\toption broadcast $(ipcalc -b $vmip/$vmpx|sed s/.*=//);\n\
+\toption routers $vmip;\n}" > /mnt/etc/vmware/dhcpd.conf
+ fi
+ if [ -n "vmnet8" ] ; then
+ local vmip=${vmnet8%/*}
+ local vmpx=${vmnet8#*/}
+ echo "vmnet8=$vmip/$vmpx" >> /mnt/etc/vmware/slxvmconfig
+ echo "\nsubnet $(ipcalc -n $vmip/$vmpx|sed s/.*=//) netmask \
+$(ipcalc -n $vmip/$vmpx|sed s/.*=//) {\n\trange $rstart $rend;\n\
+\toption broadcast $(ipcalc -b $vmip/$vmpx|sed s/.*=//);\n\
+\toption routers $vmip;\n}" > /mnt/etc/vmware/dhcpd.conf
+ # generate the NAT configuration file
+ echo "# Linux NAT configuration file\n[host]\nip = $vmip/$vmpx\n\
+device = /dev/vmnet8\nactiveFTP = 1\n[udp]\ntimeout = 60\n[incomingtcp]\n\
+[incomingudp]" > /mnt/etc/vmware/nat.conf
+ echo "00:50:56:F1:30:50" > /mnt/etc/vmware/vmnet-natd-8.mac
+ fi
echo " * vmware part 1"
#############################################################################
diff --git a/os-plugins/plugins/vmware/files/README b/os-plugins/plugins/vmware/files/README
index 4bf303ec..3ff1d901 100644
--- a/os-plugins/plugins/vmware/files/README
+++ b/os-plugins/plugins/vmware/files/README
@@ -1,3 +1,11 @@
+ToDo!! There is an example script vmware-startscript which should be
+completed and incorporated into Stage1 plugin installer. It should be
+modified to look like the choosen vendor-os start scripts!
+
+The original /etc/init.d/vmware /etc/vmware/locations /etc/vmware/config
+files aren't needed any more!!
+
+
Files
- client-config.xml.default
Describes how the xml config needs to look like which will be used by
diff --git a/os-plugins/plugins/vmware/files/dhcpd.conf b/os-plugins/plugins/vmware/files/dhcpd.conf
index 6bc581a4..a9db38ad 100644
--- a/os-plugins/plugins/vmware/files/dhcpd.conf
+++ b/os-plugins/plugins/vmware/files/dhcpd.conf
@@ -1,3 +1,4 @@
+# should be autogenerated ...
#
# Configuration file for ISC 2.0b6pl1 vmnet-dhcpd operating on vmnet8.
#
diff --git a/os-plugins/plugins/vmware/files/vmware-startscript b/os-plugins/plugins/vmware/files/vmware-startscript
new file mode 100755
index 00000000..c6b22ee6
--- /dev/null
+++ b/os-plugins/plugins/vmware/files/vmware-startscript
@@ -0,0 +1,117 @@
+#!/bin/sh
+#
+# parts taken from vmware start script:
+# Copyright 1998-2007 VMware, Inc. All rights reserved.
+#
+# This script manages the services needed to run VMware software
+
+# Basic support for the Linux Standard Base Specification 1.3
+# Used by insserv and other LSB compliant tools.
+### BEGIN INIT INFO
+# Provides: VMware
+# Required-Start: $network $syslog
+# Required-Stop:
+# Default-Start: 2 3 5
+# Default-Stop: 0 6
+# Short-Description: Manages the services needed to run VMware software
+# Description: Manages the services needed to run VMware software
+### END INIT INFO
+
+# prereqs:
+# 1) a) this script b) the modules (vmmon, vmblock, vmnet) match the
+# installed vmware/player version (ensured by stage1 install)
+# 2) the script is tailored to the vendor-os we are running
+# 3) the script checks a configuration file to know which modes to
+# prepare
+# 4) we use the dhcp-server for ALL internal interfaces we are running
+# 5) stage3 produces a configfile /etc/vmware/slxvmconfig where the
+# settings of networking etc. are made
+
+# read the configuration file generated in stage3 to configure the
+# host internal interfaces
+#. /etc/vmware/slxvmconfig
+# testing only
+vmnet0=""
+vmnet1="192.168.101.1/24"
+vmnet8=""
+
+load_modules() {
+ # to be filled in via the stage1 configuration script
+ modprobe -qa vmmon vmnet vmblock 2>/dev/null
+ # most probably nobody wants to run the parallel port driver ...
+ #modprobe vm...
+}
+unload_modules() {
+ # to be filled in via the stage1 configuration script
+ rmmod vmmon vmblock vmnet #2>/dev/null
+}
+# the bridged interface
+setup_vmnet0() {
+ if [ -n "$vmnet0" ] ; then
+ # the path might be directly point to the plugin dir
+ /usr/bin/vmnet-bridge -d /var/run/vmnet-bridge-0.pid /dev/vmnet0 eth0
+ 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
+ /usr/bin/vmnet-netifup -d /var/run/vmnet-netifup-vmnet1.pid \
+ /dev/vmnet1 vmnet1
+ dhcpif="$dhcpif vmnet1"
+ ip addr add $vmnet1 dev vmnet1
+ 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
+ fi
+}
+# incomplete ...
+setup_vmnet8() {
+ if [ -n "$vmnet8" ] ; then
+ test -c /dev/vmnet1 || mknod c 119 8 /dev/vmnet8
+ # /etc/vmware/vmnet-natd-8.mac simply contains a mac like 00:50:56:F1:30:50
+ /usr/bin/vmnet-natd -d /var/run/vmnet-natd-8.pid \
+ -m /etc/vmware/vmnet-natd-8.mac -c /etc/vmware/nat.conf
+ dhcpif="$dhcpif vmnet8"
+ ip addr add $vmnet8 dev vmnet8
+ fi
+}
+runvmdhcpd() {
+ if [ -n "$dhcpif" ] ; then
+ # the path might be directly point to the plugin dir
+ mkdir /var/run/vmware 2>/dev/null
+ /usr/bin/vmnet-dhcpd -cf /etc/vmware/dhcpd.conf -lf \
+ /var/run/vmware/dhcpd.leases -pf /var/run/vmnet-dhcpd-vmnet8.pid $dhcpif
+ fi
+}
+
+case $1 in
+ start)
+ # message output should match the given vendor-os
+ echo "Starting vmware background services ..."
+ load_modules
+ setup_vmnet0
+ setup_vmnet1
+ setup_vmnet8
+ runvmdhcpd
+ ;;
+ stop)
+ # message output should match the given vendor-os
+ echo "Stopping vmware background services ..."
+ killall vmnet-netifup vmnet-natd vmnet-bridge vmware vmplayer \
+ vmware-tray 2>/dev/null
+ # wait for shutting down of interfaces
+ usleep 50000
+ unload_modules
+ ;;
+ status)
+ echo "Say something useful here ..."
+ ;;
+esac
+
+exit 0