summaryrefslogtreecommitdiffstats
path: root/os-plugins/plugins/vmware
diff options
context:
space:
mode:
authorDirk von Suchodoletz2009-02-18 22:49:44 +0100
committerDirk von Suchodoletz2009-02-18 22:49:44 +0100
commit86feb9d871595f4c1efe4e521ba2cdae021aa59b (patch)
treee9ad56a2a9dd48e249f7de98658d60f5d48c2ca8 /os-plugins/plugins/vmware
parentxserver plugin: (diff)
downloadcore-86feb9d871595f4c1efe4e521ba2cdae021aa59b.tar.gz
core-86feb9d871595f4c1efe4e521ba2cdae021aa59b.tar.xz
core-86feb9d871595f4c1efe4e521ba2cdae021aa59b.zip
More on the new virtualization starter framework.
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2609 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins/plugins/vmware')
-rw-r--r--os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm99
-rw-r--r--os-plugins/plugins/vmware/files/run-virt.include43
2 files changed, 71 insertions, 71 deletions
diff --git a/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm b/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm
index f52365d5..9835bb33 100644
--- a/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm
+++ b/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm
@@ -267,6 +267,10 @@ sub installationPhase
$self->{openslxConfigPath} = $info->{'openslx-config-path'};
$self->{attrs} = $info->{'plugin-attrs'};
+ # copy common part of run-virt.include to the appropriate place for
+ # inclusion in stage4
+ copyFile("$self->{openslxBasePath}/lib/plugins/vmware/files/run-virt.include",
+ "$self->{pluginRepositoryPath}/");
# kinds we will configure and install
# TODO: write a list of installed/setted up and check it in stage3
@@ -298,9 +302,6 @@ sub installationPhase
linkFile("/var/X11R6/bin/vmware", "/usr/bin/vmware");
rename("/usr/bin/vmware", "/usr/bin/vmware.slx-bak");
}
- # copy run-virt.include to the appropriate place for inclusion in stage4
- copyFile("$self->{openslxBasePath}/lib/plugins/vmware/files/run-virt.include",
- "$self->{pluginRepositoryPath}/");
}
sub removalPhase
@@ -387,10 +388,6 @@ sub _writeRunlevelScript
# call the distrospecific fillup
my $runlevelScript = $self->{distro}->fillRunlevelScript($location, $kind);
- # OLTA: this backup strategy is useless if invoked twice, so I have
- # deactivated it
- # rename($file, "${file}.slx-bak") if -e $file;
-
spitFile($file, $runlevelScript);
}
@@ -459,13 +456,50 @@ sub _writeVmwareConfig {
my $self = shift;
my $kind = shift;
my $vmpath = shift;
+ my %versionhash = (vmversion => "", vmbuildversion => "");
+ my $vmversion = "";
+ my $vmbuildversion = "";
+ my $config = "libdir=\"$vmpath\"\n";
- my $config = "libdir = \"$vmpath\"\n";
+ %versionhash = _getVersion($vmpath);
+
+ $config .= "version=\"".$versionhash{vmversion}."\"\n";
+ $config .= "buildversion=\"".$versionhash{vmbuildversion}."\"";
spitFile("$self->{'pluginRepositoryPath'}/$kind/config", $config);
chmod 0755, "$self->{'pluginRepositoryPath'}/$kind/config";
}
+sub _getVersion {
+
+ my $vmpath = shift;
+ my $vmversion = "";
+ my $vmbuildversion = "";
+ my %versioninfo = (vmversion => "", vmbuildversion => "");
+
+ # get version information about installed vmplayer
+ open(FH, "$vmpath/bin/vmplayer");
+ $/ = undef;
+ my $data = <FH>;
+ close FH;
+ # depending on the installation it could differ and has multiple build
+ # strings
+ if ($data =~ m{[^\d\.](\d\.\d) build-(\d+)}) {
+ $vmversion = $1;
+ $vmbuildversion = $2;
+ }
+ if ($data =~ m{\0(2\.[05])\.[0-9]}) {
+ $vmversion = $1;
+ }
+ # else { TODO: errorhandling if file or string doesn't exist }
+ chomp($vmversion);
+ chomp($vmbuildversion);
+
+ $versioninfo{vmversion} = $vmversion;
+ $versioninfo{vmbuildversion} = $vmbuildversion;
+ return %versioninfo;
+}
+
########################################################################
## Functions, which setup the different environments (local, ws-v(5.5|6),
## player-v(1|2)
@@ -481,6 +515,7 @@ sub _localInstallation
my $kind = "local";
my $vmpath = "/usr/lib/vmware";
my $vmbin = "/usr/bin";
+ my %versionhash = (vmversion => "", vmbuildversion => "");
my $vmversion = "";
my $vmbuildversion = "";
@@ -494,41 +529,12 @@ sub _localInstallation
# we will only use vmplayer
if (-e "/usr/lib/vmware/bin/vmplayer") {
- ##
## Get and write version information
+ %versionhash = _getVersion($vmpath);
+ $vmversion = $versionhash{vmversion};
+ $vmbuildversion = $versionhash{vmbuildversion};
- # get version information about installed vmplayer
- open(FH, "/usr/lib/vmware/bin/vmplayer");
- $/ = undef;
- my $data = <FH>;
- close FH;
- # perhaps we need to recheck the following check. depending
- # on the installation it could differ and has multiple build-
- # strings
- if ($data =~ m{[^\d\.](\d\.\d) build-(\d+)}) {
- $vmversion = $1;
- $vmbuildversion = $2;
- }
- if ($data =~ m{\0(2\.[05])\.[0-9]}) {
- $vmversion = $1;
- }
- # else { TODO: errorhandling if file or string doesn't exist }
- chomp($vmversion);
- chomp($vmbuildversion);
-
- # write informations about local installed vmplayer in file
- # TODO: perhaps we don't need this file.
- # TODO2: write vmbuildversion and stuff in runvmware in stage1
- open FILE, ">$self->{'pluginRepositoryPath'}/$kind/versioninfo.txt"
- or die $!;
- print FILE "vmversion=\"$vmversion\"\n";
- print FILE "vmbuildversion=\"$vmbuildversion\"\n";
- close FILE;
-
- ##
## Copy needed files
-
- # copy 'normal' needed files
my @files = qw(nvram.5.0);
foreach my $file (@files) {
copyFile("$pluginFilesPath/$file", "$installationPath");
@@ -545,8 +551,7 @@ sub _localInstallation
copyFile("$pluginFilesPath/runvmware-player-v25", "$installationPath", "runvmware");
}
- ##
- ## Create runlevel script
+ ## Create runlevel script -> to be fixed!!
my $runlevelScript = "$self->{'pluginRepositoryPath'}/$kind/vmware.init";
if ($vmversion eq "2.5") {
$self->_writeRunlevelScript($vmbin, $runlevelScript, "local25");
@@ -554,7 +559,6 @@ sub _localInstallation
$self->_writeRunlevelScript($vmbin, $runlevelScript, $kind);
}
- ##
## Create wrapperscripts
if (-e "/usr/bin/vmware") {
$self->_writeWrapperScript("$vmpath", "$kind", "ws")
@@ -564,6 +568,9 @@ sub _localInstallation
}
# else { TODO: errorhandling }
+
+ ## Creating needed config /etc/vmware/config
+ $self->_writeVmwareConfig("$kind", "$vmpath");
}
@@ -573,8 +580,6 @@ sub _vmpl2Installation {
my $kind = "vmpl2.0";
my $vmpath = "/opt/openslx/plugin-repo/vmware/$kind/vmroot/lib/vmware";
my $vmbin = "/opt/openslx/plugin-repo/vmware/$kind/vmroot/bin";
- my $vmversion = "TODO_we_need_it_for_enhanced_runvmware_config_in_stage?";
- my $vmbuildversion = "TODO_we_need_it_for_enhanced_runvmware_config_in_stage1";
my $pluginFilesPath
= "$self->{'openslxBasePath'}/lib/plugins/$self->{'name'}/files";
@@ -619,7 +624,7 @@ sub _vmpl25Installation {
my $kind = "vmpl2.5";
my $vmpath = "/opt/openslx/plugin-repo/vmware/$kind/vmroot/lib/vmware";
my $vmbin = "/opt/openslx/plugin-repo/vmware/$kind/vmroot/bin";
- my $vmversion = "TODO_we_need_it_for_enhanced_runvmware_config_in_stage?";
+ my $vmversion = "6.5";
my $vmbuildversion = "TODO_we_need_it_for_enhanced_runvmware_config_in_stage1";
my $pluginFilesPath
@@ -666,7 +671,7 @@ sub _vmpl1Installation {
my $kind = "vmpl1.0";
my $vmpath = "/opt/openslx/plugin-repo/vmware/$kind/vmroot/lib/vmware";
my $vmbin = "/opt/openslx/plugin-repo/vmware/$kind/vmroot/bin";
- my $vmversion = "TODO_we_need_it_for_enhanced_runvmware_config_in_stage?";
+ my $vmversion = "5.5";
my $vmbuildversion = "TODO_we_need_it_for_enhanced_runvmware_config_in_stage1";
my $pluginFilesPath
diff --git a/os-plugins/plugins/vmware/files/run-virt.include b/os-plugins/plugins/vmware/files/run-virt.include
index 49df4c38..5afe3692 100644
--- a/os-plugins/plugins/vmware/files/run-virt.include
+++ b/os-plugins/plugins/vmware/files/run-virt.include
@@ -18,6 +18,15 @@
# declaration of default variables
################################################################################
+# temporary disk space for logs, etc...
+redodir=/tmp/vmware/${USER}
+# dir for configs and vmem file
+confdir=${redodir}
+# configfile
+conffile="${confdir}/run-vmware.conf"
+# users vmware config folder
+vmhome="${HOME}/.vmware"
+
# serial port defined (e.g. "ttyS0" or "autodetect")
serial=$(grep -i "<serial port=\"" ${xml} | awk -F "\"" '{ print $2 }')
case "$serial" in
@@ -71,26 +80,17 @@ ide="TRUE"
scsi="FALSE"
hddrv="ide"
+# get version info
+. /etc/vmware/config
+
# VMplayer buildversion
-vmbuild=
+vmbuild=$buildversion
+vmversion=$version
# VMware start options
#-X = fullscreen
vmopt="-X"
-# temporary disk space for logs, etc...
-# use /tmp/vmware/${USER} if /tmp sits on NFS import
-redodir=/tmp/vmware/${USER}
-
-# dir for configs and vmem file
-confdir=${redodir}
-
-# configfile
-conffile="${confdir}/run-vmware.conf"
-
-# users vmware config folder
-vmhome="${HOME}/.vmware"
-
# config and hardware version ex. 8/6 for VMware6.5
# will be replaced automatically during run of vmware/player
confver=8
@@ -102,7 +102,7 @@ vmdir="/var/lib/virt/vmware/vmware65"
# special Variables, persistence vmware?
#TODO: do we really need it? Should be everywhere nonpersistent
-np="independent-nonpersistent"
+np=""
#TODO: check for a faster way, perhaps we should put this into XML
@@ -124,10 +124,6 @@ fi
# Should we debug? Hell yes, we should always debug!
debug=0
-#TODO: Bad done... we should do this another way later
-version=$(head -n 20 $0 | grep "# Version: " | awk '{print $3}')
-
-
filecheck ()
{
filecheck=$(LANG=us ls -lh ${diskfile} 2>&1)
@@ -202,7 +198,7 @@ numvcpus = \"1\"
# ide-disks
ide0:0.present = \"${ide}\"
ide0:0.fileName = \"${diskfile}\"
-ide0:0.mode = \"${np}\"
+ide0:0.mode = \"independent-nonpersistent\"
ide1:0.present = \"${cdr_1}\"
ide1:0.autodetect = \"TRUE\"
ide1:0.fileName = \"auto detect\"
@@ -217,7 +213,7 @@ scsi0.present = \"${scsi}\"
scsi0:0.present = \"${scsi}\"
scsi0:0.fileName = \"${diskfile}\"
scsi0.virtualDev = \"lsilogic\" #\"${hddrv}\"
-scsi0:0.mode = \"${np}\"
+scsi0:0.mode = \"independent-nonpersistent\"
# floppies
floppy0.present = \"${floppya}\"
@@ -353,7 +349,7 @@ mkdir -p ${vmhome} >/dev/null 2>&1
## log script information
writelog "# File created by $0 (v.${version})\n# on $(date)\n"
-writelog "Starting with $(echo ${np} | sed 's/i.*-//g')-mode ...\n"
+writelog "Starting with nonpersistent mode ...\n"
## look for cdrom, dvd and add them to the vm config file
@@ -391,7 +387,7 @@ writelog "\tVMostype:\t${vmostype}"
writelog "\tDisplayname:\t${displayname}"
# check if image exists, etc...
-filecheck
+#filecheck
# VMPlayer Version.
# strings is the fastest and most secure way, vmplayer -v takes too much time
@@ -424,4 +420,3 @@ done
# set the variables appropriately
VIRTCMD=vmplayer
VIRTCMDOPTS="${vmopt} ${conffile}"
-