From 85c3afe09fbdd38acc461aa7965409a1d3ffa858 Mon Sep 17 00:00:00 2001 From: Michael Janczyk Date: Fri, 19 Mar 2010 17:33:16 +0100 Subject: virtualbox, vmgrix und xen anpassungen --- .../virtualbox/OpenSLX/OSPlugin/virtualbox.pm | 59 +++++++++++++--------- 1 file changed, 34 insertions(+), 25 deletions(-) (limited to 'os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm') diff --git a/os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm b/os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm index fd1424f1..8e04fdd6 100644 --- a/os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm +++ b/os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm @@ -115,18 +115,24 @@ sub installationPhase # Different names of the tool (should be unified somehow!?) if (!isInPath('VirtualBox')) { # todo: fix this - $self->{distro}->installVbox(); + $self->{distro}->installVbox(); } if (!isInPath('VirtualBox')) { - print "VirtualBox is not installed. VirtualBox Plugin won't be installed!\n"; + print "VirtualBox is not installed. VirtualBox Plugin won't be installed!\n"; # exit - } + } $self->_writeRunlevelScript(); - # Copy run-virt.include to the appropriate place for inclusion in stage4 - copyFile("$self->{openslxBasePath}/lib/plugins/virtualbox/files/run-virt.include", - "$self->{pluginRepositoryPath}/"); + # Copy run-virt.include and template files to the appropriate place for + # inclusion in stage4 + my $pluginName = $self->{'name'}; + my $pluginBasePath = "$self->{openslxBasePath}/lib/plugins/$pluginName/files"; + foreach my $file ( qw( run-virt.include virtualbox.include machine.include + empty-diff*.vdi.gz ) ) { + copyFile("$pluginBasePath/$file", "$self->{pluginRepositoryPath}/"); + chmod 0755, "$self->{pluginRepositoryPath}/$file"; + } return; } @@ -157,6 +163,7 @@ sub _writeRunlevelScript my $self = shift; my $initfile = newInitFile(); + my $script = ""; $initfile->setName("vbox-slx"); $initfile->setDesc("Setup environment for virtualbox. Part of OpenSLX virtualbox plugin."); @@ -166,30 +173,34 @@ sub _writeRunlevelScript 'running', 'lsmod | grep -q "$1[^_-]"' ); + # + $script = unshiftHereDoc(<<' End-of-Here'); + if running vboxdrv; then + if running vboxnetflt; then + echo "VirtualBox kernel modules (vboxdrv and vboxnetflt) are loaded." + else + echo "VirtualBox kernel module is loaded." + fi + #TODO: check it: ignore user check. handling our own way: + for i in /tmp/.vbox-*-ipc; do + echo "Running: " + $(VBoxManage -q list runningvms | sed -e 's/^".*"//' 2>/dev/null) + done + else + echo "VirtualBox kernel module(s) are not loaded." + fi + End-of-Here $initfile->addFunction( - 'vmstatus', - 'if running vboxdrv; then - if running vboxnetflt; then - echo "VirtualBox kernel modules (vboxdrv and vboxnetflt) are loaded." - else - echo "VirtualBox kernel module is loaded." - fi - #TODO: check it: ignore user check. handling our own way: - for i in /tmp/.vbox-*-ipc; do - echo "Running: " - $(VBoxManage --nologo list runningvms | sed -e \'s/^".*"//\' 2>/dev/null) - done - else - echo "VirtualBox kernel module is not loaded." - fi' + "vmstatus", + "$script" ); $initfile->addFunction( 'start', - ' modprobe vboxdrv && modprobe vboxnetflt', + ' modprobe -qa vboxdrv vboxnetflt vboxnetadp', ); $initfile->addFunction( 'stop', - ' rmmod vboxnetflt && rmmod vboxdrv', + ' rmmod vboxnetadp vboxnetflt vboxdrv', ); $initfile->addToCase( 'start', @@ -212,8 +223,6 @@ sub _writeRunlevelScript my $distro = (split('-',$self->{'os-plugin-engine'}->distroName()))[0]; my $runlevelscript = getInitFileForDistro($initfile, $distro); - # todo: because we dont have distribution or version dependend - # init scripts we could put it directly into /etc/init.d... spitFile("$self->{'pluginRepositoryPath'}/vbox-slx", $runlevelscript); } -- cgit v1.2.3-55-g7522