summaryrefslogtreecommitdiffstats
path: root/os-plugins/plugins
diff options
context:
space:
mode:
authorroot2010-04-13 15:49:09 +0200
committerroot2010-04-13 15:49:09 +0200
commit91c3a8df4be49fba4c7398413e15fc9868b94bd0 (patch)
tree7305f330b58eed9a0d9bd01b20ca0efbe8b4f23d /os-plugins/plugins
parentfix pbs stuff (diff)
parentvirtualization plugin, now with calculation of mem, run-vmgrid and run-virt u... (diff)
downloadcore-91c3a8df4be49fba4c7398413e15fc9868b94bd0.tar.gz
core-91c3a8df4be49fba4c7398413e15fc9868b94bd0.tar.xz
core-91c3a8df4be49fba4c7398413e15fc9868b94bd0.zip
Merge branch 'master' of git@openslx.org:openslx/core
Diffstat (limited to 'os-plugins/plugins')
-rw-r--r--os-plugins/plugins/bootsplash/init-hooks/10-nw-if-config/bootsplash.sh (renamed from os-plugins/plugins/bootsplash/init-hooks/10-have-nw-modules/bootsplash.sh)0
-rw-r--r--os-plugins/plugins/desktop/OpenSLX/Distro/Scilin.pm10
-rw-r--r--os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm8
-rw-r--r--os-plugins/plugins/desktop/OpenSLX/Distro/Suse_10_2.pm4
-rw-r--r--os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu.pm68
-rw-r--r--os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu_8.pm161
-rw-r--r--os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu_9_04.pm161
-rw-r--r--os-plugins/plugins/pvs/OpenSLX/OSPlugin/pvs.pm2
-rw-r--r--os-plugins/plugins/pvs/XX_pvs.sh20
-rw-r--r--os-plugins/plugins/qemukvm/OpenSLX/OSPlugin/qemukvm.pm102
-rw-r--r--os-plugins/plugins/qemukvm/XX_qemukvm.sh155
-rw-r--r--os-plugins/plugins/qemukvm/files/ifdown (renamed from os-plugins/plugins/qemukvm/files/qemu-ifdown)21
-rw-r--r--os-plugins/plugins/qemukvm/files/ifup75
-rw-r--r--os-plugins/plugins/qemukvm/files/qemu-ifup55
-rw-r--r--os-plugins/plugins/qemukvm/files/run-virt.include283
-rw-r--r--os-plugins/plugins/qemukvm/init-hooks/20-nw-bridge-config/bridge.sh2
-rwxr-xr-xos-plugins/plugins/qemukvm/init-hooks/60-have-servconfig/vm-dhcpd.sh60
-rw-r--r--os-plugins/plugins/syslog/OpenSLX/Distro/Base.pm15
-rw-r--r--os-plugins/plugins/syslog/OpenSLX/OSPlugin/syslog.pm38
-rw-r--r--os-plugins/plugins/virtualbox/OpenSLX/Distro/Suse.pm1
-rw-r--r--os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm17
-rw-r--r--os-plugins/plugins/vmchooser/OpenSLX/Distro/Base.pm8
-rw-r--r--os-plugins/plugins/vmchooser/OpenSLX/Distro/Suse.pm24
-rw-r--r--os-plugins/plugins/vmchooser/XX_vmchooser.sh28
-rw-r--r--os-plugins/plugins/vmchooser/files/run-virt.sh79
-rw-r--r--os-plugins/plugins/vmchooser/init-hooks/80-after-plugins/virtualization.sh135
-rw-r--r--os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm322
-rw-r--r--os-plugins/plugins/vmgrid/XX_vmgrid.sh104
-rw-r--r--os-plugins/plugins/vmgrid/files/run-vmgrid.sh395
-rw-r--r--os-plugins/plugins/vmgrid/files/vmgrid143
-rw-r--r--os-plugins/plugins/vmgrid/init-hooks/80-after-plugins/virtualization.sh135
-rw-r--r--os-plugins/plugins/vmware/OpenSLX/Distro/Base.pm186
-rw-r--r--os-plugins/plugins/vmware/OpenSLX/Distro/Fedora.pm3
-rw-r--r--os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm174
-rw-r--r--os-plugins/plugins/vmware/OpenSLX/Distro/Suse.pm207
-rw-r--r--os-plugins/plugins/vmware/OpenSLX/Distro/Ubuntu.pm2
-rw-r--r--os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm233
-rw-r--r--os-plugins/plugins/vmware/XX_vmware.sh82
-rw-r--r--os-plugins/plugins/vmware/files/run-virt.include76
-rwxr-xr-xos-plugins/plugins/vmware/init-hooks/20-nw-bridge-config/bridge.sh2
-rwxr-xr-xos-plugins/plugins/vmware/init-hooks/60-have-servconfig/vm-dhcpd.sh56
-rw-r--r--os-plugins/plugins/xen/OpenSLX/OSPlugin/xen.pm116
-rw-r--r--os-plugins/plugins/xen/XX_xen.sh54
-rw-r--r--os-plugins/plugins/xen/files/hvm.include209
-rw-r--r--os-plugins/plugins/xen/files/machine.include167
-rw-r--r--os-plugins/plugins/xen/files/run-virt.include157
-rw-r--r--os-plugins/plugins/xen/init-hooks/10-have-nw-modules/xen.sh23
-rw-r--r--os-plugins/plugins/xen/init-hooks/10-nw-if-config/xennet.sh4
-rwxr-xr-xos-plugins/plugins/xen/init-hooks/20-nw-bridge-config/bridge.sh30
-rwxr-xr-xos-plugins/plugins/xen/init-hooks/20-nw-bridge-config/xen-bridge.sh42
-rw-r--r--os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm1
-rw-r--r--os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_2.pm53
-rw-r--r--os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm23
-rw-r--r--os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu_8.pm71
-rw-r--r--os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu_9.pm30
-rw-r--r--os-plugins/plugins/xserver/init-hooks/00-started/xserver.sh6
56 files changed, 3477 insertions, 1161 deletions
diff --git a/os-plugins/plugins/bootsplash/init-hooks/10-have-nw-modules/bootsplash.sh b/os-plugins/plugins/bootsplash/init-hooks/10-nw-if-config/bootsplash.sh
index 7f3d563e..7f3d563e 100644
--- a/os-plugins/plugins/bootsplash/init-hooks/10-have-nw-modules/bootsplash.sh
+++ b/os-plugins/plugins/bootsplash/init-hooks/10-nw-if-config/bootsplash.sh
diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/Scilin.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/Scilin.pm
index dfeb1d0a..1dc0482c 100644
--- a/os-plugins/plugins/desktop/OpenSLX/Distro/Scilin.pm
+++ b/os-plugins/plugins/desktop/OpenSLX/Distro/Scilin.pm
@@ -69,7 +69,7 @@ sub GDMConfigHashForWorkstation
my $configHash = $self->SUPER::GDMConfigHashForWorkstation();
$configHash->{'daemon'}->{SessionDesktopDir} =
- '/etc/X11/sessions/:/usr/share/xsessions/:/usr/share/gdm/BuiltInSessions';
+ '/etc/X11/session/:/usr/share/xsessions/:/usr/share/gdm/BuiltInSessions';
$configHash->{'daemon'}->{Greeter} =
'/usr/libexec/gdmgreeter';
@@ -119,10 +119,10 @@ sub _setupCommonDmScript
( su -c "rm -rf /tmp/*" - $USER
echo "$USER files removed by $0" >/tmp/files.removed 2>/dev/null ) &
. /etc/X11/xdm/Xreset.system' >/mnt/etc/X11/xdm/Xreset
- chmod a+x /mnt/etc/X11/xdm/Xreset*
-
- # enable the inittab entry again (incomplete)
- # sed -e "s,# line deleted.*,x:5:respawn:/etc/X11/prefdm -nodaemon," \
+ chmod a+x /mnt/etc/X11/xdm/Xreset*
+
+ # enable the inittab entry again (incomplete)
+ # sed -e "s,# line deleted.*,x:5:respawn:/etc/X11/prefdm -nodaemon," \
# -i /mnt/etc/inittab
End-of-Here
diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm
index 3d451e9e..86ae59f9 100644
--- a/os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm
+++ b/os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm
@@ -1,4 +1,4 @@
-# Copyright (c) 2006..2009 - OpenSLX GmbH
+# Copyright (c) 2006..2010 - OpenSLX GmbH
#
# This program is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
@@ -75,7 +75,7 @@ sub GDMConfigHashForWorkstation
my $configHash = $self->SUPER::GDMConfigHashForWorkstation();
$configHash->{'daemon'}->{SessionDesktopDir} =
- '/etc/X11/sessions/:/usr/share/xsessions/';
+ '/etc/X11/session/:/usr/share/xsessions/';
$configHash->{'daemon'}->{DefaultSession} = 'default.desktop';
$configHash->{'daemon'}->{Greeter} =
'/usr/lib/gdm/gdmgreeter';
@@ -124,9 +124,11 @@ sub setupKDMScript
sed -i "s/DISPLAYMANAGER=.*/DISPLAYMANAGER=\"kdm$kdmver\"/" \
/mnt/etc/sysconfig/displaymanager
[ $(grep -q DISPLAYMANAGER /mnt/etc/sysconfig/displaymanager) ] && \
- echo "DISPLAYMANAGER=\"kdm$kdmver\"" >> /mnt/et/sysconfig/displaymanager
+ echo "DISPLAYMANAGER=\"kdm$kdmver\"" >>/mnt/etc/sysconfig/displaymanager
sed -i "s/DEFAULT_WM=.*/DEFAULT_WM=\"$desktop_kind\"/" \
/mnt/etc/sysconfig/windowmanager
+ # needed for compatibility X11/session(s)
+ ln -s /etc/X11/session /mnt/etc/X11/sessions
End-of-Here
return $script;
diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/Suse_10_2.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/Suse_10_2.pm
index c7f27d65..ac14b2a5 100644
--- a/os-plugins/plugins/desktop/OpenSLX/Distro/Suse_10_2.pm
+++ b/os-plugins/plugins/desktop/OpenSLX/Distro/Suse_10_2.pm
@@ -1,4 +1,4 @@
-# Copyright (c) 2006..2009 - OpenSLX GmbH
+# Copyright (c) 2006..2010 - OpenSLX GmbH
#
# This program is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
@@ -44,7 +44,7 @@ sub GDMConfigHashForWorkstation
my $configHash = $self->SUPER::GDMConfigHashForWorkstation();
$configHash->{'daemon'}->{SessionDesktopDir} =
- '/etc/X11/sessions/:/usr/share/xsessions/';
+ '/etc/X11/session/:/usr/share/xsessions/';
$configHash->{'daemon'}->{Greeter} =
'/opt/gnome/lib/gdm/gdmgreeter';
diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu.pm
index 6e69ee14..14f56b48 100644
--- a/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu.pm
+++ b/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu.pm
@@ -1,4 +1,4 @@
-# Copyright (c) 2006..2009 - OpenSLX GmbH
+# Copyright (c) 2006..2010 - OpenSLX GmbH
#
# This program is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
@@ -33,7 +33,7 @@ sub GDMPathInfo
my $pathInfo = $self->SUPER::GDMPathInfo();
# link gdm.conf-custom instead of gdm.conf
- $pathInfo->{config} = '/etc/gdm/gdm.conf-custom';
+ $pathInfo->{config} = '/etc/gdm/custom.conf';
return $pathInfo;
}
@@ -57,9 +57,10 @@ sub setupGDMScript
echo "$USER files removed by $0" >/tmp/files.removed 2>/dev/null ) &
. /etc/gdm/PostSession/Default.system' >/mnt/etc/gdm/PostSession/Default
chmod a+x /mnt/etc/gdm/PostSession/Default*
- # gdm should be started after dbus/hal
- rllinker gdm 5 10
+ # gdm should be started via upstart mechanism
+ mv /mnt/etc/init.inactive/gdm.conf /mnt/etc/init
echo '/usr/sbin/gdm' >/mnt/etc/X11/default-display-manager
+ # possible to do this directly?
chroot /mnt update-alternatives --set x-window-manager /usr/bin/metacity
chroot /mnt update-alternatives --set x-session-manager \
/usr/bin/gnome-session
@@ -67,39 +68,21 @@ sub setupGDMScript
rm -rf /mnt/var/lib/gdm
mkdir -m 1770 /mnt/var/lib/gdm
chown root:gdm /mnt/var/lib/gdm
- sed '/^\\[daemon\\]/ a\\BaseXsession=/etc/gdm/Xsession' \
- -i /mnt$configFile
+ #sed '/^\\[daemon\\]/ a\\BaseXsession=/etc/gdm/Xsession' \
+ # -i /mnt$configFile
End-of-Here
return $script;
}
-sub KDMVersion
-{
- my $self = shift;
- my $vendorOSName = $self->{'engine'}->{'vendor-os-name'};
-
- my $kdmVer;
- if ( $vendorOSName =~ /ubuntu-8.04.*/ ) {
- $kdmVer = "3";
- }
- else {
- $kdmVer = "4";
- }
-
- return $kdmVer;
-
-}
-
sub KDMPathInfo
{
my $self = shift;
my $pathInfo = $self->SUPER::KDMPathInfo();
- my $kdmVer = $self->KDMVersion();
$pathInfo = {
- config => "/etc/kde$kdmVer/kdm/kdmrc",
+ config => "/etc/kde4/kdm/kdmrc",
paths => [
'/var/lib/kdm',
'/var/run/kdm',
@@ -113,18 +96,30 @@ sub GDMConfigHashForWorkstation
{
my $self = shift;
- my $configHash = $self->SUPER::GDMConfigHashForWorkstation();
- $configHash->{'daemon'}->{SessionDesktopDir} =
- '/etc/X11/sessions/:/usr/share/xsessions/:/usr/share/gdm/BuiltInSessions/';
-
- return $configHash;
+ return {
+ 'chooser' => {
+ Multicast => 'false',
+ },
+ 'daemon' => {
+ AutomaticLoginEnable => 'false',
+ Group => 'gdm',
+ User => 'gdm',
+ DefaultSession => 'default.desktop',
+ },
+ 'security' => {
+ DisallowTCP => 'true',
+ },
+ 'xdmcp' => {
+ Enable => 'false',
+ },
+ };
}
sub KDMConfigHashForWorkstation
{
my $self = shift;
- my $kdmVer = $self->KDMVersion();
+ my $kdmVer = "4";
my $configHash = $self->SUPER::KDMConfigHashForWorkstation();
$configHash->{'General'}->{PidFile} = "/var/run/kdm.pid";
$configHash->{'X-:0-Core'}->{Setup} = "/etc/kde$kdmVer/kdm/Xsetup";
@@ -132,7 +127,7 @@ sub KDMConfigHashForWorkstation
$configHash->{'X-:0-Core'}->{Session} = "/etc/kde$kdmVer/kdm/Xsession";
$configHash->{'X-:0-Core'}->{Reset} = "/etc/kde$kdmVer/kdm/Xreset";
$configHash->{'X-:0-Core'}->{SessionsDirs} =
- '/etc/X11/sessions,/usr/share/xsessions,/usr/share/apps/kdm/sessions';
+ '/etc/X11/session,/usr/share/xsessions,/usr/share/apps/kdm/sessions';
$configHash->{'X-:0-Core'}->{ServerAttempts} = "2";
return $configHash;
@@ -143,14 +138,9 @@ sub setupKDMScript
my $self = shift;
my $repoPath = shift;
- my $kdmVer = $self->KDMVersion();
+ my $kdmVer = "4";
my $script = $self->SUPER::setupKDMScript($repoPath);
- # change default theme to openslx-legacy if kdm3
- if ( $kdmVer == "3" ) {
- print " * Please change to openslx-legacy theme when using kdm3\n";
- }
-
$script .= "kdmver=$kdmVer\n";
$script .= unshiftHereDoc(<<' End-of-Here');
@@ -165,7 +155,7 @@ sub setupKDMScript
. /etc/kde$kdmver/kdm/Xreset.system' >/mnt/etc/kde$kdmver/kdm/Xreset
chmod a+x /mnt/etc/kde$kdmver/kdm/Xreset*
- rllinker kdm 1 10
+ mv /mnt/etc/init.inactive/kdm.conf /mnt/etc/init
echo '/usr/bin/kdm' > /mnt/etc/X11/default-display-manager
chroot /mnt update-alternatives --set x-window-manager /usr/bin/kwin
chroot /mnt update-alternatives --set x-session-manager \
diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu_8.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu_8.pm
new file mode 100644
index 00000000..6f00f181
--- /dev/null
+++ b/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu_8.pm
@@ -0,0 +1,161 @@
+# Copyright (c) 2006..2010 - 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/
+# -----------------------------------------------------------------------------
+# desktop/OpenSLX/Distro/Ubuntu_8.pm
+# - provides Ubuntu-specific overrides of the distro API for the desktop
+# plugin.
+# -----------------------------------------------------------------------------
+package desktop::OpenSLX::Distro::Ubuntu_8;
+
+use strict;
+use warnings;
+
+use base qw(desktop::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub GDMPathInfo
+{
+ my $self = shift;
+
+ my $pathInfo = $self->SUPER::GDMPathInfo();
+
+ # link gdm.conf-custom instead of gdm.conf
+ $pathInfo->{config} = '/etc/gdm/gdm.conf-custom';
+
+ return $pathInfo;
+}
+
+sub setupGDMScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupGDMScript($repoPath);
+
+ my $configFile = $self->GDMPathInfo->{config};
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ # cleanup after users Xorg session
+ sed 's,^#!.*,,' /mnt/etc/gdm/PostSession/Default \
+ >/mnt/etc/gdm/PostSession/Default.system
+ echo -e '#! /bin/sh\n#\n# modified by desktop plugin in Stage3\n#\n
+ # remove safely any remaining files of the leaving user in /tmp
+ ( su -c "rm -rf /tmp/*"
+ echo "$USER files removed by $0" >/tmp/files.removed 2>/dev/null ) &
+ . /etc/gdm/PostSession/Default.system' >/mnt/etc/gdm/PostSession/Default
+ chmod a+x /mnt/etc/gdm/PostSession/Default*
+ # gdm should be started after dbus/hal
+ rllinker gdm 5 10
+ echo '/usr/sbin/gdm' >/mnt/etc/X11/default-display-manager
+ chroot /mnt update-alternatives --set x-window-manager /usr/bin/metacity
+ chroot /mnt update-alternatives --set x-session-manager \
+ /usr/bin/gnome-session
+ # gdm does not like AUFS/UnionFS on its var directory
+ rm -rf /mnt/var/lib/gdm
+ mkdir -m 1770 /mnt/var/lib/gdm
+ chown root:gdm /mnt/var/lib/gdm
+ sed '/^\\[daemon\\]/ a\\BaseXsession=/etc/gdm/Xsession' \
+ -i /mnt$configFile
+ End-of-Here
+
+ return $script;
+}
+
+sub KDMPathInfo
+{
+ my $self = shift;
+
+ my $pathInfo = $self->SUPER::KDMPathInfo();
+ my $kdmVer = "3";
+
+ $pathInfo = {
+ config => "/etc/kde$kdmVer/kdm/kdmrc",
+ paths => [
+ '/var/lib/kdm',
+ '/var/run/kdm',
+ ],
+ };
+
+ return $pathInfo;
+}
+
+sub GDMConfigHashForWorkstation
+{
+ my $self = shift;
+
+ my $configHash = $self->SUPER::GDMConfigHashForWorkstation();
+ $configHash->{'daemon'}->{SessionDesktopDir} =
+ '/etc/X11/session/:/usr/share/xsessions/:/usr/share/gdm/BuiltInSessions/';
+
+ return $configHash;
+}
+
+sub KDMConfigHashForWorkstation
+{
+ my $self = shift;
+
+ my $kdmVer = "4";
+ my $configHash = $self->SUPER::KDMConfigHashForWorkstation();
+ $configHash->{'General'}->{PidFile} = "/var/run/kdm.pid";
+ $configHash->{'X-:0-Core'}->{Setup} = "/etc/kde$kdmVer/kdm/Xsetup";
+ $configHash->{'X-:0-Core'}->{Startup} = "/etc/kde$kdmVer/kdm/Xstartup";
+ $configHash->{'X-:0-Core'}->{Session} = "/etc/kde$kdmVer/kdm/Xsession";
+ $configHash->{'X-:0-Core'}->{Reset} = "/etc/kde$kdmVer/kdm/Xreset";
+ $configHash->{'X-:0-Core'}->{SessionsDirs} =
+ '/etc/X11/session,/usr/share/xsessions,/usr/share/apps/kdm/sessions';
+ $configHash->{'X-:0-Core'}->{ServerAttempts} = "2";
+
+ return $configHash;
+}
+
+sub setupKDMScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $kdmVer = "4";
+ my $script = $self->SUPER::setupKDMScript($repoPath);
+
+ # change default theme to openslx-legacy if kdm3
+ if ( $kdmVer == "3" ) {
+ print " * Please change to openslx-legacy theme when using kdm3\n";
+ }
+
+ $script .= "kdmver=$kdmVer\n";
+ $script .= unshiftHereDoc(<<' End-of-Here');
+
+ # cleanup after users Xorg session
+ sed 's,^#!.*,,' /mnt/etc/kde$kdmver/kdm/Xreset \
+ >/mnt/etc/kde$kdmver/kdm/Xreset.system
+ echo -e '#! /bin/sh\n#\n# modified by desktop plugin in Stage3\n#\n
+ # remove safely any remaining files of the leaving user in /tmp
+ ( su -c "rm -rf /tmp/*" - $USER
+ echo "$USER files removed by $0" >/tmp/files.removed 2>/dev/null
+ chmod 0400 /tmp/files.removed ) &
+ . /etc/kde$kdmver/kdm/Xreset.system' >/mnt/etc/kde$kdmver/kdm/Xreset
+ chmod a+x /mnt/etc/kde$kdmver/kdm/Xreset*
+
+ rllinker kdm 1 10
+ echo '/usr/bin/kdm' > /mnt/etc/X11/default-display-manager
+ chroot /mnt update-alternatives --set x-window-manager /usr/bin/kwin
+ chroot /mnt update-alternatives --set x-session-manager \
+ /usr/bin/startkde
+ End-of-Here
+
+ return $script;
+}
+
+1;
diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu_9_04.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu_9_04.pm
new file mode 100644
index 00000000..1022d6e8
--- /dev/null
+++ b/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu_9_04.pm
@@ -0,0 +1,161 @@
+# Copyright (c) 2006..2010 - 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/
+# -----------------------------------------------------------------------------
+# desktop/OpenSLX/Distro/Ubuntu_9_04.pm
+# - provides Ubuntu-specific overrides of the distro API for the desktop
+# plugin.
+# -----------------------------------------------------------------------------
+package desktop::OpenSLX::Distro::Ubuntu_9_04;
+
+use strict;
+use warnings;
+
+use base qw(desktop::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub GDMPathInfo
+{
+ my $self = shift;
+
+ my $pathInfo = $self->SUPER::GDMPathInfo();
+
+ # link gdm.conf-custom instead of gdm.conf
+ $pathInfo->{config} = '/etc/gdm/gdm.conf-custom';
+
+ return $pathInfo;
+}
+
+sub setupGDMScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupGDMScript($repoPath);
+
+ my $configFile = $self->GDMPathInfo->{config};
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ # cleanup after users Xorg session
+ sed 's,^#!.*,,' /mnt/etc/gdm/PostSession/Default \
+ >/mnt/etc/gdm/PostSession/Default.system
+ echo -e '#! /bin/sh\n#\n# modified by desktop plugin in Stage3\n#\n
+ # remove safely any remaining files of the leaving user in /tmp
+ ( su -c "rm -rf /tmp/*"
+ echo "$USER files removed by $0" >/tmp/files.removed 2>/dev/null ) &
+ . /etc/gdm/PostSession/Default.system' >/mnt/etc/gdm/PostSession/Default
+ chmod a+x /mnt/etc/gdm/PostSession/Default*
+ # gdm should be started after dbus/hal
+ rllinker gdm 5 10
+ echo '/usr/sbin/gdm' >/mnt/etc/X11/default-display-manager
+ chroot /mnt update-alternatives --set x-window-manager /usr/bin/metacity
+ chroot /mnt update-alternatives --set x-session-manager \
+ /usr/bin/gnome-session
+ # gdm does not like AUFS/UnionFS on its var directory
+ rm -rf /mnt/var/lib/gdm
+ mkdir -m 1770 /mnt/var/lib/gdm
+ chown root:gdm /mnt/var/lib/gdm
+ sed '/^\\[daemon\\]/ a\\BaseXsession=/etc/gdm/Xsession' \
+ -i /mnt$configFile
+ End-of-Here
+
+ return $script;
+}
+
+sub KDMPathInfo
+{
+ my $self = shift;
+
+ my $pathInfo = $self->SUPER::KDMPathInfo();
+ my $kdmVer = "4";
+
+ $pathInfo = {
+ config => "/etc/kde$kdmVer/kdm/kdmrc",
+ paths => [
+ '/var/lib/kdm',
+ '/var/run/kdm',
+ ],
+ };
+
+ return $pathInfo;
+}
+
+sub GDMConfigHashForWorkstation
+{
+ my $self = shift;
+
+ my $configHash = $self->SUPER::GDMConfigHashForWorkstation();
+ $configHash->{'daemon'}->{SessionDesktopDir} =
+ '/etc/X11/session/:/usr/share/xsessions/:/usr/share/gdm/BuiltInSessions/';
+
+ return $configHash;
+}
+
+sub KDMConfigHashForWorkstation
+{
+ my $self = shift;
+
+ my $kdmVer = "4";
+ my $configHash = $self->SUPER::KDMConfigHashForWorkstation();
+ $configHash->{'General'}->{PidFile} = "/var/run/kdm.pid";
+ $configHash->{'X-:0-Core'}->{Setup} = "/etc/kde$kdmVer/kdm/Xsetup";
+ $configHash->{'X-:0-Core'}->{Startup} = "/etc/kde$kdmVer/kdm/Xstartup";
+ $configHash->{'X-:0-Core'}->{Session} = "/etc/kde$kdmVer/kdm/Xsession";
+ $configHash->{'X-:0-Core'}->{Reset} = "/etc/kde$kdmVer/kdm/Xreset";
+ $configHash->{'X-:0-Core'}->{SessionsDirs} =
+ '/etc/X11/session,/usr/share/xsessions,/usr/share/apps/kdm/sessions';
+ $configHash->{'X-:0-Core'}->{ServerAttempts} = "2";
+
+ return $configHash;
+}
+
+sub setupKDMScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $kdmVer = "4";
+ my $script = $self->SUPER::setupKDMScript($repoPath);
+
+ # change default theme to openslx-legacy if kdm3
+ if ( $kdmVer == "3" ) {
+ print " * Please change to openslx-legacy theme when using kdm3\n";
+ }
+
+ $script .= "kdmver=$kdmVer\n";
+ $script .= unshiftHereDoc(<<' End-of-Here');
+
+ # cleanup after users Xorg session
+ sed 's,^#!.*,,' /mnt/etc/kde$kdmver/kdm/Xreset \
+ >/mnt/etc/kde$kdmver/kdm/Xreset.system
+ echo -e '#! /bin/sh\n#\n# modified by desktop plugin in Stage3\n#\n
+ # remove safely any remaining files of the leaving user in /tmp
+ ( su -c "rm -rf /tmp/*" - $USER
+ echo "$USER files removed by $0" >/tmp/files.removed 2>/dev/null
+ chmod 0400 /tmp/files.removed ) &
+ . /etc/kde$kdmver/kdm/Xreset.system' >/mnt/etc/kde$kdmver/kdm/Xreset
+ chmod a+x /mnt/etc/kde$kdmver/kdm/Xreset*
+
+ rllinker kdm 1 10
+ echo '/usr/bin/kdm' > /mnt/etc/X11/default-display-manager
+ chroot /mnt update-alternatives --set x-window-manager /usr/bin/kwin
+ chroot /mnt update-alternatives --set x-session-manager \
+ /usr/bin/startkde
+ End-of-Here
+
+ return $script;
+}
+
+1;
diff --git a/os-plugins/plugins/pvs/OpenSLX/OSPlugin/pvs.pm b/os-plugins/plugins/pvs/OpenSLX/OSPlugin/pvs.pm
index 6a6c7a8e..d0a629e4 100644
--- a/os-plugins/plugins/pvs/OpenSLX/OSPlugin/pvs.pm
+++ b/os-plugins/plugins/pvs/OpenSLX/OSPlugin/pvs.pm
@@ -1,4 +1,4 @@
-# Copyright (c) 2009 - OpenSLX GmbH
+# Copyright (c) 2009..2010 - OpenSLX GmbH
#
# This program is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
diff --git a/os-plugins/plugins/pvs/XX_pvs.sh b/os-plugins/plugins/pvs/XX_pvs.sh
index e96f5a63..9a86574f 100644
--- a/os-plugins/plugins/pvs/XX_pvs.sh
+++ b/os-plugins/plugins/pvs/XX_pvs.sh
@@ -1,5 +1,5 @@
-# Copyright (c) 2009 - RZ Uni Freiburg
-# Copyright (c) 2009 - OpenSLX GmbH
+# Copyright (c) 2009..2010 - RZ Uni Freiburg
+# Copyright (c) 2009..2010 - OpenSLX GmbH
#
# This program/file is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
@@ -21,20 +21,20 @@ if [ -e /initramfs/plugin-conf/pvs.conf ]; then
. /initramfs/plugin-conf/pvs.conf
if [ $pvs_active -ne 0 ]; then
[ $DEBUGLEVEL -gt 0 ] && echo "executing the 'pvs' os-plugin ...";
- # configure central pvs client configuration file
- testmkdi /mnt/etc/pvs
+ # location of central pvs configuration files
+ testmkdi /mnt/etc/openslx/pvs
# add it to the Xserver script (?)
# link the executables
- for tool in poolVS poolVSClient VNCwrapper ; do
- ln -s /opt/openslx/plugin-repo/pvs/${tool} /mnt/var/X11R6/bin/${tool}
- done
+ #for tool in poolVS poolVSClient VNCwrapper ; do
+ # ln -s /opt/openslx/plugin-repo/pvs/${tool} /mnt/var/X11R6/bin/${tool}
+ #done
# write config file
- echo "# parameters generated by $0" > /mnt/etc/pvs/pvs.conf
- echo "pvs_PARAMS=\"$PARAMS\"" >> /mnt/etc/pvs/pvs.conf
- echo "pvs_X11=\"$pvs_X11\"" >> /mnt/etc/pvs/pvs.conf
+ #echo "# parameters generated by $0" > /mnt/etc/pvs/pvs.conf
+ #echo "pvs_PARAMS=\"$PARAMS\"" >> /mnt/etc/pvs/pvs.conf
+ #echo "pvs_X11=\"$pvs_X11\"" >> /mnt/etc/pvs/pvs.conf
[ $DEBUGLEVEL -gt 0 ] && echo "done with 'pvs' os-plugin ...";
diff --git a/os-plugins/plugins/qemukvm/OpenSLX/OSPlugin/qemukvm.pm b/os-plugins/plugins/qemukvm/OpenSLX/OSPlugin/qemukvm.pm
index 9b6fffd2..e4ef657f 100644
--- a/os-plugins/plugins/qemukvm/OpenSLX/OSPlugin/qemukvm.pm
+++ b/os-plugins/plugins/qemukvm/OpenSLX/OSPlugin/qemukvm.pm
@@ -103,7 +103,7 @@ sub installationPhase
{
my $self = shift;
my $info = shift;
-
+
$self->{pluginRepositoryPath} = $info->{'plugin-repo-path'};
$self->{pluginTempPath} = $info->{'plugin-temp-path'};
$self->{openslxBasePath} = $info->{'openslx-base-path'};
@@ -111,8 +111,9 @@ sub installationPhase
$self->{attrs} = $info->{'plugin-attrs'};
my $engine = $self->{'os-plugin-engine'};
- my $pluginRepoPath = "$self->{pluginRepositoryPath}";
-
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
+ my $openslxBasePath = $info->{'openslx-base-path'};
+
# Different names of the tool (should be unified somehow!?)
if (!isInPath('qemu-kvm') || !isInPath('kvm')) {
$engine->installPackages(
@@ -123,55 +124,92 @@ sub installationPhase
if (!isInPath('sudo')) {
$engine->installPackages($self->{distro}->getPackageName('sudo'));
}
- # Copy run-virt.include to the appropriate place for inclusion in stage4
- copyFile("$self->{openslxBasePath}/lib/plugins/qemukvm/files/run-virt.include",
- "$self->{pluginRepositoryPath}/");
- # Copy the later /etc/qemu-ifup,down
- copyFile("$self->{openslxBasePath}/lib/plugins/qemukvm/files/qemu-if*",
- "$self->{pluginRepositoryPath}/");
- chmod 0755, "$self->{pluginRepositoryPath}/qemu-ifup";
- chmod 0755, "$self->{pluginRepositoryPath}/qemu-ifdown";
+
+ # Copy run-virt.include and template files to the appropriate place for
+ # inclusion in stage4
+ my $pluginName = $self->{'name'};
+ my $pluginBasePath = "$openslxBasePath/lib/plugins/$pluginName/files";
+ foreach my $file ( qw( run-virt.include ifup ifdown ) ) {
+ copyFile("$pluginBasePath/$file", "$pluginRepoPath/");
+ }
+ chmod 0755, "$pluginRepoPath/ifup", "$pluginRepoPath/ifdown";
my $initFile = newInitFile();
+ $initFile->setName("qemukvm");
$initFile->setDesc("Setup environment for QEMU/KVM");
- $initFile->addToBlock('head','. /etc/opt/openslx/network.qemukvm');
+ # TODO: default dirs als globale funktion anbieten
+ $initFile->
+ addToBlock('head','. /etc/opt/openslx/plugins/qemukvm/network.conf');
+
+ # TODO: remove all runlevel links for qemu-kvm or kvm
+ my $kvm_module = unshiftHereDoc(<<' End-of-Here');
+ # Figure out which module we need.
+ if grep -q ^flags.*\\\<vmx\\\> /proc/cpuinfo; then
+ module=kvm_intel
+ elif grep -q ^flags.*\\\<svm\\\> /proc/cpuinfo; then
+ module=kvm_amd
+ else
+ module=kqemu
+ fi
+ End-of-Here
+
my $do_start = unshiftHereDoc(<<' End-of-Here');
- # Adding the tap0 interface to the existing bridge configured in stage3
- for i in 0 1 2; do
- /opt/openslx/uclib-rootfs/sbin/tunctl -t tap${i} >/dev/null 2>&1
- ip link set dev tap${i} up
- done
- /opt/openslx/uclib-rootfs/usr/sbin/brctl addif br0 tap0
- ip addr add ${nataddress} dev tap1
- ip addr add ${hoaddress} dev tap2
- echo "1" >/proc/sys/net/ipv4/conf/br0/forwarding
- echo "1" >/proc/sys/net/ipv4/conf/tap0/forwarding
+ # loading kvm module
+ kvm_module
+ [ -n "${module}" ] && modprobe -q ${module}
+ # load the tunnel device module
+ modprobe -q tun
+ # TODO: maybe in the ifup-script better solution?
+ # configuring the tap0 interface to the existing bridge configured in stage3
+ #for i in 0 1 2; do
+ # /opt/openslx/uclib-rootfs/sbin/tunctl -t tap${i} >/dev/null 2>&1
+ # ip link set dev tap${i} up
+ #done
+ #/opt/openslx/uclib-rootfs/usr/sbin/brctl addif br0 tap0
+ #ip addr add ${nataddress} dev tap1
+ #ip addr add ${hoaddress} dev tap2
+ #echo "1" >/proc/sys/net/ipv4/conf/br0/forwarding
+ #echo "1" >/proc/sys/net/ipv4/conf/tap0/forwarding
+ # make /dev/fb0 writable for all
+ # TODO: maybe solve via group or udev, etc...
+ chmod 766 /dev/fb*
End-of-Here
+
my $do_stop = unshiftHereDoc(<<' End-of-Here');
- /opt/openslx/uclib-rootfs/usr/sbin/brctl delif br0 tap0
- ip addr del ${nataddress} dev tap1
- ip addr del ${hoaddress} dev tap2
- echo "0" >/proc/sys/net/ipv4/conf/br0/forwarding
- echo "0" >/proc/sys/net/ipv4/conf/tap0/forwarding
+ kvm_module
+ [ -n "${module}" ] && modprobe -q -r ${module}
+ modprobe -q -r tun
+ # TODO: tun removed, so this is not necessary
+ #/opt/openslx/uclib-rootfs/usr/sbin/brctl delif br0 tap0
+ #ip addr del ${nataddress} dev tap1
+ #ip addr del ${hoaddress} dev tap2
+ #echo "0" >/proc/sys/net/ipv4/conf/br0/forwarding
+ #echo "0" >/proc/sys/net/ipv4/conf/tap0/forwarding
+ chmod 760 /dev/fb*
End-of-Here
-
+
+ my $do_restart = unshiftHereDoc(<<' End-of-Here');
+ do_stop && do_start
+ End-of-Here
+
# add helper functions to initfile
# first parameter name of the function
# second parameter content of the function
+ $initFile->addFunction('kvm_module', $kvm_module);
$initFile->addFunction('do_start', $do_start);
$initFile->addFunction('do_stop', $do_stop);
- $initFile->addFunction('do_restart', " : # do nothing here");
-
+ $initFile->addFunction('do_restart', $do_restart);
+
# place a call of the helper function in the stop block of the init file
# first parameter name of the function
# second parameter name of the block
$initFile->addFunctionCall('do_start', 'start');
$initFile->addFunctionCall('do_stop', 'stop');
$initFile->addFunctionCall('do_restart', 'restart');
-
+
my $distro = (split('-',$self->{'os-plugin-engine'}->distroName()))[0];
-
+
# write qemukvm initfile to plugin path
spitFile(
"$pluginRepoPath/qemukvm",
diff --git a/os-plugins/plugins/qemukvm/XX_qemukvm.sh b/os-plugins/plugins/qemukvm/XX_qemukvm.sh
index 49dc165b..36ff4f59 100644
--- a/os-plugins/plugins/qemukvm/XX_qemukvm.sh
+++ b/os-plugins/plugins/qemukvm/XX_qemukvm.sh
@@ -1,4 +1,4 @@
-# Copyright (c) 2008, 2009 - OpenSLX GmbH
+# Copyright (c) 2008..2010 - OpenSLX GmbH
#
# This program/file is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
@@ -11,86 +11,56 @@
# Script is included from init via the "." load function - thus it has all
# variables and functions available
-write_networking_conf ()
-{
-local natnetwork="192.168.101"
-local honetwork="192.168.102"
-echo "
-# udhcpd configuration file written by $0 during OpenSLX stage3 configuration
+# include default directories
+. /etc/openslx.conf
-# The start and end of the IP lease block
-start CNETWORK.20
-end CNETWORK.100
-
-# The interface that udhcpd will use
-interface NWIF
-
-# How long an offered address is reserved (leased) in seconds
-offer_time 6000
-
-# The location of the leases file
-lease_file /tmp/qemu-USER/udhcpd.leases
-
-# The location of the pid file
-pidfile /tmp/qemu-USER/udhcpd.pid
-
-opt dns ${domain_name_servers}
-option subnet 255.255.255.0
-opt router CNETWORK.254
-opt wins CNETWORK.10
-option domain virtual.site ${domain_name}
-
-# Additional options known to udhcpd
-#subnet #timezone
-#router #timesvr
-#namesvr #dns
-#logsvr #cookiesvr
-#lprsvr #bootsize
-#domain #swapsvr
-#rootpath #ipttl
-#mtu #broadcast
-#wins #lease
-#ntpsrv #tftp
-#bootfile
-" >/mnt/etc/opt/openslx/udhcpd.qemukvm
-echo -e "nataddress=${natnetwork}.254/24\nhoaddress=${honetwork}.254/24" \
- >/mnt/etc/opt/openslx/network.qemukvm
-}
+CONFFILE=/initramfs/plugin-conf/qemukvm.conf
+PLUGINCONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/qemukvm
+PLUGINDIR=${OPENSLX_DEFAULT_DIR}/plugin-repo/qemukvm
+VIRTDIR=/mnt/${OPENSLX_DEFAULT_VIRTDIR}/qemukvm
+LOGDIR=/mnt/${OPENSLX_DEFAULT_LOGDIR}
# check if the configuration file is available
-if [ -e /initramfs/plugin-conf/qemukvm.conf ]; then
+if [ -e ${CONFFILE} ]; then
- # check for the virtualization CPU features
- if grep -q "svm" /proc/cpuinfo && modprobe ${MODPRV} kvm_amd ; then
- [ $DEBUGLEVEL -gt 0 ] && echo " * Loaded kvm_amd module"
- elif grep -q "vmx" /proc/cpuinfo && modprobe ${MODPRV} kvm_intel ; then
- [ $DEBUGLEVEL -gt 0 ] && echo " * Loaded kvm_intel module"
- elif modprobe ${MODPRV} kqemu ; then
- [ $DEBUGLEVEL -gt 0 ] && \
- error " * Successfully loaded the kqemu module, but loading of kvm_amd \
-or kvm_intel\n failed, because no virtualization extenstion found in this \
-CPU. Please\n enable the extension within your machines BIOS or get another \
-CPU." nonfatal
- else
- error " * All module loading failed including the kqemu module, which \
-was either\n not found or couldn't be loaded for other reasons. Thus using \
-qemu(-kvm)\n makes not much sense."
- exit 1
- fi
- # load the tunnel device module
- modprobe tun 2>/dev/null
-
# load needed variables
- . /initramfs/plugin-conf/qemukvm.conf
+ . ${CONFFILE}
# Test if this plugin is activated... more or less useless with the
# new plugin system
- if [ $qemukvm_active -ne 0 ]; then
-
+ if [ ${qemukvm_active} -ne 0 2>/dev/null ]; then
[ $DEBUGLEVEL -gt 0 ] && echo "executing the 'qemukvm' os-plugin ...";
+
# load general configuration
. /initramfs/machine-setup
+ # copy virtualization include files and qemukvm.conf to config dir
+ testmkd ${PLUGINCONFDIR}
+ cp /mnt/${PLUGINDIR}/run-virt.include ${PLUGINCONFDIR}
+ cp ${CONFFILE} ${PLUGINCONFDIR}
+
+# # check for the virtualization CPU features
+# if grep -q "vmx" /proc/cpuinfo && modprobe ${MODPRV} kvm_intel ; then
+# [ $DEBUGLEVEL -gt 0 ] && echo " * Loaded kvm_intel module"
+# echo "kvm=intel" >> ${PLUGINCONFDIR}/qemukvm.conf
+# elif grep -q "svm" /proc/cpuinfo && modprobe ${MODPRV} kvm_amd ; then
+# [ $DEBUGLEVEL -gt 0 ] && echo " * Loaded kvm_amd module"
+# echo "kvm=amd" >> ${PLUGINCONFDIR}/qemukvm.conf
+# elif modprobe ${MODPRV} kqemu ; then
+# [ $DEBUGLEVEL -gt 0 ] && \
+# error " * Successfully loaded the kqemu module, but loading of kvm_amd \
+#or kvm_intel\n failed, because no virtualization extenstion found in this \
+#CPU. Please\n enable the extension within your machines BIOS or get another \
+#CPU." nonfatal
+# else
+# error " * All module loading failed including the kqemu module, which \
+#was either\n not found or couldn't be loaded for other reasons. Thus using \
+#qemu(-kvm)\n makes not much sense." nonfatal
+# fi
+
+# # load the tunnel device module
+# modprobe tun 2>/dev/null
+
# get source of qemukvm image server (get type, server and path)
if strinstr "/" "${qemukvm_imagesrc}" ; then
qkimgprot=$(uri_token ${qemukvm_imagesrc} prot)
@@ -106,37 +76,36 @@ qemu(-kvm)\n makes not much sense."
[ $DEBUGLEVEL -gt 1 ] && error " * Incomplete information in variable \
${qemukvm_imagesrc}." nonfatal
fi
- # copy version depending files - the vmchooser expects for every virtua-
- # lization plugin a file named after it (here run-qemukvm.include)
- testmkd /mnt/etc/opt/openslx
- cp /mnt/opt/openslx/plugin-repo/qemukvm/run-virt.include \
- /mnt/etc/opt/openslx/run-qemukvm.include
- # create a template udhcpd configuration file
- write_networking_conf
+
+ # create a network configuration template (variables should be setable in
+ # the future, see vmware plugin)
+ natnetwork="192.168.101"
+ honetwork="192.168.102"
+ echo -e "nataddress=${natnetwork}.254/24\nhoaddress=${honetwork}.254/24" \
+ >${PLUGINCONFDIR}/network.conf
# copy the runlevel script (proper place for all distros??)
- cp /mnt/opt/openslx/plugin-repo/qemukvm/qemukvm /mnt/etc/init.d
+ cp /mnt/${PLUGINDIR}/qemukvm /mnt/etc/init.d
chmod 0755 /mnt/etc/init.d/qemukvm
rllinker "qemukvm" 22 2
# copy the /etc/qemu-ifup script and enable extended rights for running
# the emulator and certain network commands via sudo
- ln -sf /opt/openslx/plugin-repo/qemukvm/qemu-ifup /mnt/etc/qemu-ifup
- ln -sf /opt/openslx/plugin-repo/qemukvm/qemu-ifdown /mnt/etc/qemu-ifdown
- ln -sf /opt/openslx/plugin-repo/qemukvm/qemu-ifup /mnt/etc/kvm-ifup
- ln -sf /opt/openslx/plugin-repo/qemukvm/qemu-ifdown /mnt/etc/kvm-ifdown
-
- for qemubin in qemu kvm ; do
- qemu="$(binfinder ${qemubin})"
- [ -n "${qemu}" ] && \
- echo "ALL ALL=NOPASSWD: ${qemu}" >>/mnt/etc/sudoers
- done
- echo -e "#ALL ALL=NOPASSWD: /opt/openslx/uclib-rootfs/sbin/tunctl -t tap*\n\
-#ALL ALL=NOPASSWD: /opt/openslx/uclib-rootfs/sbin/ip addr add * dev tap*\n\
-#ALL ALL=NOPASSWD: /opt/openslx/uclib-rootfs/usr/sbin/brctl addif br0 tap*\n\
-ALL ALL=NOPASSWD: /opt/openslx/uclib-rootfs/usr/sbin/udhcpd -S /tmp/qemu*\n\
-ALL ALL=NOPASSWD: killall udhcpd" >>/mnt/etc/sudoers
+ ln -sf ${PLUGINDIR}/ifup ${PLUGINCONFDIR}/ifup
+ ln -sf ${PLUGINDIR}/ifdown ${PLUGINCONFDIR}/ifdown
+
+ cat >> /mnt/etc/sudoers << EOF
+# allow to start and stop kvm services / load-/unload kvm modules
+#ALL ALL=NOPASSWD: /etc/init.d/qemukvm
+ALL ALL=NOPASSWD: /opt/openslx/uclib-rootfs/sbin/tunctl -t tap*
+ALL ALL=NOPASSWD: /opt/openslx/uclib-rootfs/usr/sbin/brctl addif br0 tap*
+ALL ALL=NOPASSWD: /opt/openslx/uclib-rootfs/bin/ip link set dev tap* up
+ALL ALL=NOPASSWD: /opt/openslx/uclib-rootfs/bin/ip addr add * dev tap*
+ALL ALL=NOPASSWD: /opt/openslx/uclib-rootfs/usr/sbin/udhcpd -S /tmp/qemukvm/*/udhcpd.conf
+ALL ALL=NOPASSWD: /opt/openslx/uclib-rootfs/bin/cp /tmp/qemukvm/*/forwarding /proc/sys/net/ipv4/conf/tap*/forwarding
+#ALL ALL=NOPASSWD: ${killall} udhcpd
+EOF
fi
else
- [ $DEBUGLEVEL -gt 0 ] && echo " * Configuration of qemukvm plugin failed"
+ [ $DEBUGLEVEL -gt 0 ] && echo " * Configuration of 'qemukvm' plugin failed"
fi
diff --git a/os-plugins/plugins/qemukvm/files/qemu-ifdown b/os-plugins/plugins/qemukvm/files/ifdown
index 8c52d76f..e741d9ca 100644
--- a/os-plugins/plugins/qemukvm/files/qemu-ifdown
+++ b/os-plugins/plugins/qemukvm/files/ifdown
@@ -9,21 +9,24 @@
#
# General information about OpenSLX can be found at http://openslx.org/
# -----------------------------------------------------------------------------
-# qemu-ifup
+# ifdown
# - Script used for network cleanup of qemukvm in stage4
# -----------------------------------------------------------------------------
-# Clean up script
+# get VM_ID through tap name
+VM_ID=$(echo $1 | grep -oE "0[0-4]$")
+QKTMPDIR=/tmp/qemukvm/${USER}/${VM_ID}
+touch /tmp/qemukvm/udhcpd.pids
+chmod 666 tmp/qemukvm/udhcpd.pids
case "$1" in
- tap1)
- # Bringing down the dhcp server
- killall udhcpd 2>/dev/null
- #iptables -t nat -D POSTROUTING -o br0 -j MASQUERADE 2>/dev/null
+ tapnat0*)
+ # kill udhcpd
+ cat ${QKTMPDIR}/udhcpd.pid >> /tmp/qemukvm/udhcpd-unused.pid
;;
- tap2)
- # Bringing down the dhcp server
- killall udhcpd 2>/dev/null
+ taphost0*)
+ # kill udhcpd
+ cat ${QKTMPDIR}/udhcpd.pid >> /tmp/qemukvm/udhcpd-unused.pid
;;
esac
diff --git a/os-plugins/plugins/qemukvm/files/ifup b/os-plugins/plugins/qemukvm/files/ifup
new file mode 100644
index 00000000..b3218798
--- /dev/null
+++ b/os-plugins/plugins/qemukvm/files/ifup
@@ -0,0 +1,75 @@
+#!/bin/sh
+# Copyright (c) 2009..2010 - 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/
+# -----------------------------------------------------------------------------
+# ifup
+# - Script used for network setup of qemukvm in stage4
+# -----------------------------------------------------------------------------
+
+. /etc/opt/openslx/openslx.conf
+
+PLUGINCONFDIR=${OPENSLX_DEFAULT_CONFDIR}/plugins/qemukvm
+
+# get VM_ID through tap name
+VM_ID=$(echo $1 | grep -oE "0[0-4]$")
+QKTMPDIR=/tmp/qemukvm/${USER}/${VM_ID}
+
+# Use the udhcpcd as DHCP server and brctl as provided by default in OpenSLX
+# environments via uclibc-wrapper.
+. ${PLUGINCONFDIR}/network.conf
+
+# Just decide by the virtual network device used which kind of connection
+# should be set up (passed in $1): tap0 = bridge, tap1 = nat, tap2 = hostonly.
+case "$1" in
+ tapbridge0*)
+ sudo ip link set dev $1 up
+ # TODO: forwarding?, where needed
+ echo "1" >${QKTMPDIR}/forwarding
+ sudo cp ${QKTMPDIR}/forwarding /proc/sys/net/ipv4/conf/br0/forwarding
+ sudo cp ${QKTMPDIR}/forwarding /proc/sys/net/ipv4/conf/$1/forwarding
+ ;;
+ tapnat0*)
+ # Configuring DHCP on host tapnat interface and enable IP masquerading
+ sudo ip addr add ${nataddress} dev $1
+ sudo ip link set dev $1 up
+ # TODO: forwarding?, where needed
+ echo "1" >${QKTMPDIR}/forwarding
+ sudo cp ${QKTMPDIR}/forwarding /proc/sys/net/ipv4/conf/br0/forwarding
+ sudo cp ${QKTMPDIR}/forwarding /proc/sys/net/ipv4/conf/$1/forwarding
+ # TODO: we use here atatic address, maybe change later
+ sed -e "s,NWIF,$1,;s,CNETWORK,192.168.1${VM_ID}," \
+ -e "s,PIDFILE,${QKTMPDIR}/udhcpd.pid," \
+ -e "s,LEASEFILE,${QKTMPDIR}/udhcpd.leases," \
+ ${OPENSLX_DEFAULT_CONFDIR}/udhcpd.conf \
+ >${QKTMPDIR}/udhcpd.conf
+ touch ${QKTMPDIR}/udhcpd.leases
+ sudo /opt/openslx/uclib-rootfs/usr/sbin/udhcpd \
+ -S ${QKTMPDIR}/udhcpd.conf
+ # iptables -t nat -A POSTROUTING -o br0 -j MASQUERADE
+ ;;
+ taphost0*)
+ # Configuring DHCP on host taphost interface
+ sudo ip addr add ${hoaddress} dev $1
+ sudo ip link set dev $1 up
+ # TODO: forwarding?, where needed
+ echo "1" >${QKTMPDIR}/forwarding
+ sudo cp ${QKTMPDIR}/forwarding /proc/sys/net/ipv4/conf/br0/forwarding
+ sudo cp ${QKTMPDIR}/forwarding /proc/sys/net/ipv4/conf/$1/forwarding
+ sed -e "s,NWIF,$1,;s,USER,${USER},;s,CNETWORK,192.168.1${VM_ID}," \
+ -e "s,PIDFILE,${QKTMPDIR}/udhcpd.pid," \
+ -e "s,LEASEFILE,${QKTMPDIR}/udhcpd.leases," \
+ ${OPENSLX_DEFAULT_CONFDIR}/udhcpd.conf >${QKTMPDIR}/udhcpd.conf
+ touch ${QKTMPDIR}/udhcpd.leases
+ sudo /opt/openslx/uclib-rootfs/usr/sbin/udhcpd \
+ -S ${QKTMPDIR}/udhcpd.conf
+ ;;
+esac
+
+exit 0
diff --git a/os-plugins/plugins/qemukvm/files/qemu-ifup b/os-plugins/plugins/qemukvm/files/qemu-ifup
deleted file mode 100644
index 9cd2dd0b..00000000
--- a/os-plugins/plugins/qemukvm/files/qemu-ifup
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/bin/sh
-# Copyright (c) 2009 - 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/
-# -----------------------------------------------------------------------------
-# qemu-ifup
-# - Script used for network setup of qemukvm in stage4
-# -----------------------------------------------------------------------------
-
-# Use the udhcpcd as DHCP server and brctl as provided by default in OpenSLX
-# environments via uclibc-wrapper.
-
-. /etc/opt/openslx/network.qemukvm
-
-# Just decide by the virtual network device used which kind of connection
-# should be set up (passed in $1): tap0 = bridge, tap1 = nat, tap2 = hostonly.
-case "$1" in
- tap0)
- # Adding the tap0 interface to the existing bridge configured in stage3
- # brctl addif br0 tap0
- ;;
- tap1)
- # Configuring DHCP on host tap1 interface and enable IP masquerading
- [ -d /tmp/qemu-$USER ] || mkdir -p /tmp/qemu-$USER
- sed "s,NWIF,tap1,;s,/misc/,/qemu/,;s,USER,$USER,;s,CNETWORK,$nataddress," \
- /etc/opt/openslx/udhcpd.qemukvm >/tmp/qemu-$USER/udhcpd.conf
- touch /tmp/qemu-$USER/udhcpd.leases
- # ip link set tap1 up
- # ip addr add 192.168.101.254/24 dev tap1
- sudo /opt/openslx/uclib-rootfs/usr/sbin/udhcpd \
- -S /tmp/qemu-$USER/udhcpd.conf
- # iptables -t nat -A POSTROUTING -o br0 -j MASQUERADE
- ;;
- tap2)
- # Configuring DHCP on host tap2 interface
- [ -d /tmp/qemu-$USER ] || mkdir -p /tmp/qemu-$USER
- sed "s,NWIF,tap2,;s,/misc/,/qemu/,;s,USER,$USER,;s,CNETWORK,$hoaddress," \
- /etc/opt/openslx/udhcpd.qemukvm >/tmp/qemu-$USER/udhcpd.conf
- touch /tmp/qemu-$USER/udhcpd.leases
- # ip link set tap2 up
- # ip addr add 192.168.101.254/24 dev tap2
- sudo /opt/openslx/uclib-rootfs/usr/sbin/udhcpd \
- -S /tmp/qemu-$USER/udhcpd.conf
- ;;
-esac
-
-# Produce a clean exit status
-exit 0
-
diff --git a/os-plugins/plugins/qemukvm/files/run-virt.include b/os-plugins/plugins/qemukvm/files/run-virt.include
index b1f76535..02c70469 100644
--- a/os-plugins/plugins/qemukvm/files/run-virt.include
+++ b/os-plugins/plugins/qemukvm/files/run-virt.include
@@ -1,6 +1,7 @@
-# qemukvm.include
-#
-# Copyright (c) 2009 - OpenSLX GmbH
+# run-virt.include
+# -----------------------------------------------------------------------------
+# Copyright (c) 2009..2010 - RZ Uni Freiburg
+# Copyright (c) 2009..2010 - OpenSLX GmbH
#
# This program/file is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
@@ -9,36 +10,167 @@
# send your feedback to feedback@openslx.org
#
# General information about OpenSLX can be found at http://openslx.org
-#
-# Include script for running the QEMU/Linux KVM virtual machine on an OpenSLX
-# client via the run-virt.sh. The stuff is copied to /etc/opt/openslx/run-
-# qemukvm.include during stage3.
+# -----------------------------------------------------------------------------
+# run-virt.include
+# - Include script for running the QEMU/Linux KVM virtual machine on an
+# OpenSLX client via the run-virt.sh or run-vmgrid.sh
+################################################################################
+
+################################################################################
+### Include general configuration
+################################################################################
+if [ -f ${OPENSLX_DEFAULT_CONFDIR}/plugins/${self}/${self}.conf ]; then
+ . ${OPENSLX_DEFAULT_CONFDIR}/plugins/${self}/${self}.conf
+else
+ writelog "Problems reading config file of ${self} plugin"
+ # TODO: exit wenn conf wichtig
+ #exit 1
+fi
+
+################################################################################
+### Declaration of default variables
+################################################################################
+
+PLUGINCONFQK="${PLUGINCONFROOT}/${self}"
+PLUGINDIRQK=${OPENSLX_DEFAULT_DIR}/plugin-repo/${self}
+# create TMPDIR for all users
+mkdir -m 1777 /tmp/${self} 2>/dev/null
+# TMPDIR
+QKTMPDIR="/tmp/${self}/${USER}/${VM_ID}"
+# define dirs and files which can be removed after exit, be carefull!
+RMDIRS="${QKTMPDIR}"
+rm -rf ${RMDIRS} 2>/dev/null
+mkdir -m 1777 -p ${QKTMPDIR} 2>/dev/null
+# vmpath is the path to the vm, here an image (img|qcow*|vmdk)
+diskfile=${vmpath}
+
+# check the file type
+if echo ${imgname} | grep -iE "img|qcow|vmdk" >/dev/null 2>&1; then
+ imgtype=$(echo ${imgname##*.} | tr [a-z] [A-Z])
+else
+ writelog "${imgname} is not a valid image type (img|qcow*|vmdk), exiting!"
+ exit 1
+fi
-# include general configuration from vmchooser
-. /etc/opt/openslx/run-virt.include
+# hot keys ALT+CTRL+SHIFT
+VIRTCMDOPTS="${VIRTCMDOPTS} -alt-grab"
+
+# display name, remove blanks because of cmdline problems
+displayname=$(echo ${displayname} | sed -e "s, ,-,g")
+VIRTCMDOPTS="${VIRTCMDOPTS} -name ${displayname}"
+
+writelog "Directories:"
+writelog "\tTMPDIR:\t\t\t$QKTMPDIR"
+writelog "Diskimage:"
+writelog "\tDisk type:\t\t$imgtype"
+writelog "\tDisk file:\t\t$diskfile"
+
+################################################################################
+### Hardware checks
+################################################################################
+
+# memory part equal to vmware plugin
+# percentage of memory to use for virtualbox in standard case
+if [ -n "${forcemem}" ]; then
+ mem="${forcemem}"
+else
+ permem=30
+ if [ "${totalmem}" -ge "1600" ]; then
+ permem=40
+ fi
+# # check if /tmp is on harddisk
+# if grep -qe "/dev/.* /tmp " /proc/mounts ; then
+# permem=60
+# id44="1"
+# # Hack, if more than 2,5G RAM use 40% of Ram and write vmem into Ram as well
+# # (40% vmware | 40% confdir(vmem...) | 20% host
+# # VMplayer 2+ issue
+# # TODO: makes this sense for vbox?
+# #if [ "${totalmem}" -ge "2500" ]; then
+# #permem=40
+# #rmdir ${snapshotdir}
+# #snapshotdirold=${snapshotdir}
+# #snapshotdir=/dev/shm/${self}/${USER}/${VM_ID}
+# #mkdir -p ${snapshotdir}
+# #ln -sf ${snapshotdir} ${snapshotdirold}
+# #fi
+# fi
+ mem=$(expr ${totalmem} / 100 \* ${permem})
+ if [ "${id44}" = "1" ]; then
+ memhost=$(expr ${totalmem} - ${mem})
+ else
+ memhost=$(expr ${totalmem} - ${mem} - ${mem})
+ fi
+ # static first
+ permem=50
+ mem=$(expr ${totalmem} / 100 \* ${permem})
+ if [ "${mem}" -lt "256" ] || [ "${memhost}" -lt "256" ]; then
+ writelog "Memory out of range: ${mem} MB (guest) / ${memhost} MB (host)!"
+ writelog "Min. 256 MB for host and guest!"
+ exit 1
+ fi
+fi
-permem=50
-mem=$(expr ${totalmem} / 100 \* ${permem})
VIRTCMDOPTS="${VIRTCMDOPTS} -m ${mem}"
# network adaptor alternatives: rtl8139, pcnet, e1000
-VIRTCMDOPTS="${VIRTCMDOPTS} -net nic,model=pcnet"
+network_card=${network_card:=pcnet}
+VIRTCMDOPTS="${VIRTCMDOPTS} -net nic,macaddr=${macaddr},model=${network_card}"
+# define net kind and apply script
+qemu_ifscr="script=${PLUGINCONFQK}/ifup,downscript=${PLUGINCONFQK}/ifdown"
case "${network_kind}" in
bridge*)
- VIRTCMDOPTS="${VIRTCMDOPTS} -net tap,ifname=tap0"
+ VIRTCMDOPTS="${VIRTCMDOPTS} -net tap,ifname=tapbridge${VM_ID},${qemu_ifscr}"
+ sudo /opt/openslx/uclib-rootfs/sbin/tunctl -t tapbridge${VM_ID} -u ${USER} \
+ >/dev/null 2>&1
+ sudo /opt/openslx/uclib-rootfs/usr/sbin/brctl addif br0 tapbridge${VM_ID}
+ POSTRUN="/opt/openslx/uclib-rootfs/sbin/tunctl -d tapbridge${VM_ID}"
+ ;;
+ nat)
+ VIRTCMDOPTS="${VIRTCMDOPTS} -net tap,ifname=tapnat${VM_ID},${qemu_ifscr}"
+ sudo /opt/openslx/uclib-rootfs/sbin/tunctl -t tapnat${VM_ID} -u ${USER} \
+ >/dev/null 2>&1
+ sudo /opt/openslx/uclib-rootfs/usr/sbin/brctl addif br0 tapnat${VM_ID}
+ POSTRUN="/opt/openslx/uclib-rootfs/sbin/tunctl -d tapnat${VM_ID}"
;;
- nat|NAT)
- VIRTCMDOPTS="${VIRTCMDOPTS} -net tap,ifname=tap1"
+ host*)
+ VIRTCMDOPTS="${VIRTCMDOPTS} -net tap,ifname=taphost${VM_ID},${qemu_ifscr}"
+ sudo /opt/openslx/uclib-rootfs/sbin/tunctl -t taphost${VM_ID} -u ${USER} \
+ >/dev/null 2>&1
+ sudo /opt/openslx/uclib-rootfs/usr/sbin/brctl addif br0 taphost${VM_ID}
+ POSTRUN="/opt/openslx/uclib-rootfs/sbin/tunctl -d taphost${VM_ID}"
;;
- hostonly)
- VIRTCMDOPTS="${VIRTCMDOPTS} -net tap,ifname=tap2"
+ *)
+ network_kind="user"
+ VIRTCMDOPTS="${VIRTCMDOPTS} -net user"
;;
esac
+# translate boot, use if set else set to HardDisk
+if [ -n "${boot}" ]; then
+ case ${boot} in
+ n*) # usually support for a,c,d,n, stands for Floppy, HD, CD-ROM, Network
+ boot="n"
+ # TODO: does not work yet, can be removed if tap1 solution better
+ if [ "${network_kind}" = "user" ] && [ -n "${virtualbox_tftpdir}" ]; then
+ VIRTCMDOPTS="${VIRTCMDOPTS},tftp=${virtualbox_tftpdir}"
+ fi
+ ;;
+ # later maybe c|disk|hd*|sd*) for HD and d|cd*) for CD-ROM
+ *)
+ boot="c"
+ ;;
+ esac
+else
+ boot="c"
+fi
+
+# external GUI port
+vncport="590${VM_ID}"
+
+# TODO: most of the following does not make much sense yet ...
# virtual fd/cd/dvd and drive devices, floppy b: for configuration
-#VIRTCMDOPTS="${VIRTCMDOPTS} -fda /dev/fd0"
-VIRTCMDOPTS="${VIRTCMDOPTS} -fdb /var/lib/virt/vmchooser/loopimg/fd.img"
# if $floppy_0 from run-virt.include set then fdtest="TRUE"
fdtest=
fdtest=${floppy_0:+"TRUE"}
@@ -61,17 +193,114 @@ cdrom1=${cdtest:-"FALSE"}
ide="TRUE"
hddrv="ide"
+# TODO: nur bei vmchooser
+#VIRTCMDOPTS="${VIRTCMDOPTS} -fda /dev/fd0"
+#VIRTCMDOPTS="${VIRTCMDOPTS} -fdb ${floppy1name}"
+
# audio
VIRTCMDOPTS="${VIRTCMDOPTS} -soundhw all"
# serial
#VIRTCMDOPTS="${VIRTCMDOPTS} -serial /dev/ttyS0"
-# set the variables appropriately
-for tool in kvm qemu-kvm qemu; do
- VIRTCMD=$(which ${tool} 2>/dev/null)
- [ "x$VIRTCMD" != "x" ] && break
-done
-[ -z $VIRTCMD ] && { writelog "No qemu/kvm tool found."; exit 1; }
-VIRTCMD="sudo $VIRTCMD"
-VIRTCMDOPTS="${VIRTCMDOPTS} -boot c -alt-grab ${diskfile}"
+writelog "Virtual Hardware:"
+writelog "\tGuest RAM:\t\t${mem} MB"
+# echo nur wenn memhost gesetzt
+[ -n "${memhost}" ] && writelog "\tHost RAM:\t\t${memhost} MB"
+writelog "\tMAC address:\t\t$macaddr"
+writelog "\tNetwork card:\t\t${network_card}"
+writelog "\tNetwork kind:\t\t${network_kind}"
+#writelog "\tCD-ROM1:\t${cdrom0}"
+#writelog "\tCD-ROM2:\t${cdrom1}"
+#writelog "\tFloppy_A:\t${floppy0}"
+#writelog "\tFloppy_B:\t${floppy1}"
+#writelog "\tShared Folders 'home':\t/home/${USER}"
+
+################################################################################
+### finally set env for run-virt.sh
+################################################################################
+
+# TODO: besser drive statt hda?
+#-drive [file=file][,if=type][,bus=n][,unit=m][,media=d][,index=i]
+# [,cyls=c,heads=h,secs=s[,trans=t]][,snapshot=on|off]
+# [,cache=writethrough|writeback|none][,format=f][,serial=s]
+# [,boot=on|off]
+#-snapshot write to temporary files instead of disk image files
+#-usb enable the USB driver (will be the default soon)
+#-usbdevice name add the host or guest USB device 'name'
+#-nographic disable graphical output and redirect serial I/Os to console
+#-vga [std|cirrus|vmware|none] select video card type
+#-vnc display start a VNC server on display
+#-tftp dir allow tftp access to files in dir [-net user]
+#-bootp file advertise file in BOOTP replies
+#-no-fd-bootchk disable boot signature checking for floppy disks
+#-no-acpi disable ACPI
+#-kernel bzImage use 'bzImage' as kernel image
+#-append cmdline use 'cmdline' as kernel command line
+#-initrd file use 'file' as initial ram disk
+#-serial dev redirect the serial port to char device 'dev'
+#-parallel dev redirect the parallel port to char device 'dev'
+#-monitor dev redirect the monitor to char device 'dev'
+#-pidfile file write PID to 'file'
+#-d item1,... output log to /tmp/qemu.log (use -d ? for a list of log items)
+#-L path set the directory for the BIOS, VGA BIOS and keymaps
+#-bios file set the filename for the BIOS
+#-no-kvm disable KVM hardware virtualization
+#-enable-nesting enable support for running a VM inside the VM (AMD only)
+#-no-reboot exit instead of rebooting
+#-no-shutdown stop before shutdown
+#-loadvm [tag|id]
+# start right away with a saved state (loadvm in monitor)
+#-daemonize daemonize QEMU after initializing
+#-kvm-shadow-memory megs set the amount of shadow pages to be allocated
+#-mem-path set the path to hugetlbfs/tmpfs mounted directory, also
+# enables allocation of guest memory with huge pages
+#-mem-prealloc toggles preallocation of -mem-path backed physical memory
+# at startup. Default is enabled.
+#-option-rom rom load a file, rom, into the option ROM space
+#-localtime set the real time clock to local time [default=utc]
+#-startdate select initial date of the clock
+#-icount [N|auto]
+# enable virtual instruction counter with 2^N clock ticks per instruction
+#-echr chr set terminal escape character instead of ctrl-a
+#-virtioconsole c
+# set virtio console
+#-show-cursor show cursor
+
+# check for kvm modules
+if [ -c /dev/kvm ]; then
+ for tool in kvm qemu-kvm; do
+ VIRTCMD=$(which ${tool} 2>/dev/null)
+ [ -n "$VIRTCMD" ] && break
+ done
+else
+ VIRTCMD=$(which qemu 2>/dev/null)
+ writelog "KVM available but /dev/kvm not found!"
+ writelog "Trying fallback to QEMU emulation."
+fi
+
+if [ -z "${VIRTCMD}" ]; then
+ writelog "No QEMU/KVM found, exiting!"
+ rm -rf ${RMDIRS}
+ exit 1
+elif [ "${VIRTCMD##*/}" = "qemu" ]; then
+ writelog "User space emulation:\t\t${VIRTCMD}"
+else
+ writelog "User space virtualization:\t${VIRTCMD}"
+fi
+
+# using snapshots
+VIRTCMDOPTS="${VIRTCMDOPTS} -snapshot"
+
+# TODO: boot als var, -boot n, tftp...
+VIRTCMDOPTS="${VIRTCMDOPTS} -boot c"
+
+# set headless mode
+# define first, you do not want VIRTCMDOPTS from graphical start
+VIRTCMDHL=${VIRTCMD}
+VIRTCMDOPTSHL="${VIRTCMDOPTS} -nographic ${diskfile}"
+
+# graphical start
+# vga std/cirrus/vmware?
+#VIRTCMDOPTS="${VIRTCMDOPTS} -vga std -full-screen ${diskfile}"
+VIRTCMDOPTS="${VIRTCMDOPTS} ${diskfile}"
diff --git a/os-plugins/plugins/qemukvm/init-hooks/20-nw-bridge-config/bridge.sh b/os-plugins/plugins/qemukvm/init-hooks/20-nw-bridge-config/bridge.sh
index 6aabe8ad..c4c548fb 100644
--- a/os-plugins/plugins/qemukvm/init-hooks/20-nw-bridge-config/bridge.sh
+++ b/os-plugins/plugins/qemukvm/init-hooks/20-nw-bridge-config/bridge.sh
@@ -10,7 +10,7 @@
# General information about OpenSLX can be found at http://openslx.org
#
# Init hook to create a bridge on the active network interface
-# (should be kept identical to the files of virtualbox and qemukvm plugins)
+# (should be kept identical to the files of virtualbox and vmware plugins)
#############################################################################
local bridge=br0
diff --git a/os-plugins/plugins/qemukvm/init-hooks/60-have-servconfig/vm-dhcpd.sh b/os-plugins/plugins/qemukvm/init-hooks/60-have-servconfig/vm-dhcpd.sh
new file mode 100755
index 00000000..396631c1
--- /dev/null
+++ b/os-plugins/plugins/qemukvm/init-hooks/60-have-servconfig/vm-dhcpd.sh
@@ -0,0 +1,60 @@
+#!/bin/ash
+# Copyright (c) 2010 - 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 feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# Init hook to create a bridge on the active network interface
+# (should be kept identical to the files of virtualbox and vmware plugins)
+#############################################################################
+
+. /etc/openslx.conf
+
+CONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}
+testmkd ${CONFDIR}
+
+# configuring dhcpd stub for virtual networks
+cat > ${CONFDIR}/udhcpd.conf << EOF
+# general udhcpd configuration file for virtual machines written by
+# $0 during OpenSLX stage3 configuration
+
+# start and end of the IP lease block
+start CNETWORK.20
+end CNETWORK.100
+
+# interface that udhcpd will use
+interface NWIF
+
+# how long an offered address is reserved (leased) in seconds
+offer_time 6000
+
+# location of the leases file
+lease_file LEASEFILE
+
+# location of the pid file
+pidfile PIDFILE
+
+option dns ${domain_name_servers}
+option subnet 255.255.255.0
+option router CNETWORK.254
+option wins CNETWORK.10
+option domain virtual.site ${domain_name}
+
+# additional options known to udhcpd
+#subnet #timezone
+#router #timesvr
+#namesvr #dns
+#logsvr #cookiesvr
+#lprsvr #bootsize
+#domain #swapsvr
+#rootpath #ipttl
+#mtu #broadcast
+#wins #lease
+#ntpsrv #tftp
+#bootfile
+EOF
diff --git a/os-plugins/plugins/syslog/OpenSLX/Distro/Base.pm b/os-plugins/plugins/syslog/OpenSLX/Distro/Base.pm
index 25be964c..654d755e 100644
--- a/os-plugins/plugins/syslog/OpenSLX/Distro/Base.pm
+++ b/os-plugins/plugins/syslog/OpenSLX/Distro/Base.pm
@@ -53,6 +53,7 @@ sub runlevelInfo
my %nameMap = (
'syslogd' => 'sysklogd',
'syslog-ng' => 'syslog-ng',
+ 'rsyslog' => 'rsyslog',
);
my $rlInfo = {
scriptName => $nameMap{$kind},
@@ -71,6 +72,20 @@ sub getPackageName
my %nameMap = (
'syslogd' => 'sysklogd',
'syslog-ng' => 'syslog-ng',
+ 'rsyslog' => 'rsyslog',
+ );
+ return $nameMap{$name};
+}
+
+sub getBinaryName
+{
+ my $self = shift;
+ my $name = shift;
+
+ my %nameMap = (
+ 'syslogd' => 'sysklogd',
+ 'syslog-ng' => 'syslog-ng',
+ 'rsyslog' => 'rsyslogd',
);
return $nameMap{$name};
}
diff --git a/os-plugins/plugins/syslog/OpenSLX/OSPlugin/syslog.pm b/os-plugins/plugins/syslog/OpenSLX/OSPlugin/syslog.pm
index 6645f9ef..2952f2e7 100644
--- a/os-plugins/plugins/syslog/OpenSLX/OSPlugin/syslog.pm
+++ b/os-plugins/plugins/syslog/OpenSLX/OSPlugin/syslog.pm
@@ -68,9 +68,9 @@ sub getAttrInfo
description => unshiftHereDoc(<<' End-of-Here'),
kind of syslog to use \(syslogd-ng or old-style syslog\)
End-of-Here
- content_regex => qr{^(syslog-ng|syslog)$},
- content_descr => 'allowed: syslogd-ng, syslog',
- default => 'syslog-ng',
+ content_regex => qr{^(syslog-ng|syslogd|rsyslog)$},
+ content_descr => 'allowed: syslog-ng, syslogd, rsyslog',
+ default => 'rsyslog',
},
'syslog::host' => {
applies_to_systems => 1,
@@ -126,19 +126,27 @@ sub installationPhase
my $engine = $self->{'os-plugin-engine'};
- if ($self->{kind} eq 'syslog-ng' && !isInPath('syslog-ng')) {
+ if ($self->{kind} eq 'rsyslog' && !isInPath($self->{distro}->getBinaryName('rsyslog'))) {
$engine->installPackages($self->{distro}->getPackageName('syslog-ng'));
}
+
+ if ($self->{kind} eq 'syslog-ng' && !isInPath('syslog-ng')) {
+ $engine->installPackages($self->{distro}->getPackageName($self->{distro}->getBinaryName('syslog-ng')));
+ }
+
# not sure if we ever should setup this service
- if ($self->{kind} eq 'syslogd' && !isInPath('syslog')) {
+ if ($self->{kind} eq 'syslogd' && !isInPath($self->{distro}->getBinaryName('syslogd'))) {
$engine->installPackages($self->{distro}->getPackageName('syslogd'));
}
if (!$self->{kind}) {
- if (qx{which syslog-ng}) {
+ if (qx{which $self->{distro}->getBinaryName('rsyslog')}) {
+ $self->{kind} = 'rsyslog';
+ }
+ elsif (qx{which $self->{distro}->getBinaryName('syslog-ng')}) {
$self->{kind} = 'syslog-ng';
}
- elsif (qx{which syslogd}) {
+ elsif (qx{which $self->{distro}->getBinaryName('syslogd')}) {
$self->{kind} = 'syslogd';
}
else {
@@ -150,7 +158,10 @@ sub installationPhase
}
# start to actually do something - according to current stage1 attributes
- if ($self->{kind} eq 'syslog-ng') {
+ if ($self->{kind} eq 'rsyslog') {
+ $self->_setupRsyslog($self->{attrs});
+ }
+ elsif ($self->{kind} eq 'syslog-ng') {
$self->_setupSyslogNG($self->{attrs});
}
elsif ($self->{kind} eq 'syslogd') {
@@ -158,7 +169,7 @@ sub installationPhase
}
else {
die _tr(
- 'unknown kind "%s" given, only "syslog-ng" and "syslogd" are supported!',
+ 'unknown kind "%s" given, only "rsyslog", "syslog-ng" and "syslogd" are supported!',
$self->{kind}
);
}
@@ -174,6 +185,14 @@ sub removalPhase
return;
}
+sub _setupRsyslog
+{
+ my $self = shift;
+ my $attrs = shift;
+
+ return;
+}
+
sub _setupSyslogNG
{
my $self = shift;
@@ -229,6 +248,7 @@ sub _setupSyslogNG
END
fi
+ testmkd /mnt/var/run/rsyslog
rllinker $rlInfo->{scriptName} $rlInfo->{startAt} $rlInfo->{stopAt}
End-of-Here
diff --git a/os-plugins/plugins/virtualbox/OpenSLX/Distro/Suse.pm b/os-plugins/plugins/virtualbox/OpenSLX/Distro/Suse.pm
index fad96ea1..9af3191e 100644
--- a/os-plugins/plugins/virtualbox/OpenSLX/Distro/Suse.pm
+++ b/os-plugins/plugins/virtualbox/OpenSLX/Distro/Suse.pm
@@ -31,6 +31,7 @@ sub installVbox
my $self = shift;
my $engine = $self->{'engine'};
+ # should be replaced by proper function
my $release = `lsb_release -rs`;
chomp($release);
diff --git a/os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm b/os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm
index e936590e..fd1424f1 100644
--- a/os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm
+++ b/os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm
@@ -1,4 +1,4 @@
-# Copyright (c) 2009 - OpenSLX GmbH
+# Copyright (c) 2009..2010 - OpenSLX GmbH
#
# This program is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
@@ -9,7 +9,7 @@
# General information about OpenSLX can be found at http://openslx.org/
# -----------------------------------------------------------------------------
# virtualbox.pm
-# - Declares necessary information for the virtualbox plugin
+# - declares necessary information for the virtualbox plugin
# -----------------------------------------------------------------------------
package OpenSLX::OSPlugin::virtualbox;
@@ -168,7 +168,7 @@ sub _writeRunlevelScript
);
$initfile->addFunction(
'vmstatus',
- ' if running vboxdrv; then
+ 'if running vboxdrv; then
if running vboxnetflt; then
echo "VirtualBox kernel modules (vboxdrv and vboxnetflt) are loaded."
else
@@ -188,7 +188,7 @@ sub _writeRunlevelScript
' modprobe vboxdrv && modprobe vboxnetflt',
);
$initfile->addFunction(
- 'stop',
+ 'stop',
' rmmod vboxnetflt && rmmod vboxdrv',
);
$initfile->addToCase(
@@ -208,12 +208,9 @@ sub _writeRunlevelScript
'stop && start'
);
- # get distro version (does not work and makes no sense to call an external
- # function which is not available in all distros)
- # my $workaround_distro = qx(lsb_release -si);
- # alternative from bootsplash.pm
- my $workaround_distro = (split('-',$self->{'os-plugin-engine'}->distroName()))[0];
- my $runlevelscript = getInitFileForDistro($initfile, $workaround_distro);
+ # get distro version
+ 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...
diff --git a/os-plugins/plugins/vmchooser/OpenSLX/Distro/Base.pm b/os-plugins/plugins/vmchooser/OpenSLX/Distro/Base.pm
index ba8a32b0..43e4ea1f 100644
--- a/os-plugins/plugins/vmchooser/OpenSLX/Distro/Base.pm
+++ b/os-plugins/plugins/vmchooser/OpenSLX/Distro/Base.pm
@@ -54,11 +54,11 @@ sub copyDefaultSession
# Take the default path of SuSE
# (as we have the most experience with it)
- if( -f "/etc/X11/sessions/default.desktop") {
- rename("/etc/X11/sessions/default.desktop",
- "/etc/X11/sessions/default.desktop.back")
+ if( -f "/etc/X11/session/default.desktop") {
+ rename("/etc/X11/session/default.desktop",
+ "/etc/X11/session/default.desktop.back")
}
- copyFile("$pluginroot/default.desktop","/etc/X11/sessions");
+ copyFile("$pluginroot/default.desktop","/etc/X11/session");
return 1;
} \ No newline at end of file
diff --git a/os-plugins/plugins/vmchooser/OpenSLX/Distro/Suse.pm b/os-plugins/plugins/vmchooser/OpenSLX/Distro/Suse.pm
index 9e0bf551..c93a066b 100644
--- a/os-plugins/plugins/vmchooser/OpenSLX/Distro/Suse.pm
+++ b/os-plugins/plugins/vmchooser/OpenSLX/Distro/Suse.pm
@@ -1,4 +1,4 @@
-# Copyright (c) 2008 - OpenSLX GmbH
+# Copyright (c) 2008..2010 - OpenSLX GmbH
#
# This program is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
@@ -33,17 +33,15 @@ use OpenSLX::Utils;
sub copyDefaultSession
{
- my $self = shift;
- my $pluginroot = shift;
-
-
- # Take the default path of SuSE
- # (as we have the most experience with it)
- if( -f "/etc/X11/sessions/default.desktop") {
- rename("/etc/X11/sessions/default.desktop",
- "/etc/X11/sessions/default.desktop.back")
+ my $self = shift;
+ my $pluginroot = shift;
+
+ # Take the default path of SuSE
+ # (as we have the most experience with it)
+ if( -f "/etc/X11/session/default.desktop") {
+ rename("/etc/X11/session/default.desktop",
+ "/etc/X11/session/default.desktop.back")
}
- copyFile("$pluginroot/default.desktop","/etc/X11/sessions");
-
- return 1;
+ copyFile("$pluginroot/default.desktop","/etc/X11/session");
+ return 1;
} \ No newline at end of file
diff --git a/os-plugins/plugins/vmchooser/XX_vmchooser.sh b/os-plugins/plugins/vmchooser/XX_vmchooser.sh
index d3ade116..168bcda1 100644
--- a/os-plugins/plugins/vmchooser/XX_vmchooser.sh
+++ b/os-plugins/plugins/vmchooser/XX_vmchooser.sh
@@ -1,5 +1,5 @@
# Copyright (c) 2008, 2009 - RZ Uni Freiburg
-# Copyright (c) 2008, 2009 - OpenSLX GmbH
+# Copyright (c) 2008..2010 - OpenSLX GmbH
#
# This program/file is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
@@ -51,32 +51,6 @@ if [ -e $CONFFILE ]; then
mount -n -t msdos -o loop,umask=000 ${PLUGINCONFDIR}/loopimg/fd.img \
${PLUGINCONFDIR}/fd-loop
- # create run-virt.include header (and fill in information on removable
- # devices if present
- echo -e "# run-virt.include created by $0 during stage3 plugin setup" \
- >${PLUGINCONFDIR}/run-virt.include
-
- waitfor /etc/hwinfo.cdrom
- j=0
- for i in $(cat /etc/hwinfo.cdrom); do
- echo "cdrom_$j=$i" >>${PLUGINCONFDIR}/run-virt.include
- j=$(expr $j + 1)
- done
-
- waitfor /etc/hwinfo.floppy
- j=0
- for i in $(cat /etc/hwinfo.floppy); do
- echo "floppy_$j=$i" >>${PLUGINCONFDIR}/run-virt.include
- j=$(expr $j + 1)
- done
-
- CPU_CORES=$(grep 'processor.*:' /proc/cpuinfo | wc -l)
- if [ "${CPU_CORES}" -gt "1" 2>/dev/null ]; then
- echo "cpu_cores=\"${CPU_CORES}\"" >>${PLUGINCONFDIR}/run-virt.include
- else
- echo 'cpu_cores="1"' >>${PLUGINCONFDIR}/run-virt.include
- fi
-
# finished ...
[ $DEBUGLEVEL -gt 0 ] && echo "done with 'vmchooser' os-plugin ..."
fi
diff --git a/os-plugins/plugins/vmchooser/files/run-virt.sh b/os-plugins/plugins/vmchooser/files/run-virt.sh
index 5aefc47e..771ebef4 100644
--- a/os-plugins/plugins/vmchooser/files/run-virt.sh
+++ b/os-plugins/plugins/vmchooser/files/run-virt.sh
@@ -22,8 +22,9 @@
. /etc/opt/openslx/openslx.conf
PLUGINCONFROOT=${OPENSLX_DEFAULT_CONFDIR}/plugins
PLUGINCONFDIR=${PLUGINCONFROOT}/vmchooser
-# include general configuration from vmchooser
-. ${PLUGINCONFDIR}/run-virt.include
+# load general virtualization information
+[ -f ${PLUGINCONFROOT}/virtualization/virtualization.conf ] && \
+ . ${PLUGINCONFROOT}/virtualization/virtualization.conf
# Sanity checks
################################################################################
@@ -40,13 +41,14 @@ xml=$1
################################################################################
# File name of the image
-imagename=$(grep -io "<image_name param=.*\"" ${xml} | \
+imgname=$(grep -io "<image_name param=.*\"" ${xml} | \
awk -F "\"" '{ print $2 }')
case ${xml} in
/tmp/*)
# we do not need folder name as it is already included by vmchooser
- diskfile=$imagename
+ diskfile=$imgname
+ imgname=$(basename ${imgname})
;;
*)
# Path to the image
@@ -54,18 +56,25 @@ case ${xml} in
[ -z $imgpath ] && \
{ imgpath=$(readlink -f $xml); imgpath=${imgpath%/*.xml}; }
# Diskfile is file including absolute path to it
- diskfile=$imgpath/$imagename
+ diskfile=$imgpath/$imgname
;;
esac
+# TODO: change to new var vmpath, remove diskfile afterwards
+vmpath=$diskfile
[ -e $diskfile ] || { echo -e "\n\tImage file $diskfile not found!"; exit 1; }
# Short description of the image (as present in the vmchooser menu line)
-short_description=$(grep -o "short_description param=.*\"" ${xml} | \
+vm_name=$(grep -o "short_description param=.*\"" ${xml} | \
sed -e "s/&.*;/; /g" | awk -F "\"" '{print $2}')
# If ${short_description} not defined use ${image_name}
-short_description=${short_description:-"${image_name}"}
-displayname=${short_description}
+# if ${vm_name} not defined use ${imgname}
+vm_name=${vm_name:-"${imgname%.*}"}
+# define vm_shortname since vm_name can be very long
+vm_shortname=$(echo ${imgname%.*} | sed -e "s, ,-,g")
+displayname=${vm_name}
+# remove blanks
+vm_name=$(echo ${vm_name} | sed -e "s, ,-,g")
# Type of virtual machine to run
virt_mach=$(grep -o "virtualmachine param=.*\"" ${xml} | \
@@ -74,7 +83,7 @@ virt_mach=$(grep -o "virtualmachine param=.*\"" ${xml} | \
# Make a guess from the filename extension if ${virt_mach} is empty (not set
# within the xml file)
if [ -z ${virt_mach} ] ; then
- case "$(echo ${imagename##*.}|tr [A-Z] [a-z])" in
+ case "$(echo ${imgname##*.}|tr [A-Z] [a-z])" in
vmdk)
virt_mach="vmware"
;;
@@ -104,19 +113,29 @@ parallel=$(grep -io '<parport param=.*"' ${xml} | awk -F '"' '{ print $2 }')
# Declaration of default variables
###############################################################################
+# VM-ID static (0D)
+VM_ID="00"
+
# cpu cores
cpu_cores="${cpu_cores}"
-# Get total amount of memory installed in your machine
-totalmem=$(expr $(grep -i "memtotal" /proc/meminfo | awk '{print $2}') / 1024)
+# check for CPU virtualization flags
+
+# total amount of memory defined in stage 3
permem=60
+# get a result which can be divided through 4
mem=$(expr ${totalmem} / 100 \* ${permem} / 4 \* 4)
-
-# Configuring ethernet mac address: first four bytes are fixed (00:50:56:0D)
-# the last two bytes are taken from the first local network adaptor of the host
-# system
-mac=$(/sbin/ifconfig eth0 | grep eth0 | sed -e "s/ //g" \
- | awk -F ":" '{print $(NF-1)":"$NF}')
+[ -n "${mainvirtmem}" ] && forcemem=$(expr ${mainvirtmem} / 4 \* 4)
+
+# configuring ethernet mac address: first 3 bytes are fixed (00:50:56)
+# 4th byte is the VM-ID (0D)
+# last two bytes are taken from the bridge of the host
+# define one MAC per guest
+macguestpart="00:50:56:${VM_ID}"
+machostpart=$(echo ${machostaddr} | awk -F ":" '{print $(NF-1)":"$NF}')
+macaddr=$(echo "${macguestpart}:${machostpart}" | tr [a-z] [A-Z])
+#TODO: remove when vmware modified
+mac=${machostpart}
# virtual fd/cd/dvd and drive devices, floppy b: for configuration
# if $floppy_0 from run-virt.include set then fdtest="TRUE"
@@ -142,6 +161,10 @@ ide="TRUE"
scsi="FALSE"
hddrv="ide"
+# add rw share
+sharepath="${HOME}"
+sharename="home"
+
# Display resolution within the host system
hostres=$(xvidtune -show 2>/dev/null| grep -ve "^$")
xres=$(echo "${hostres}" | awk '{print $3}')
@@ -220,11 +243,11 @@ writelog ()
# Logo for console
cat <<EOL
-
- .----.--.--.-----.--.--.--.----.-----.
- | _| | | | | | | _|_ _|
- |__| |_____|__|__|\___/|__|__| |_|
-OpenSLX script for preparing virtual machine environment ...
+ __ __
+ .----.--.--.-----.___.--.--.|__|.----.| |_
+ | _| | | |___| | || || _|| _|
+ |__| |_____|__|__| \___/ |__||__| |____|
+ OpenSLX virtual machine environment preparation script ...
EOL
@@ -241,15 +264,17 @@ writelog "finished\n"
# Copy guest configuration (with added information) config.xml to be accessed
# via virtual floppy
# fixme -> to be changed (vmchooser adapts the file content!?)
-echo "Please fix the config.xml generation"
+#TODO: wozu echo?
+#echo "Please fix the config.xml generation"
cp ${xml} ${PLUGINCONFDIR}/fd-loop/config.xml
# Check if virtual machine container file exists
-filecheck
+#filecheck
# Get all virtual machine specific stuff from the respective include file
-if [ -e ${PLUGINCONFROOT}/${virt_mach}/run-${virt_mach}.include ] ; then
- . ${PLUGINCONFROOT}/${virt_mach}/run-${virt_mach}.include
+if [ -e ${PLUGINCONFROOT}/${virt_mach}/run-virt.include ] ; then
+ self=${virt_mach}
+ . ${PLUGINCONFROOT}/${virt_mach}/run-virt.include
# start a windowmanager for easier handling
# (expect problems /w windows opening in background /w vmware without wm)
for dm in xfwm4 metacity openbox blackbox kwin fvwm2 ; do
@@ -264,7 +289,7 @@ if [ -e ${PLUGINCONFROOT}/${virt_mach}/run-${virt_mach}.include ] ; then
fi
done
${VIRTCMD} ${VIRTCMDOPTS}
- writelog "Bye.\n"
+ writelog "Bye."
exit 0
else
writelog "Failed because of missing ${virt_mach} plugin."
diff --git a/os-plugins/plugins/vmchooser/init-hooks/80-after-plugins/virtualization.sh b/os-plugins/plugins/vmchooser/init-hooks/80-after-plugins/virtualization.sh
new file mode 100644
index 00000000..400075cd
--- /dev/null
+++ b/os-plugins/plugins/vmchooser/init-hooks/80-after-plugins/virtualization.sh
@@ -0,0 +1,135 @@
+# Copyright (c) 2008..2010 - RZ Uni Freiburg
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program/file 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 feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# script is included from init via the "." load function - thus it has all
+# variables and functions available
+
+# virtual virtualization plugin
+# make sure that this file is the same in vmgrid and vmchooser plugin!
+
+# include default directories
+. /etc/openslx.conf
+
+CONFFILEVMCHOOSER="/initramfs/plugin-conf/vmchooser.conf"
+CONFFILEVMGRID="/initramfs/plugin-conf/vmgrid.conf"
+PLUGINCONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/virtualization
+
+# check if plugins available
+active=0
+[ -f ${CONFFILEVMCHOOSER} ] && . ${CONFFILEVMCHOOSER}
+[ ${vmchooser_active} -ne 0 ] && active=1
+[ -f ${CONFFILEVMGRID} ] && . ${CONFFILEVMGRID}
+[ ${vmgrid_active} -ne 0 ] && active=1
+
+[ $DEBUGLEVEL -gt 0 ] \
+ && echo -e "Executing the virtual 'virtualization' plugin ... \c"
+
+if [ ${active} -ne 0 ] ; then
+
+ # load general configuration
+ . /etc/initramfs-setup
+ # include functions
+ . /etc/functions
+
+ testmkd ${PLUGINCONFDIR}
+
+ # check if vmgrid active and change free mem
+ totalmem=$(expr $(grep -i "memtotal" /proc/meminfo \
+ | awk '{print $2}') / 1024)
+ echo "totalmem=${totalmem}" >> ${PLUGINCONFDIR}/virtualization.conf
+
+ if [ ${vmgrid_active} -ne 0 ]; then
+
+ totalmemtest=$(expr $(echo ${vmgrid_memratio} \
+ | awk -F ',' '{print $1" + "$2" + "$3" + "$4" + "$5" + "$6}'))
+
+ # not more than 100% memory assigned
+ if [ ${totalmemtest} -le 100 2>/dev/null ]; then
+
+ # host mem
+ hostratio=$(echo ${vmgrid_memratio} | awk -F ',' '{print $6}')
+ hostmem=$(expr ${totalmem} \* ${hostratio} / 100 2>/dev/null)
+ if [ ${hostmem} -lt 256 2>/dev/null ]; then
+ # min. 256 MB for host
+ hostmem=256
+ fi
+
+ # main vm mem (vmchooser)
+ if [ ${vmchooser_active} -ne 0 ]; then
+ mainvirtratio=$(echo ${vmgrid_memratio} | awk -F ',' '{print $5}')
+ mainvirtmem=$(expr ${totalmem} \* ${mainvirtratio} / 100 2>/dev/null)
+ if [ ${mainvirtmem} -lt 512 2>/dev/null ]; then
+ # min. 512 for vmchooser
+ mainvirtmem=512
+ fi
+ else
+ mainvirtratio=0
+ mainvirtmem=0
+ fi
+
+ cat << EOF >> ${PLUGINCONFDIR}/virtualization.conf
+hostratio=${hostratio}
+hostmem=${hostmem}
+mainvirtratio=${mainvirtratio}
+mainvirtmem=${mainvirtmem}
+EOF
+
+ fi
+ fi
+
+ # cpu cores
+ CPU_CORES=$(grep 'processor.*:' /proc/cpuinfo | wc -l)
+ if [ "${CPU_CORES}" -gt "1" 2>/dev/null ]; then
+ echo "cpu_cores=${CPU_CORES}" \
+ >> ${PLUGINCONFDIR}/virtualization.conf
+ else
+ echo 'cpu_cores=1' >> ${PLUGINCONFDIR}/virtualization.conf
+ fi
+
+ # arch
+ echo "host_arch=$(uname -m)" >> ${PLUGINCONFDIR}/virtualization.conf
+
+ # VT enabled cpu?
+ if grep -q ^flags.*\\\<vmx\\\> /proc/cpuinfo; then
+ echo "vtflag=1" >> ${PLUGINCONFDIR}/virtualization.conf
+ echo 'kvm_module="kvm_intel"' >> ${PLUGINCONFDIR}/virtualization.conf
+ elif grep -q ^flags.*\\\<svm\\\> /proc/cpuinfo; then
+ echo "vtflag=1" >> ${PLUGINCONFDIR}/virtualization.conf
+ echo 'kvm_module="kvm_amd"' >> ${PLUGINCONFDIR}/virtualization.conf
+ else
+ echo "vtflag=0" >> ${PLUGINCONFDIR}/virtualization.conf
+ fi
+
+ # write mac
+ echo "machostaddr=${macaddr}" >> ${PLUGINCONFDIR}/virtualization.conf
+
+ # get further hw information
+ waitfor /etc/hwinfo.cdrom
+ j=0
+ for i in $(cat /etc/hwinfo.cdrom); do
+ echo "cdrom_$j=$i" >> ${PLUGINCONFDIR}/virtualization.conf
+ j=$(expr $j + 1)
+ done
+
+ waitfor /etc/hwinfo.floppy
+ j=0
+ for i in $(cat /etc/hwinfo.floppy); do
+ echo "floppy_$j=$i" >> ${PLUGINCONFDIR}/virtualization.conf
+ j=$(expr $j + 1)
+ done
+
+ # finished ...
+ [ $DEBUGLEVEL -gt 0 ] \
+ && echo "ok"
+else
+ [ $DEBUGLEVEL -gt 0 ] \
+ && echo "failed"
+fi
diff --git a/os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm b/os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm
new file mode 100644
index 00000000..d73e0720
--- /dev/null
+++ b/os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm
@@ -0,0 +1,322 @@
+# Copyright (c) 2008, 2009 - 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/
+# -----------------------------------------------------------------------------
+# vmgrid.pm
+# - ...
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::vmgrid;
+
+use strict;
+use warnings;
+
+use base qw(OpenSLX::OSPlugin::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+use OpenSLX::DistroUtils;
+
+sub new
+{
+ my $class = shift;
+
+ my $self = {
+ name => 'vmgrid',
+ };
+
+ return bless $self, $class;
+}
+
+# TODO: desc
+sub getInfo
+{
+ my $self = shift;
+
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ ...
+ End-of-Here
+ precedence => 80,
+ #required => [ qr{^(vmware|virtualbox|qemukvm|xen)$} ],
+ #openvz|vserver
+ # TODO: virtaul plugin (requires, provides?)
+ #required => [ qw( virtualization ) ],
+ #provided => [ qw( virtualization ) ],
+ };
+}
+
+sub getAttrInfo
+{
+ my $self = shift;
+
+ return {
+ 'vmgrid::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'vmgrid'-plugin be executed during boot?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '1',
+ },
+ 'vmgrid::virt' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ which virtualization technique schould be used?
+ End-of-Here
+ content_regex => qr{^(vmware|virtualbox|qemukvm|xen)$},
+ #openvz|vserver
+ content_descr => 'vmware, virtualbox, qemukvm, xen',
+ #openvz, vserver
+ default => undef,
+ },
+ 'vmgrid::roshare' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ do you want to mount external resources?
+ e.g. NFS share /w virt images ...
+ will be mounted to /var/lib/virt/vmgrid
+ End-of-Here
+ content_regex => qr{^nfs://},
+ content_descr => 'NFS share as URI (nfs://...)',
+ default => undef,
+ },
+ 'vmgrid::rwshare' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ do you want a persistent storage device?
+ use local hard drive (ID45) or NFS share.
+ will be mounted to /var/opt/openslx/plugins/vmgrid/share
+ End-of-Here
+ content_regex => qr{^(id45|nfs://)},
+ content_descr => 'NFS share as URI (nfs://...) or "id45"',
+ default => undef,
+ },
+ 'vmgrid::imgpath' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ location of virtual images
+ for starts /wo full path
+ End-of-Here
+ content_descr => 'absolute path to vm image files',
+ default => '/var/lib/virt/vmgrid/images',
+ },
+ 'vmgrid::xmlpath' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ location of XML configuration for virtual images
+ for starts /wo full path
+ End-of-Here
+ content_descr => 'absolute path to vm xml files',
+ default => '/var/lib/virt/vmgrid/xml',
+ },
+ 'vmgrid::startvms' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ which virtaul machines should be started per default
+ comma separated list. first will be started first,
+ second second, and so on, max. 4 VMs
+ End-of-Here
+ content_descr => 'name of xml file e.g. scilin-5.4-wn(.xml)',
+ default => undef,
+ },
+ 'vmgrid::hvm' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ use hardware virtualization, if applicable
+ override the settings of the corresponding virt plugin
+ (only if supported by plugin)
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '"0", "1" or "-" (for unset)',
+ default => undef,
+ },
+ 'vmgrid::maxvcpus' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ use this number of vcpus as maximum for one vm
+ will be used only if applicable
+ (only if supported by plugin)
+ End-of-Here
+ content_regex => qr{^(1|2|4|8|16)$},
+ content_descr => '1, 2, 4, 8, 16',
+ default => undef,
+ },
+ 'vmgrid::minvcpus' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ use this number of vcpus as minimum for one vm
+ will be used only if applicable
+ (only if supported by plugin)
+ End-of-Here
+ content_regex => qr{^(1|2|4|8|16)$},
+ content_descr => '1, 2, 4, 8, 16',
+ default => undef,
+ },
+ 'vmgrid::memratio' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ define memory ratio in nn%
+ order: grid client 1, 2, 3, 4, other VMs, host
+ if desktop virtualization defined the free memory will be
+ distributed between the remaining grid clients,
+ according to their ratio
+ if less than 4 VMs defined in startvms the memory is being
+ reserved for a later manual start
+ set to 0 if you don't intend to start them manually
+ (only if supported by plugin)
+ End-of-Here
+ content_regex => qr{^(\d\d??,\d\d??,\d\d??,\d\d??,\d\d??,\d\d??)$},
+ content_descr => '\d\d??,\d\d??,\d\d??,\d\d??,\d\d??,\d\d??',
+ default => '40,0,0,0,40,20',
+ },
+ 'vmgrid::maxram' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ maximum of RAM used for ALL vms
+ will be used only if applicable
+ (only if supported by plugin)
+ End-of-Here
+ content_regex => qr{^(1|2|3|4|5|6|7|8|9)},
+ content_descr => 'absolute or relative e.g. 512 or 50%',
+ default => undef,
+ },
+ 'vmgrid::minram' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ minimum of RAM used for ALL vms
+ will be used only if applicable
+ (only if supported by plugin)
+ End-of-Here
+ content_regex => qr{^(1|2|3|4|5|6|7|8|9)},
+ content_descr => 'absolute or relative e.g. 512 or 50%',
+ default => undef,
+ },
+ };
+}
+
+sub installationPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
+ my $openslxBasePath = $info->{'openslx-base-path'};
+
+ $self->_writeRunlevelScript();
+
+ # copy all needed files now:
+ my $pluginName = $self->{'name'};
+ my $pluginBasePath = "$openslxBasePath/lib/plugins/$pluginName/files";
+ foreach my $file ( qw( vmgrid run-vmgrid.sh ) ) {
+ copyFile("$pluginBasePath/$file", "$pluginRepoPath/");
+ chmod 0755, "$pluginRepoPath/$file";
+ }
+
+ return;
+}
+
+sub removalPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ return;
+}
+
+# Write the runlevelscript
+sub _writeRunlevelScript
+{
+ my $self = shift;
+ my $initfile = newInitFile();
+
+ $initfile->setName("vmgrid-slx");
+ $initfile->setDesc("Setup environment for vmgrid. Part of OpenSLX vmgrid plugin.");
+
+ # todo: Function need to be formated proper... not important right now
+ #$initfile->addFunction(
+ # 'running',
+ # 'lsmod | grep -q "$1[^_-]"'
+ #);
+
+ # Is a VM running?
+ my $runningvms = unshiftHereDoc(<<' End-of-Here');
+ if [ -e /tmp/vmgrid/vmgrid.pids ]; then
+ for pid in $(cat /tmp/vmgrid/vmgrid.pids); do
+ if ps aux | grep " ${pid} " | grep vmgrid; then
+ echo "Running: ${pid}"
+ fi
+ done
+ fi
+ End-of-Here
+
+ # Kill all VMS!
+ my $killvms = unshiftHereDoc(<<' End-of-Here');
+ if [ -e /tmp/vmgrid/vmgrid.pids ]; then
+ for pid in $(cat /tmp/vmgrid/vmgrid.pids); do
+ if ps aux | grep " ${pid} " | grep vmgrid; then
+ kill ${pid}
+ fi
+ done
+ fi
+ End-of-Here
+
+ # FORCE: Kill all VMS!
+ my $fkillvms = unshiftHereDoc(<<' End-of-Here');
+ if [ -e /tmp/vmgrid/vmgrid.pids ]; then
+ for pid in $(cat /tmp/vmgrid/vmgrid.pids); do
+ if ps aux | grep " ${pid} " | grep vmgrid; then
+ kill -9 ${pid}
+ fi
+ done
+ fi
+ End-of-Here
+
+ $initfile->addFunction(
+ 'start',
+ ' vmgrid',
+ );
+ $initfile->addToCase(
+ 'kill',
+ 'killvms'
+ );
+ $initfile->addToCase(
+ 'force-kill',
+ 'fkillvms'
+ );
+ $initfile->addToCase(
+ 'status',
+ 'runningvms'
+ );
+ $initfile->addToCase(
+ 'restart',
+ 'stop && start'
+ );
+
+ # get distro version
+# my $distro = (split('-',$self->{'os-plugin-engine'}->distroName()))[0];
+# my $runlevelscript = getInitFileForDistro($initfile, $distro);
+#
+# spitFile("$self->{'pluginRepositoryPath'}/vmgrid-slx", $runlevelscript);
+}
+
+1;
diff --git a/os-plugins/plugins/vmgrid/XX_vmgrid.sh b/os-plugins/plugins/vmgrid/XX_vmgrid.sh
new file mode 100644
index 00000000..f75c895d
--- /dev/null
+++ b/os-plugins/plugins/vmgrid/XX_vmgrid.sh
@@ -0,0 +1,104 @@
+# Copyright (c) 2008..2010 - RZ Uni Freiburg
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program/file 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 feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# script is included from init via the "." load function - thus it has all
+# variables and functions available
+
+# include default directories
+. /etc/openslx.conf
+
+CONFFILE="/initramfs/plugin-conf/vmgrid.conf"
+PLUGINCONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/vmgrid
+VIRTUALIZATIONPLUGIN=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/virtualization
+#RWSHARE=/mnt/${OPENSLX_DEFAULT_VARDIR}/plugins/vmgrid/share
+RWSHARE=/mnt/var/opt/openslx/plugins/vmgrid/share
+RWSHAREMNT=/mnt/var/opt/openslx/mnt/vmgrid
+BINDIR=/mnt/${OPENSLX_DEFAULT_BINDIR}
+PLUGINDIR=${OPENSLX_DEFAULT_DIR}/plugin-repo/vmgrid
+VIRTDIR=/mnt/${OPENSLX_DEFAULT_VIRTDIR}/vmgrid
+
+if [ -f $CONFFILE ]; then
+
+ # load needed variables
+ . $CONFFILE
+
+ if [ ${vmgrid_active} -ne 0 ] ; then
+ [ ${DEBUGLEVEL} -gt 0 ] && echo "executing the 'vmgrid' os-plugin ..."
+
+ # load general configuration
+ . /etc/initramfs-setup
+ # include functions
+ . /etc/functions
+
+ testmkd ${PLUGINCONFDIR}
+ testmkd ${VIRTDIR}
+ cp $CONFFILE ${PLUGINCONFDIR}/vmgrid.conf
+ # create link to binpath
+ ln -fs ${PLUGINDIR}/vmgrid ${BINDIR}/vmgrid
+ ln -fs ${PLUGINDIR}/run-vmgrid.sh ${BINDIR}/run-vmgrid.sh
+
+ # mount nfs virt ro share
+ if strinstr "nfs://" "${vmgrid_roshare}"; then
+ virtsrcprot=$(uri_token ${vmgrid_roshare} prot)
+ virtsrcserv=$(uri_token ${vmgrid_roshare} server)
+ virtsrcpath="$(uri_token ${vmgrid_roshare} path)"
+ if [ -n "${virtsrcprot}" -a -n "${virtsrcserv}" -a -n "${virtsrcpath}" ];
+ then
+ virtsrctarget=${VIRTDIR}
+ # mount the vmgrid source ro
+ fsmount ${virtsrcprot} ${virtsrcserv} ${virtsrcpath} ${virtsrctarget} \
+ ro
+ fi
+ fi
+
+ # create rw share
+ testmkd ${RWSHARE}
+ # bind mount id 45 to ${RWSHARE}
+ if strinstr "id45" "${vmgrid_rwshare}" ; then
+ id45part=$(grep " 45 " /etc/disk.partition | awk '{print $1}' | \
+ cut -f 3,3 -d /)
+ if [ -n "${id45part}" ]; then
+ testmkd /mnt/media/${id45part}/vmgrid
+ mount --bind -n /mnt/media/${id45part}/vmgrid ${RWSHARE} \
+ >>/tmp/vmgrid.log 2>&1
+ fi
+ # mount nfs rw share
+ elif strinstr "nfs://" "${vmgrid_rwshare}" ; then
+ rwshareprot=$(uri_token ${vmgrid_rwshare} prot)
+ rwshareserv=$(uri_token ${vmgrid_rwshare} server)
+ rwsharepath="$(uri_token ${vmgrid_rwshare} path)"
+ if [ -n "${rwshareprot}" -a -n "${rwshareserv}" -a -n "${rwsharepath}" ];
+ then
+ # mount to a dir fist to create spec host dir, then bind mount
+ testmkd ${RWSHAREMNT}
+ rwtarget=${RWSHAREMNT}
+ # mount the vmgrid source rw
+ fsmount ${rwshareprot} ${rwshareserv} ${rwsharepath} ${rwtarget} rw
+ # hostname?
+ host_name=${host_name:=$clientip}
+ testmkd ${RWSHAREMNT}/${host_name}
+ mount --bind ${RWSHAREMNT}/${host_name} ${RWSHARE} \
+ >>/tmp/vmgrid.log 2>&1
+ fi
+ else
+ testmkd /mnt/tmp/vmgrid
+ mount --bind -n /mnt/tmp/vmgrid ${RWSHARE} >>/tmp/vmgrid.log 2>&1
+ fi
+ # chmod so that everybody can write
+ chmod 1777 ${RWSHARE}
+ echo "vmgrid_rwmnt=${RWSHARE#/mnt}" >> ${PLUGINCONFDIR}/vmgrid.conf
+
+ # finished ...
+ [ $DEBUGLEVEL -gt 0 ] && echo "done with 'vmgrid' os-plugin ..."
+ fi
+else
+ [ $DEBUGLEVEL -gt 0 ] && echo " * configuration of 'vmgrid' os-plugin failed"
+fi
diff --git a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh
new file mode 100644
index 00000000..1501749e
--- /dev/null
+++ b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh
@@ -0,0 +1,395 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Copyright (c) 2007..2010 - RZ Uni FR
+# Copyright (c) 2007..2010 - 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/
+# -----------------------------------------------------------------------------
+# vmgrid
+# - This is the generic wrapper for the several virtualization solutions...
+################################################################################
+
+. /etc/opt/openslx/openslx.conf
+
+################################################################################
+### Define default dirs / get configs
+################################################################################
+
+PLUGINCONFROOT=${OPENSLX_DEFAULT_CONFDIR}/plugins
+PLUGINCONFVMGRID=${PLUGINCONFROOT}/vmgrid
+RWSHARE=/var/opt/openslx/plugins/vmgrid/share
+# include general configuration from vmgrid
+[ -f ${PLUGINCONFVMGRID}/vmgrid.conf ] && \
+ . ${PLUGINCONFVMGRID}/vmgrid.conf
+# load general virtualization information
+[ -f ${PLUGINCONFROOT}/virtualization/virtualization.conf ] && \
+ . ${PLUGINCONFROOT}/virtualization/virtualization.conf
+# get the vmchooser_active var
+[ -f ${PLUGINCONFROOT}/vmchooser/vmchooser.conf ] && \
+ . ${PLUGINCONFROOT}/vmchooser/vmchooser.conf
+
+################################################################################
+### Functions used throughout the script
+################################################################################
+
+# function to write to stdout and logfile
+LOGFILE=${OPENSLX_DEFAULT_LOGDIR}/run-vmgrid.${USER}.$$.log
+writelog () {
+ # write to stdout
+ echo -e "$1"
+ # log into file
+ echo -e "$1" >> ${LOGFILE}
+ # log into share dir, so that log is available in vm as well
+ echo -e "$1" >> ${vmgrid_rwmnt}/logs/run-vmgrid.${USER}.$$.log
+}
+
+################################################################################
+### Get XML file and dir
+################################################################################
+
+# check if mem or graphical mode set
+headless=1
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -h|--help)
+ echo -e "Usage: run-vmgrid.sh [-g] [--mem <memorysize in MB>] \c"
+ echo -e "[/path/]filename[.xml]"
+ exit
+ ;;
+ -g)
+ headless=0
+ ;;
+ --mem)
+ # get a result which can be divided through 4
+ forcemem=$2
+ echo $2 | grep -q '[1-9][0-9]\{2,3\}$' && forcemem=$(expr $2 / 4 \* 4)
+ shift
+ ;;
+ *)
+ xmlfile=$@
+ break
+ ;;
+ esac
+ shift
+done
+
+# absolute or relative path?
+if ls ${xmlfile} 2>/dev/null | grep '/' >/dev/null 2>&1; then
+ xmlpath=$(dirname ${xmlfile})
+ xmlfile=$(basename ${xmlfile})
+else
+ xmlpath=${vmgrid_xmlpath}
+fi
+# full path
+xmlfile="${xmlpath}/${xmlfile%.xml}.xml"
+
+################################################################################
+### Sanity checks
+################################################################################
+
+# test if the xml file is valid
+if ! [ -r "${xmlfile}" ]; then
+ writelog "${xmlfile} not a readable XML file!"
+ run-vmgrid.sh -h &
+ exit 1
+fi
+
+# start to log, create shrare log dir
+mkdir -m 1777 -p ${vmgrid_rwmnt}/logs
+echo "Starting to log at $(date)" \
+ >${vmgrid_rwmnt}/logs/run-vmgrid.${USER}.$$.log
+
+# test how many instances running
+runningvms=$(ps aux | grep "run-vmgrid.sh " | grep -v grep | wc -l)
+# 2 steps, /w only one is seems not to work
+runningvms=$(expr ${runningvms} - 1)
+# if Xen use different method
+if [ "${vmgrid_virt}" = "xen" ]; then
+ runningvms=$(xm list 2>/dev/null | grep -vE "Domain-0|Name.*ID" | wc -l)
+ runningvms=$(expr ${runningvms} + 1)
+fi
+# check value
+if [ ${runningvms} -le 0 ]; then
+ writelog "Error in value: Running VMs: ${runningvms}. Exit!"
+ exit 1
+fi
+# check if vmchooser plugin installed
+if [ -n "${vmchooser_active}" ] && [ ${runningvms} -gt 1 ]; then
+ # only allow one instance of vmgrid
+ writelog "Already 1 VMs running and vmchooser plugin is active."
+ writelog "Can't start ${xmlfile}, exiting!"
+ exit 1
+# else allow max. 4 instances
+elif [ ${runningvms} -gt 4 ]; then
+ writelog "Already 4 VMs running, exiting!"
+ exit 1
+fi
+VM_ID="0${runningvms}"
+
+# test if XML file
+if ! grep '<?xml' "${xmlfile}" >/dev/null 2>&1; then
+ writelog \
+ "Submitted configuration file ${xmlfile} seems to have wrong XML format"
+ exit 1
+fi
+
+################################################################################
+### Logo for console
+################################################################################
+
+cat <<EOL
+ __ __
+ .----.--.--.-----.___.--.--.--------.-----.----.|__|.--| |
+ | _| | | |___| | | | _ | _|| || _ |
+ |__| |_____|__|__| \___/|__|__|__|___ |__| |__||_____|
+ |_____|
+ OpenSLX virtual machine environment preparation script ...
+
+EOL
+
+################################################################################
+### Read needed variables from XML file
+################################################################################
+
+writelog "Starting configuration..."
+writelog "\tVM-ID:\t\t\t${VM_ID}"
+writelog "\tLogfile:\t\t${OPENSLX_DEFAULT_LOGDIR}/run-vmgrid.${USER}.$$.log"
+writelog "\t/tmp info:\t\t$(df -h | grep " /tmp$" | awk '{print $2}') \c"
+writelog "$(grep "/tmp " /proc/mounts | awk '{print $1" "$2" "$3" "$4}')"
+writelog "\tVM XML dir:\t\t$(dirname ${xmlfile})"
+
+if ! grep '<?xml' "${xmlfile}" >/dev/null 2>&1; then
+ writelog \
+ "Submitted configuration file ${xmlfile} seems to have wrong XML format"
+ exit 1
+fi
+
+writelog "\tXML file:\t\t$xmlfile"
+writelog "VM config:"
+
+# name of the virt image or dir
+imgname=$(grep -io '<image_name param=.*"' ${xmlfile} \
+ | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }')
+
+# image mode
+imgmode=$(grep -io '<image_mode param=.*"' ${xmlfile} \
+ | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }')
+
+# get boot attr
+boot=$(grep -io 'boot param=.*"' ${xmlfile} | awk -F '"' '{ print $2 }')
+diskless=0
+
+# special rw image
+if [ "${imgmode}" = "rwimg" ]; then
+ # maybe you want to use an empty rw imgae?
+ # define only for writelog, will be set in the plugin include again!
+ vmpath="{special rw image}"
+ # add new path for rwimg
+ imgpath=${vmgrid_rwmnt}/specialrwimages
+ unset $imgname
+ mkdir -m 1777 -p ${imgpath}
+# diskless boot
+elif [ "${boot}" = "n" ] && [ -z "${imgname}" ]; then
+ diskless=1
+ vmpath="{diskless boot}"
+# imagename /w full path
+elif echo ${imgname} 2>/dev/null | grep -q '^/' >/dev/null 2>&1; then
+ imgpath=$(dirname ${imgname})
+ imgname=$(basename ${imgname})
+ vmpath=${imgpath}/${imgname}
+# get path from var
+else
+ imgpath=${vmgrid_imgpath}
+ vmpath=${imgpath}/${imgname}
+fi
+
+# check if virtual machine container file exists, only if not rwimg
+if ! [ -e "${vmpath}" ] && [ "${imgmode}" != "rwimg" ] && [ ${diskless} -eq 0 ];
+then
+ writelog "Virtual machine image or directory ${vmpath} not found!"
+ exit 1
+fi
+
+# name of the virt machine, sed because of Windows formatting
+vm_name=$(grep -o 'short_description param=.*"' ${xmlfile} \
+ | sed -e "s/&.*;/; /g" | awk -F '"' '{print $2}')
+# if ${vm_name} not defined use ${xmlfile}
+vm_name=${vm_name:-${xmlfile%.xml}}
+
+# define vm_shortname since vm_name can be very long
+vm_shortname=$(basename ${xmlfile%.xml} | sed -e "s, ,-,g")
+
+# vm_name = displayname, define for old scripts
+displayname=${vm_name}
+
+[ "${imgmode}" != "rwimg" ] && [ ${diskless} -eq 0 ] \
+ && writelog "\tVM Image dir:\t\t${imgpath}"
+writelog "\tVM file/dir:\t\t$vmpath"
+
+# is there an additional configuration provided?
+additional_config=$(grep -o 'additional_config param=.*"' ${xmlfile} \
+ | sed -e "s/&.*;/; /g" | awk -F '"' '{print $2}')
+
+# image is for the following virtual machine
+xmlvirt=$(grep -o 'virtualmachine param=.*"' ${xmlfile} \
+ | sed -e "s/&.*;/; /g" | awk -F '"' '{print $2}')
+
+# make a guess from the filename extension if ${xmlvirt} is empty
+# (not set within the XML file)
+if [ -z "${xmlvirt}" ] && [ -n "${additional_config}" ]; then
+ writelog "No virtual machine parameter defined in ${xmlfile}"
+ writelog "Trying to guess VM...\c"
+ case "$(cat ${additional_config} | tr [A-Z] [a-z])" in
+ *config.version*|*virtualhw.version*|*independent-nonpersistent*|*vmdk*)
+ xmlvirt="vmware"
+ ;;
+ *innotek*|*virtualbox*)
+ xmlvirt="virtualbox"
+ ;;
+ *qemu*|*kvm*)
+ xmlvirt="qemukvm"
+ ;;
+ *)
+ xmlvirt="none"
+ ;;
+ esac
+elif [ -z "${xmlvirt}" ]; then
+ case "$(echo ${imgname##*.} | tr [A-Z] [a-z])" in
+ vmdk)
+ xmlvirt="vmware"
+ ;;
+ vbox)
+ xmlvirt="virtualbox"
+ ;;
+ img|qcow*)
+ xmlvirt="qemukvm"
+ ;;
+ *)
+ xmlvirt="none"
+ ;;
+ esac
+ writelog "result:\t${xmlvirt}"
+fi
+
+# check for virt
+if [ "${vmgrid_virt}" != "${xmlvirt}" ]; then
+ writelog "The virtual machine specified in ${xmlfile}"
+ writelog "does not match the virtualization used here (${vmgrid_virt})"
+ exit 1
+fi
+
+# definition of the client system
+vmostype=$(grep -io '<os param=.*"' ${xmlfile} | awk -F '"' '{ print $2 }' \
+ | tr [A-Z] [a-z])
+
+# definition of the networking the client system is connected to
+network_kind=$(grep -io 'network param=.*"' ${xmlfile} \
+ | awk -F '"' '{ print $2 }' | tr [A-Z] [a-z])
+network_card=$(grep -io 'netcard param=.*"' ${xmlfile} \
+ | awk -F '"' '{ print $2 }'| tr [A-Z] [a-z])
+
+writelog "\tVirtualization:\t\t$xmlvirt"
+writelog "\tVM name:\t\t$vm_name"
+writelog "\tVM short name:\t\t$vm_shortname"
+
+###############################################################################
+### Declaration of default variables
+###############################################################################
+
+# TODO: cpu cores
+#vmgrid::maxvcpus
+#vmgrid::minvcpus
+#cpu_cores="${cpu_cores}"
+
+# check for CPU virtualization flags
+#vmgrid::hvm
+
+# total amount of memory defined in stage 3
+permem=60
+# get a result which can be divided through 4
+mem=$(expr ${totalmem} / 100 \* ${permem} / 4 \* 4)
+#vmgrid::maxram
+#vmgrid::minram
+
+# configuring ethernet mac address: first 3 bytes are fixed (00:50:56)
+# 4th byte is the VM-ID
+# last two bytes are taken from the bridge of the host
+# define one MAC per guest
+macguestpart="00:50:56:${VM_ID}"
+machostpart=$(echo ${machostaddr} | awk -F ":" '{print $(NF-1)":"$NF}')
+macaddr=$(echo "${macguestpart}:${machostpart}" | tr [a-z] [A-Z])
+
+# ide is expected default, test for the virtual disk image type should
+# be done while creating the runscripts ...
+# TODO: cdrom / floppy?
+ide="TRUE"
+scsi="FALSE"
+hddrv="ide"
+
+# add rw share
+sharepath="${vmgrid_rwmnt}/folders/${vm_shortname}"
+mkdir -p ${sharepath}
+chmod -f 1777 "${vmgrid_rwmnt}/folders"
+sharename="share"
+
+# set hostname: using original hostname and adding string
+hostname="vmgrid${VM_ID}-$(hostname)"
+
+writelog "\tVM Hostname:\t\t$hostname"
+
+################################################################################
+### Setup the rest of the environment and run the configured vm
+################################################################################
+
+# Copy guest configuration (with added information) config.xml to be accessed
+# via virtual floppy
+# TODO: virt-floppy needed?
+
+# Get all virtual machine specific stuff from the respective include file
+# TODO: rename to run-vuirt.include
+if [ -e ${PLUGINCONFROOT}/${vmgrid_virt}/run-virt.include ] ; then
+ writelog "Starting ${vmgrid_virt} specific part ..."
+ self=${vmgrid_virt}
+ . ${PLUGINCONFROOT}/${vmgrid_virt}/run-virt.include
+else
+ writelog "Failed because of missing ${vmgrid_virt} plugin"
+ exit 1
+fi
+
+# start graphical mode
+if [ ${headless} -eq 0 ]; then
+ if [ -z "${VIRTCMD}" ]; then
+ writelog "Grapical mode not available, exiting!"
+ exit 1
+ fi
+ writelog "Starting ${vmgrid_virt} in graphical mode..."
+ ${VIRTCMD} ${VIRTCMDOPTS} 2>/dev/null
+# start headless
+elif [ -n "${VIRTCMDHL}" ]; then
+ writelog "Starting ${vmgrid_virt} in headless mode..."
+ ${VIRTCMDHL} ${VIRTCMDOPTSHL} 2>/dev/null
+else
+ writelog "${vmgrid_virt}: No headless mode defined, exiting!"
+ exit 1
+fi
+
+# postrun for scripts after virtualization finishes
+if [ -n "${POSTRUN}" ]; then
+ eval ${POSTRUN} >/dev/null 2>&1
+fi
+
+# remove config dirs when finished
+if echo "${RMDIRS}" 2>/dev/null | grep -q ${vmgrid_virt}; then
+ writelog "${vmgrid_virt} exited. Cleanning up... \c"
+ rm -rf ${RMDIRS} >/dev/null 2>&1
+ writelog "done"
+fi
+
+echo -e "Bye."
+exit 0
diff --git a/os-plugins/plugins/vmgrid/files/vmgrid b/os-plugins/plugins/vmgrid/files/vmgrid
new file mode 100644
index 00000000..d8ccd938
--- /dev/null
+++ b/os-plugins/plugins/vmgrid/files/vmgrid
@@ -0,0 +1,143 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Copyright (c) 2007..2010 - RZ Uni FR
+# Copyright (c) 2007..2010 - 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/
+# -----------------------------------------------------------------------------
+# vmgrid
+# - Script for autostarts defined in vmgrid::startvms
+################################################################################
+
+# include default directories
+. /etc/opt/openslx/openslx.conf
+
+################################################################################
+### Manual Start
+################################################################################
+
+if [ -n "$1" ]; then
+ if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
+ echo -e "Usage: vmgrid [[-g] [--mem <memorysize in MB>] \c"
+ echo -e "[/path/]filename[.xml]]"
+ exit 0
+ else
+ echo "Starting run-vmgrid.sh with options '$@'"
+ run-vmgrid.sh $@ 2>/dev/null
+ exit
+ fi
+fi
+
+################################################################################
+### Define default dirs / get configs
+################################################################################
+
+PLUGINCONFROOT=${OPENSLX_DEFAULT_CONFDIR}/plugins
+PLUGINCONFDIR=${PLUGINCONFROOT}/vmgrid
+RWSHARE=/var/opt/openslx/plugins/vmgrid/share
+# include general configuration from vmgrid
+[ -f ${PLUGINCONFDIR}/vmgrid.conf ] && \
+ . ${PLUGINCONFDIR}/vmgrid.conf
+# load general virtualization information
+[ -f ${PLUGINCONFROOT}/virtualization/virtualization.conf ] && \
+ . ${PLUGINCONFROOT}/virtualization/virtualization.conf
+
+################################################################################
+### Functions used throughout the script
+################################################################################
+
+# function to write to stdout and logfile
+writelog () {
+ # write to stdout
+ echo -e "$1"
+ # log into file
+ echo -e "$1" >> ${OPENSLX_DEFAULT_LOGDIR}/run-vmgrid.${USER}.$$.log
+ # log into share dir, so that log is available in vm as well
+ echo -e "$1" >> ${vmgrid_rwmnt}/logs/run-vmgrid.${USER}.$$.log
+}
+
+################################################################################
+### Configure VMs for autostart and set RAM
+################################################################################
+
+# start to log, create share log dir
+mkdir -m 1777 -p ${vmgrid_rwmnt}/logs
+mkdir -m 1777 -p /tmp/vmgrid
+mkdir -p /tmp/vmgrid/${USER}
+echo "Starting to log at $(date)" \
+ >${vmgrid_rwmnt}/logs/run-vmgrid.${USER}.$$.log
+
+if [ -z "${hostratio}" ]; then
+ writelog "There has been an error in the memory configuration in stage 3"
+ writelog "Please check your memory ratio settings, exiting!"
+ exit 1
+fi
+
+# remove blanks
+vmgrid_startvms=$(echo ${vmgrid_startvms} | sed -e "s, *,,g")
+vmgrid_memratio=$(echo ${vmgrid_memratio} | sed -e "s, *,,g")
+
+# hostmem, mainvirt from virtualization plugin
+# ratio minus other vms and host
+restratio=$(expr 100 - ${hostratio} - ${mainvirtratio})
+
+# hostmem, totalmem, mainvirtmem from virtualization plugin
+# calculate freemem
+freemem=$(expr ${totalmem} - ${hostmem} - ${mainvirtmem} 2>/dev/null)
+if [ ${freemem} -lt 512 2>/dev/null ]; then
+ writelog "Not enough free RAM for this plugin, free: ${freemem} MB"
+ exit 1
+fi
+
+# get clients mem ratio
+vmsumratios=0
+for i in {1..4}; do
+ vm[$i]=$(echo ${vmgrid_startvms} | awk -F ',' '{print $1}')
+ # remove ${vm[$i]} from list because of '{print $1}'
+ vmgrid_startvms=$(echo ${vmgrid_startvms} | sed -e "s,${vm[$i]}\,*,,")
+ vmratio[$i]=$(echo ${vmgrid_memratio} | awk -F ',' '{print $1}')
+ # remove ${vmratio[$i]} from list because of '{print $1}'
+ vmgrid_memratio=$(echo ${vmgrid_memratio} | sed -e "s/${vmratio[$i]},*//")
+ vmsumratios=$(expr ${vmsumratios} + ${vmratio[$i]} 2>/dev/null)
+done
+
+for i in {1..4}; do
+ # calculate VMs mem: mem = $freemem * $vmratio/100 * 100/$restratio
+ # multiple of 4
+ vmmem[$i]=$(expr ${freemem} \* ${vmratio[$i]} / ${restratio} / 4 \* 4 \
+ 2>/dev/null)
+ if [ -n "${vm[$i]}" ] && [ ${vmmem[$i]} -lt 512 2>/dev/null ]; then
+ writelog "Not enough free RAM for ${vm[$i]} (min. 512 MB), \c"
+ writelog "free: ${vmmem[$i]} MB"
+ unset vm[$i]
+ fi
+done
+
+################################################################################
+### Start the VMs
+################################################################################
+
+# start vms
+for i in {1..4}; do
+ if [ -n "${vm[$i]}" ]; then
+ alreadyrunning=$(ps aux | grep run-vmgrid.sh | grep -v grep | \
+ grep "${vm[$i]}" | wc -l)
+ if [ ${alreadyrunning} -gt 0 2>/dev/null ]; then
+ writelog "${vm[$i]} already running, skipping!"
+ else
+ writelog "Starting ${vm[$i]} via run-vmgrid.sh with ${vmmem[$i]} MB RAM"
+ run-vmgrid.sh --mem ${vmmem[$i]} ${vm[$i]} 2>/dev/null &
+ echo $! > /tmp/vmgrid/${USER}/vmgrid.pids
+ # wait 5 secs for the next vm to start
+ sleep 10
+ fi
+ fi
+done
+
+exit 0
diff --git a/os-plugins/plugins/vmgrid/init-hooks/80-after-plugins/virtualization.sh b/os-plugins/plugins/vmgrid/init-hooks/80-after-plugins/virtualization.sh
new file mode 100644
index 00000000..400075cd
--- /dev/null
+++ b/os-plugins/plugins/vmgrid/init-hooks/80-after-plugins/virtualization.sh
@@ -0,0 +1,135 @@
+# Copyright (c) 2008..2010 - RZ Uni Freiburg
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program/file 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 feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# script is included from init via the "." load function - thus it has all
+# variables and functions available
+
+# virtual virtualization plugin
+# make sure that this file is the same in vmgrid and vmchooser plugin!
+
+# include default directories
+. /etc/openslx.conf
+
+CONFFILEVMCHOOSER="/initramfs/plugin-conf/vmchooser.conf"
+CONFFILEVMGRID="/initramfs/plugin-conf/vmgrid.conf"
+PLUGINCONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/virtualization
+
+# check if plugins available
+active=0
+[ -f ${CONFFILEVMCHOOSER} ] && . ${CONFFILEVMCHOOSER}
+[ ${vmchooser_active} -ne 0 ] && active=1
+[ -f ${CONFFILEVMGRID} ] && . ${CONFFILEVMGRID}
+[ ${vmgrid_active} -ne 0 ] && active=1
+
+[ $DEBUGLEVEL -gt 0 ] \
+ && echo -e "Executing the virtual 'virtualization' plugin ... \c"
+
+if [ ${active} -ne 0 ] ; then
+
+ # load general configuration
+ . /etc/initramfs-setup
+ # include functions
+ . /etc/functions
+
+ testmkd ${PLUGINCONFDIR}
+
+ # check if vmgrid active and change free mem
+ totalmem=$(expr $(grep -i "memtotal" /proc/meminfo \
+ | awk '{print $2}') / 1024)
+ echo "totalmem=${totalmem}" >> ${PLUGINCONFDIR}/virtualization.conf
+
+ if [ ${vmgrid_active} -ne 0 ]; then
+
+ totalmemtest=$(expr $(echo ${vmgrid_memratio} \
+ | awk -F ',' '{print $1" + "$2" + "$3" + "$4" + "$5" + "$6}'))
+
+ # not more than 100% memory assigned
+ if [ ${totalmemtest} -le 100 2>/dev/null ]; then
+
+ # host mem
+ hostratio=$(echo ${vmgrid_memratio} | awk -F ',' '{print $6}')
+ hostmem=$(expr ${totalmem} \* ${hostratio} / 100 2>/dev/null)
+ if [ ${hostmem} -lt 256 2>/dev/null ]; then
+ # min. 256 MB for host
+ hostmem=256
+ fi
+
+ # main vm mem (vmchooser)
+ if [ ${vmchooser_active} -ne 0 ]; then
+ mainvirtratio=$(echo ${vmgrid_memratio} | awk -F ',' '{print $5}')
+ mainvirtmem=$(expr ${totalmem} \* ${mainvirtratio} / 100 2>/dev/null)
+ if [ ${mainvirtmem} -lt 512 2>/dev/null ]; then
+ # min. 512 for vmchooser
+ mainvirtmem=512
+ fi
+ else
+ mainvirtratio=0
+ mainvirtmem=0
+ fi
+
+ cat << EOF >> ${PLUGINCONFDIR}/virtualization.conf
+hostratio=${hostratio}
+hostmem=${hostmem}
+mainvirtratio=${mainvirtratio}
+mainvirtmem=${mainvirtmem}
+EOF
+
+ fi
+ fi
+
+ # cpu cores
+ CPU_CORES=$(grep 'processor.*:' /proc/cpuinfo | wc -l)
+ if [ "${CPU_CORES}" -gt "1" 2>/dev/null ]; then
+ echo "cpu_cores=${CPU_CORES}" \
+ >> ${PLUGINCONFDIR}/virtualization.conf
+ else
+ echo 'cpu_cores=1' >> ${PLUGINCONFDIR}/virtualization.conf
+ fi
+
+ # arch
+ echo "host_arch=$(uname -m)" >> ${PLUGINCONFDIR}/virtualization.conf
+
+ # VT enabled cpu?
+ if grep -q ^flags.*\\\<vmx\\\> /proc/cpuinfo; then
+ echo "vtflag=1" >> ${PLUGINCONFDIR}/virtualization.conf
+ echo 'kvm_module="kvm_intel"' >> ${PLUGINCONFDIR}/virtualization.conf
+ elif grep -q ^flags.*\\\<svm\\\> /proc/cpuinfo; then
+ echo "vtflag=1" >> ${PLUGINCONFDIR}/virtualization.conf
+ echo 'kvm_module="kvm_amd"' >> ${PLUGINCONFDIR}/virtualization.conf
+ else
+ echo "vtflag=0" >> ${PLUGINCONFDIR}/virtualization.conf
+ fi
+
+ # write mac
+ echo "machostaddr=${macaddr}" >> ${PLUGINCONFDIR}/virtualization.conf
+
+ # get further hw information
+ waitfor /etc/hwinfo.cdrom
+ j=0
+ for i in $(cat /etc/hwinfo.cdrom); do
+ echo "cdrom_$j=$i" >> ${PLUGINCONFDIR}/virtualization.conf
+ j=$(expr $j + 1)
+ done
+
+ waitfor /etc/hwinfo.floppy
+ j=0
+ for i in $(cat /etc/hwinfo.floppy); do
+ echo "floppy_$j=$i" >> ${PLUGINCONFDIR}/virtualization.conf
+ j=$(expr $j + 1)
+ done
+
+ # finished ...
+ [ $DEBUGLEVEL -gt 0 ] \
+ && echo "ok"
+else
+ [ $DEBUGLEVEL -gt 0 ] \
+ && echo "failed"
+fi
diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/Base.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/Base.pm
index 51361f31..d59227ad 100644
--- a/os-plugins/plugins/vmware/OpenSLX/Distro/Base.pm
+++ b/os-plugins/plugins/vmware/OpenSLX/Distro/Base.pm
@@ -44,190 +44,4 @@ sub initialize
return 1;
}
-sub fillRunlevelScript
-{
- my $self = shift;
- my $location = shift;
- my $kind = shift;
-
-# my $initfile = newInitFile();
-# $initfile->addFunction(
-# 'load_modules',
-# '
-# # 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
-# '
-# {param => "value"}
-# );
-#
-# $initfile->addFunctionCall(
-# 'functionName',
-# 'start', # name of block
-# {priority => 5, }
-# );
-#
-# $initfile->addDaemon("/bin/mydaemon");
-#
-# my $runlevelscript = getInitFileForDistro($initfile, "ubuntu");
-
- my $script = unshiftHereDoc(<<" End-of-Here");
- #!/bin/sh
- # completely generic start/stop script, generated via stage1 'vmware' plugin
- # install
- # inspiration 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
- ### BEGIN INIT INFO
- # Provides: VMware
- # Required-Start: \$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
- load_modules() {
- End-of-Here
-
- # Load modules
- if ($kind eq 'local' || $kind eq 'local25') {
- $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
- }
-
- # 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 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 'local25') {
- $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
- # 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-vmnet1.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
- #test -c /dev/vmnet8 || mknod c 119 8 /dev/vmnet8
- $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
- }
- case \$1 in
- start)
- echo "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
- setup_vmnet0
- setup_vmnet1
- setup_vmnet8
- ;;
- 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 vmnet-dhcpd 2>/dev/null
- # wait for shutting down of interfaces... vmnet needs kinda
- # long
- sleep 1
- unload_modules
- ;;
- #status)
- # echo "Say something useful here ..."
- #;;
- restart)
- "\$0" stop
- "\$0" start
- ;;
- esac
- exit 0
- End-of-Here
- return $script;
-}
-
1;
diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/Fedora.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/Fedora.pm
index 1c03540f..912bdfa0 100644
--- a/os-plugins/plugins/vmware/OpenSLX/Distro/Fedora.pm
+++ b/os-plugins/plugins/vmware/OpenSLX/Distro/Fedora.pm
@@ -1,4 +1,4 @@
-# Copyright (c) 2006, 2007 - OpenSLX GmbH
+# Copyright (c) 2007..2010 - OpenSLX GmbH
#
# This program is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
@@ -25,6 +25,5 @@ use OpenSLX::Basics;
### interface methods
################################################################################
-# TODO: implement!
1;
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;
diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/Suse.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/Suse.pm
index 7d22c70d..c1b2ecf4 100644
--- a/os-plugins/plugins/vmware/OpenSLX/Distro/Suse.pm
+++ b/os-plugins/plugins/vmware/OpenSLX/Distro/Suse.pm
@@ -1,4 +1,4 @@
-# Copyright (c) 2008 - OpenSLX GmbH
+# Copyright (c) 2008..2010 - OpenSLX GmbH
#
# This program is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
@@ -25,209 +25,4 @@ use OpenSLX::Utils;
### interface methods
################################################################################
-sub fillRunlevelScript
-{
- my $self = shift;
- my $location = shift;
- my $kind = shift;
-
- my $script = unshiftHereDoc(<<" End-of-Here");
- #!/bin/sh
- # SuSE compatible 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
-
- # Basic support for the Linux Standard Base Specification 1.3
- ### BEGIN INIT INFO
- # Provides: VMware
- # Required-Start: \$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
-
- # 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. A complete rewrite would be
- # needed (generation of proper runlevel scripts depending on distro
- # and VMware version, see tickets #211, 290)
- $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
- # 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
- # available from \$nwif
- 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-vmnet1.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
- # we don't need the following test. It's handled by
- # XX_vmware.sh
- #test -c /dev/vmnet8 || mknod c 119 8 /dev/vmnet8
- $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
- }
- # load the helper stuff
- . /etc/rc.status
- # reset the script status
- rc_reset
-
- case \$1 in
- start)
- echo -n "Starting vmware background services ..."
- # include default directories
- . /etc/opt/openslx/openslx.conf
- # load the configuration file
- . \${OPENSLX_DEFAULT_CONFDIR}/plugins/vmware/vmware.conf
- # hack to access the first serial/parallel port
- chmod a+rw /dev/ttyS0
- chmod a+rw /dev/parport0
- load_modules
- setup_vmnet0
- setup_vmnet1
- setup_vmnet8
- rc_status -v
- ;;
- stop)
- # message output should match the given vendor-os
- echo -n "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
- # workaround, because we can kill and unload more as we have
- # started
- rc_reset
- rc_status -v
- ;;
- # we don't need a status yet... at least as long as it is
- # unclear in which path the corresponding binary (see original
- # /etc/init.d/vmware) is in our case
- #status)
- # echo -n "Say something useful here ..."
- #;;
- restart)
- "\$0" stop
- "\$0" start
- ;;
- *)
- echo "Usage: `basename "\$0"` {start|stop|restart}"
- exit 1
- ;;
- esac
- exit 0
- End-of-Here
- return $script;
-}
-
1;
diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/Ubuntu.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/Ubuntu.pm
index d7ffc2e5..922fb34f 100644
--- a/os-plugins/plugins/vmware/OpenSLX/Distro/Ubuntu.pm
+++ b/os-plugins/plugins/vmware/OpenSLX/Distro/Ubuntu.pm
@@ -1,4 +1,4 @@
-# Copyright (c) 2006, 2007 - OpenSLX GmbH
+# Copyright (c) 2007..2010 - OpenSLX GmbH
#
# This program is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
diff --git a/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm b/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm
index 1a4540f0..4ebaa2b6 100644
--- a/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm
+++ b/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm
@@ -1,4 +1,4 @@
-# Copyright (c) 2008, 2009 - OpenSLX GmbH
+# Copyright (c) 2008..2010 - OpenSLX GmbH
#
# This program is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
@@ -23,6 +23,7 @@ use File::Path;
use OpenSLX::Basics;
use OpenSLX::Utils;
+use OpenSLX::DistroUtils;
sub new
{
@@ -131,12 +132,12 @@ sub getAttrInfo
applies_to_clients => 1,
description => unshiftHereDoc(<<' End-of-Here'),
Which set of VMware binaries to use: installed (local) or provided by the
- plugin itself (vmpl1.0, vmpl2.0, vmpl2.5)?
+ plugin itself (vmpl1.0, vmpl2.0, vmpl2.5, vmpl3.0)?
End-of-Here
# only allow the supported once...
# TODO: modify if we know which of them work
#content_regex => qr{^(local|vmws(5\.5|6.0)|vmpl(1\.0|2\.0))$},
- content_regex => qr{^(local|vmpl2\.0|vmpl1\.0|vmpl2\.5)$},
+ content_regex => qr{^(local|vmpl3\.0||vmpl2\.0|vmpl1\.0|vmpl2\.5)$},
content_descr => 'Allowed values: local, vmpl2.0',
#TODO: what if we don't have a local installation. default
# is still local. Someone has a clue how to test
@@ -255,7 +256,6 @@ sub preInstallationPhase()
}
}
-
sub installationPhase
{
my $self = shift;
@@ -300,6 +300,7 @@ sub installationPhase
if (-e "/usr/bin/vmware" && ! -e "/usr/bin/vmware.slx-bak") {
rename("/usr/bin/vmware", "/usr/bin/vmware.slx-bak");
}
+
}
sub removalPhase
@@ -325,9 +326,7 @@ sub checkStage3AttrValues
my $vendorOSAttrs = shift;
my @problems;
- my $vm_kind = $stage3Attrs->{'vmware::kind'} || '';
-
-
+ my $vm_kind = $stage3Attrs->{'vmware::kind'} || '';
my $vmimg = $stage3Attrs->{'vmware::imagesrc'} || '';
if ($vm_kind eq 'local' && ! -x "/usr/lib/vmware/bin/vmplayer") {
@@ -343,6 +342,13 @@ sub checkStage3AttrValues
);
}
+ if ($vm_kind eq 'vmpl1.0' &&
+ ! -d "/opt/openslx/plugin-repo/vmware/vmpl1.0/vmroot") {
+ push @problems, _tr(
+ "No OpenSLX installation of VMware Player 1 found or installation failed. Using it as virtual machine wouldn't work!"
+ );
+ }
+
if ($vm_kind eq 'vmpl2.0' &&
! -d "/opt/openslx/plugin-repo/vmware/vmpl2.0/vmroot") {
push @problems, _tr(
@@ -357,10 +363,10 @@ sub checkStage3AttrValues
);
}
- if ($vm_kind eq 'vmpl1.0' &&
- ! -d "/opt/openslx/plugin-repo/vmware/vmpl1.0/vmroot") {
+ if ($vm_kind eq 'vmpl3.0' &&
+ ! -d "/opt/openslx/plugin-repo/vmware/vmpl3.0/vmroot") {
push @problems, _tr(
- "No OpenSLX installation of VMware Player 1 found or installation failed. Using it as virtual machine wouldn't work!"
+ "No OpenSLX installation of VMware Player 3 found or installation failed. Using it as virtual machine wouldn't work!"
);
}
@@ -374,21 +380,143 @@ sub checkStage3AttrValues
## local, non-general OpenSLX functions
#######################################
-# write the runlevelscript depending on the version
+# Write the runlevelscript
+# usage: _writeRunlevelScript("$vmpath", "$kind")
sub _writeRunlevelScript
{
my $self = shift;
- my $location = shift;
- my $file = shift;
+ my $vmpath = shift;
my $kind = shift;
-
- # $location points to the path where vmware helpers are installed
- # call the distrospecific fillup
- # should use the abstract write runlevel script way, see
- # http://lab.openslx.org/repositories/revision/openslx/2405 ff.
- my $runlevelScript = $self->{distro}->fillRunlevelScript($location, $kind);
+ my $initfile = newInitFile();
+
+ my $script = "";
+ my $modpath = "";
+ my $modlist = "";
+ # vmpath is to be redefined here ...
+ if ($kind =~ /local*/) {
+ $vmpath = "";
+ $modpath = "/lib/modules/\$(uname -r)/misc";
+ } elsif ($kind =~ /vmpl*/) {
+ $vmpath = "/opt/openslx/plugin-repo/vmware/${kind}";
+ $modpath = "${vmpath}/vmroot/modules";
+ }
- spitFile($file, $runlevelScript);
+ $initfile->setName("vmware-slx");
+ $initfile->setDesc("Setup environment for VMware Workstation or Player ($kind).");
+
+ # functions ...
+ $modlist = "vmnet vmmon";
+ $script = unshiftHereDoc(<<" End-of-Here");
+ # VMplayer common stuff
+ insmod ${modpath}/vmmon.ko || return 1
+ insmod ${modpath}/vmnet.ko || return 1
+ End-of-Here
+ if ($kind eq 'local30' || $kind eq 'vmpl3.0') {
+ $script .= unshiftHereDoc(<<" End-of-Here");
+ # VMplayer 3.0 specific stuff
+ insmod ${modpath}/vmci.ko
+ insmod ${modpath}/vmblock.ko
+ insmod ${modpath}/vsock.ko
+ End-of-Here
+ $modlist .= "vsock vmci vmblock";
+ } elsif ($kind eq 'local20' || $kind eq 'local25' || $kind eq 'vmpl2.0' || $kind eq 'vmpl2.5') {
+ $script .= unshiftHereDoc(<<" End-of-Here");
+ # VMplayer 2.X specific stuff
+ insmod ${modpath}/vmblock.ko
+ End-of-Here
+ $modlist .= "vmblock";
+ }
+ $initfile->addFunction(
+ "load_modules",
+ "$script"
+ );
+ $initfile->addFunction(
+ "unload_modules",
+ "rmmod $modlist 2>/dev/null"
+ );
+ # vmnet0,1,8 (bridge, nat, host-only) interface definition
+ $script = unshiftHereDoc(<<" End-of-Here");
+ # let point the path directly to the directory where the binary lives
+ location="$vmpath/usr/bin"
+ if [ -n "\$vmnet0" ] ; then
+ # the path might be directly point to the plugin dir
+ End-of-Here
+ if ($kind eq 'vmpl1.0' || $kind eq 'vmpl2.0' || $kind eq 'local10' || $kind eq 'local20') {
+ $script .= " \$location/vmnet-bridge -d /var/run/vmnet-bridge-0.pid /dev/vmnet0 eth0\n";
+ } else {
+ $script .= " \$location/vmnet-bridge -d /var/run/vmnet-bridge-0.pid -n 0\n";
+ }
+ $script .= unshiftHereDoc(<<" End-of-Here");
+ fi
+ if [ -n "\$vmnet1" ] ; then
+ \$location/vmnet-netifup -d /var/run/vmnet-netifup-vmnet1.pid \\
+ /dev/vmnet1 vmnet1
+ ip addr add \$vmnet1 dev vmnet1
+ ip link set vmnet1 up
+ if [ -n "\$vmnet1nat" ] ; then
+ echo "1" >/proc/sys/net/ipv4/conf/vmnet1/forwarding 2>/dev/null
+ echo "1" >/proc/sys/net/ipv4/conf/br0/forwarding 2>/dev/null
+ #iptables -A -s vmnet1 -d br0
+ fi
+ /opt/openslx/uclib-rootfs/usr/sbin/udhcpd \\
+ -S /etc/vmware/udhcpd/udhcpd-vmnet1.conf
+ fi
+ 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
+ echo "1" >/proc/sys/net/ipv4/conf/vmnet8/forwarding 2>/dev/null
+ echo "1" >/proc/sys/net/ipv4/conf/br0/forwarding 2>/dev/null
+ iptables -t nat -A POSTROUTING -o br0 -j MASQUERADE
+ /opt/openslx/uclib-rootfs/usr/sbin/udhcpd \\
+ -S /etc/vmware/udhcpd/udhcpd-vmnet8.conf
+ fi
+ End-of-Here
+ $initfile->addFunction(
+ "vmnetif",
+ "$script"
+ );
+ $script = unshiftHereDoc(<<" End-of-Here");
+ # include default directories
+ . /etc/opt/openslx/openslx.conf
+ # load the configuration file
+ . \${OPENSLX_DEFAULT_CONFDIR}/plugins/vmware/vmware.conf
+ # hack to access the first serial/parallel port
+ chmod a+rw /dev/ttyS0
+ chmod a+rw /dev/parport0
+ load_modules
+ vmnetif
+ End-of-Here
+ $initfile->addToCase(
+ "start",
+ "$script"
+ );
+ $script = unshiftHereDoc(<<" End-of-Here");
+ killall vmnet-netifup vmnet-natd vmnet-bridge vmware vmplayer \\
+ vmware-tray vmnet-dhcpd 2>/dev/null
+ # might take a while until all services are shut down
+ sleep 1
+ unload_modules
+ End-of-Here
+ $initfile->addToCase(
+ "stop",
+ "$script"
+ );
+ $initfile->addToCase(
+ "status",
+ "vmstatus"
+ );
+ $initfile->addToCase(
+ "restart",
+ "\$0 stop && \$0 start"
+ );
+
+ 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'}/vmware-slx", $runlevelscript);
}
@@ -523,12 +651,6 @@ sub _localInstallation
my $vmversion = "";
my $vmbuildversion = "";
- my $pluginFilesPath
- = "$self->{'openslxBasePath'}/lib/plugins/$self->{'name'}/files";
- my $installationPath = "$self->{'pluginRepositoryPath'}/$kind";
-
- mkpath($installationPath);
-
# if vmware ws is installed, vmplayer is installed, too.
# we will only use vmplayer
if (-e "/usr/lib/vmware/bin/vmplayer") {
@@ -538,37 +660,43 @@ sub _localInstallation
$vmversion = $versionhash{vmversion};
$vmbuildversion = $versionhash{vmbuildversion};
- ## Copy needed files
- my @files = qw(nvram);
- foreach my $file (@files) {
- copyFile("$pluginFilesPath/$file", "$installationPath");
+ # set version information
+ # VMplayer 2.0
+ if ($vmversion eq "2.0" || $vmversion eq "6.0") {
+ $kind="local20";
+ # VMplayer 2.5
+ } elsif ($vmversion eq "2.5" || $vmversion eq "6.5") {
+ $kind="local25";
+ # VMplayer 3.0, Workstation 7.0
+ } elsif ($vmversion eq "3.0" || $vmversion eq "7.0") {
+ $kind="local30";
}
+ # Create runlevel script depending on detected version
+ $self->_writeRunlevelScript("$vmpath", "$kind");
- # Create runlevel script -> to be fixed!!
- my $runlevelScript = "$self->{'pluginRepositoryPath'}/$kind/vmware.init";
- if ($vmversion eq "2.5") {
- $self->_writeRunlevelScript($vmbin, $runlevelScript, "local25");
- } elsif ($vmversion eq "3.0") {
- $self->_writeRunlevelScript($vmbin, $runlevelScript, "local30");
- } else {
- $self->_writeRunlevelScript($vmbin, $runlevelScript, $kind);
+ # Create wrapper scripts, kind of localNN is set to local
+ if ( $kind =~ /local*/ ) { $kind = "local"; }
+ if (-e "/usr/lib/vmware/bin/vmware") {
+ $self->_writeWrapperScript("$vmpath", "$kind", "ws");
+ }
+ if (-e "/usr/lib/vmware/bin/vmplayer") {
+ $self->_writeWrapperScript("$vmpath", "$kind", "player");
}
- # Create wrapper scripts
- if (-e "/usr/bin/vmware") {
- $self->_writeWrapperScript("$vmpath", "$kind", "ws")
- } else {
- $self->_writeWrapperScript("$vmpath", "$kind", "player")
+ # copy nvram file
+ my $pluginFilesPath
+ = "$self->{'openslxBasePath'}/lib/plugins/$self->{'name'}/files";
+ my @files = qw(nvram);
+ foreach my $file (@files) {
+ copyFile("$pluginFilesPath/$file", "$self->{'pluginRepositoryPath'}/$kind");
}
- }
- # else { TODO: errorhandling }
-
- ## Creating needed config /etc/vmware/config
+ } # else { TODO: errorhandling if file or string doesn't exist }
+
+ ## creating needed config /etc/vmware/config
$self->_writeVmwareConfigs("$kind", "$vmpath");
}
-
sub _vmpl2Installation {
my $self = shift;
@@ -595,8 +723,7 @@ sub _vmpl2Installation {
system("/bin/sh /opt/openslx/plugin-repo/$self->{'name'}/$kind/install-vmpl.sh $kind");
# Create runlevel script
- my $runlevelScript = "$self->{'pluginRepositoryPath'}/$kind/vmware.init";
- $self->_writeRunlevelScript($vmbin, $runlevelScript, $kind);
+ $self->_writeRunlevelScript($vmpath, $kind);
# Create wrapperscripts
$self->_writeWrapperScript("$vmpath", "$kind", "player");
@@ -631,8 +758,7 @@ sub _vmpl25Installation {
system("/bin/sh /opt/openslx/plugin-repo/$self->{'name'}/$kind/install-vmpl.sh $kind");
# Create runlevel script
- my $runlevelScript = "$self->{'pluginRepositoryPath'}/$kind/vmware.init";
- $self->_writeRunlevelScript($vmbin, $runlevelScript, $kind);
+ $self->_writeRunlevelScript($vmpath, $kind);
# Create wrapperscripts
$self->_writeWrapperScript("$vmpath", "$kind", "player");
@@ -667,8 +793,7 @@ sub _vmpl1Installation {
system("/bin/sh /opt/openslx/plugin-repo/$self->{'name'}/$kind/install-vmpl.sh $kind");
# Create runlevel script
- my $runlevelScript = "$self->{'pluginRepositoryPath'}/$kind/vmware.init";
- $self->_writeRunlevelScript($vmbin, $runlevelScript, $kind);
+ $self->_writeRunlevelScript($vmpath, $kind);
# create wrapper scripts
$self->_writeWrapperScript("$vmpath", "$kind", "player");
diff --git a/os-plugins/plugins/vmware/XX_vmware.sh b/os-plugins/plugins/vmware/XX_vmware.sh
index b31df648..116561f6 100644
--- a/os-plugins/plugins/vmware/XX_vmware.sh
+++ b/os-plugins/plugins/vmware/XX_vmware.sh
@@ -12,6 +12,10 @@
# script is included from init via the "." load function - thus it has all
# variables and functions available
+# TODO:
+# configs nach /etc/opt/openslx/plugins/vmware
+# cp nach run-virt.include
+
# TODO: nvram,functions
# write /etc/vmware/config (if a non-standard location of vmware basedir is
# to be configured), /etc/init.d/vmware
@@ -43,6 +47,7 @@ if [ -e /initramfs/plugin-conf/vmware.conf ]; then
testmkd /dev/shm/vmware 1777
testmkd /mnt/var/run/vmware 1777
testmkd ${PLUGINCONFDIR}
+ testmkd /mnt/etc/vmware/udhcpd
# write the ${PLUGINCONFDIR}/vmware.conf file
# check for the several variables and write the several files:
@@ -55,27 +60,9 @@ stage3 setup" > ${PLUGINCONFDIR}/vmware.conf
if [ "$vmware_bridge" = 1 ] ; then
echo "vmnet0=true" >> ${PLUGINCONFDIR}/vmware.conf
fi
- # 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
- local dnslist=$(echo "$domain_name_servers"|sed "s/ /,/g")
- echo "# Common dhcpd.conf header written in stage3 ..." \
- > /mnt/etc/vmware/dhcpd-head.conf
- echo "allow unknown-clients;" \
- >> /mnt/etc/vmware/dhcpd-head.conf
- echo "default-lease-time 1800;" \
- >> /mnt/etc/vmware/dhcpd-head.conf
- echo "max-lease-time 7200;" \
- >> /mnt/etc/vmware/dhcpd-head.conf
- echo "option domain-name-servers $dnslist;" \
- >> /mnt/etc/vmware/dhcpd-head.conf
- echo "option domain-name \"vm.local\";" \
- >> /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'">
@@ -83,26 +70,15 @@ stage3 setup" > ${PLUGINCONFDIR}/vmware.conf
local vmsub=$(echo $vmip |sed 's,\(.*\)\..*,\1,') # x.x.x.x => x.x.x
echo -e "vmnet1=$vmnet1" >> ${PLUGINCONFDIR}/vmware.conf
[ -n "$vmnat" ] && echo "vmnet1nat=true" >> ${PLUGINCONFDIR}/vmware.conf
- echo -e "\n# definition for virtual vmnet1 interface" \
- >> /mnt/etc/vmware/dhcpd-vmnet1.conf
- echo -e "subnet $(ipcalc -n $vmnet1|sed s/.*=//) netmask \
-$(ipcalc -m $vmnet1|sed s/.*=//) {" \
- >> /mnt/etc/vmware/dhcpd-vmnet1.conf
- echo -e "\trange ${vmsub}.10 ${vmsub}.20;" \
- >> /mnt/etc/vmware/dhcpd-vmnet1.conf
- echo -e "\toption broadcast-address $(ipcalc -b $vmnet1|sed s/.*=//);" \
- >> /mnt/etc/vmware/dhcpd-vmnet1.conf
- # Maybe a different ip is needed s. nat: vmnet="${vmsub}.2"
- echo -e "\toption routers $vmip;" \
- >> /mnt/etc/vmware/dhcpd-vmnet1.conf
- echo -e "}" \
- >> /mnt/etc/vmware/dhcpd-vmnet1.conf
- mknod /dev/vmnet1 c 119 1
+ # setting up the udhcpd configuration
+ sed -e "s,NWIF,vmnet1,;s,/misc/,/vmware/," \
+ -e "s,CNETWORK,$vmsub,;s,PIDFILE,/var/run/vmware/udhcpd-vmnet1.pid," \
+ -e "s,LEASEFILE,/var/run/vmware/udhcpd-vmnet1.leases," \
+ /mnt/etc/opt/openslx/udhcpd.conf >/mnt/etc/vmware/udhcpd/udhcpd-vmnet1.conf
fi
# vmware nat interface configuration
if [ -n "$vmware_vmnet8" ] ; then
- cp /mnt/etc/vmware/dhcpd-head.conf /mnt/etc/vmware/dhcpd-vmnet8.conf
local vmnet8ip=${vmware_vmnet8%/*}
local vmpx=${vmware_vmnet8#*/}
local vmsub=$(echo $vmnet8ip |sed 's,\(.*\)\..*,\1,') # x.x.x.x => x.x.x">
@@ -111,19 +87,12 @@ $(ipcalc -m $vmnet1|sed s/.*=//) {" \
local vmip="${vmsub}.1"
local vmnet="${vmsub}.2"
echo -e "vmnet8=$vmip/$vmpx" >>${PLUGINCONFDIR}/vmware.conf
- echo -e "\n# definition for virtual vmnet8 interface" \
- >> /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-vmnet8.conf
- echo -e "\trange ${vmsub}.10 ${vmsub}.20;" \
- >> /mnt/etc/vmware/dhcpd-vmnet8.conf
- echo -e "\toption broadcast-address $(ipcalc -b $vmip/$vmpx|sed s/.*=//);" \
- >> /mnt/etc/vmware/dhcpd-vmnet8.conf
- echo -e "\toption routers $vmnet;" \
- >> /mnt/etc/vmware/dhcpd-vmnet8.conf
- echo -e "}" \
- >> /mnt/etc/vmware/dhcpd-vmnet8.conf
+ # setting up the udhcpd configuration
+ sed -e "s,NWIF,vmnet8,;s,/misc/,/vmware/," \
+ -e "s,CNETWORK,$vmsub,;s,PIDFILE,/var/run/vmware/udhcpd-vmnet8.pid," \
+ -e "s,LEASEFILE,/var/run/vmware/udhcpd-vmnet8.leases," \
+ /mnt/etc/opt/openslx/udhcpd.conf >/mnt/etc/vmware/udhcpd/udhcpd-vmnet8.conf
+ # might be not needed any more ...
echo -e "# Linux NAT configuration file" \
> /mnt/etc/vmware/nat.conf
echo -e "[host]" \
@@ -143,11 +112,9 @@ $(ipcalc -m $vmip/$vmpx|sed s/.*=//) {" \
echo -e "[incomingudp]" \
>> /mnt/etc/vmware/nat.conf
echo "00:50:56:F1:30:50" > /mnt/etc/vmware/vmnet-natd-8.mac
- mknod /dev/vmnet8 c 119 8
fi
# copy the runlevel script to the proper place and activate it
- sed "s/eth0/$nwif/g" ${PLUGINDIR}/${vmware_kind}/vmware.init \
- > /mnt/etc/init.d/vmware-env \
+ sed "s/eth0/$nwif/g" ${PLUGINDIR}/vmware-slx > /mnt/etc/init.d/vmware-env \
|| echo " * Error copying runlevel script. Shouldn't happen."
chmod a+x /mnt/etc/init.d/vmware-env
rllinker "vmware-env" 20 2
@@ -174,16 +141,16 @@ ${vmware_imagesrc}." nonfatal
############################################################################
# vmware stuff second part: setting up the environment
- # make vmware dhcpd more silent
- touch /mnt/var/run/vmware/dhcpd-vmnet1.leases \
- /mnt/var/run/vmware/dhcpd-vmnet8.leases
+ # make udhcpd more silent
+ touch /mnt/var/run/vmware/udhcpd-vmnet1.leases \
+ /mnt/var/run/vmware/udhcpd-vmnet8.leases
# create the needed devices which effects all vmware options
# they are not created automatically via module load
- for i in "/dev/vmnet0 c 119 0" "/dev/vmmon c 10 165"; do
+ for i in "/dev/vmnet0 c 119 0" "/dev/vmnet1 c 119 1" \
+ "/dev/vmnet8 c 119 8" "/dev/vmmon c 10 165"; do
mknod $i
done
-
chmod 0700 /dev/vmnet*
echo -e "usbfs\t\t/proc/bus/usb\tusbfs\t\tauto\t\t 0 0" >> /mnt/etc/fstab
@@ -196,9 +163,8 @@ ${vmware_imagesrc}." nonfatal
prefvmx.useRecommendedLockedMemSize = "TRUE"' | sed -e "s/^ *//" \
>/mnt/etc/vmware/config
- # copy version depending files - the vmchooser expects for every virtua-
- # lization plugin a file named after it (here run-vmware.include)
- cp ${PLUGINDIR}/run-virt.include ${PLUGINCONFDIR}/run-vmware.include
+ # copy virtualization include files to config dir
+ cp ${PLUGINDIR}/run-virt.include ${PLUGINCONFDIR}
# copy version depending files
cp ${PLUGINDIR}/${vmware_kind}/vmplayer ${BINDIR}/vmplayer
if [ -e ${PLUGINDIR}/${vmware_kind}/vmware ]; then
diff --git a/os-plugins/plugins/vmware/files/run-virt.include b/os-plugins/plugins/vmware/files/run-virt.include
index 6641d491..8b91275a 100644
--- a/os-plugins/plugins/vmware/files/run-virt.include
+++ b/os-plugins/plugins/vmware/files/run-virt.include
@@ -1,7 +1,7 @@
# run-virt.include
# -----------------------------------------------------------------------------
-# Copyright (c) 2009 - RZ Uni Freiburg
-# Copyright (c) 2009 - OpenSLX GmbH
+# Copyright (c) 2009..2010 - RZ Uni Freiburg
+# Copyright (c) 2009..2010 - OpenSLX GmbH
#
# This program is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
@@ -13,7 +13,7 @@
# -----------------------------------------------------------------------------
# run-virt.include
# - component for vmware/player of the vmchooser plugin run-virt.sh
-# -----------------------------------------------------------------------------
+################################################################################
# configuration writer functions
################################################################################
@@ -42,7 +42,7 @@ sharedFolder.option = \"alwaysEnabled\"" >>${conffile}
esac
case "$vmversion" in
2.5|3.*|6.5|7.*)
- if [ "${cpu_cores}" -ge "2" 2>/dev/null]; then
+ if [ "${cpu_cores}" -ge "2" 2>/dev/null ]; then
numvcpus="2"
fi
cap3d="TRUE" # helper var for loging output
@@ -140,8 +140,8 @@ usb.generic.autoconnect = \"TRUE\"
sharedFolder0.present = \"TRUE\"
sharedFolder0.enabled = \"${shared_folder}\"
sharedFolder0.expiration = \"never\"
-sharedFolder0.guestName = \"Home\"
-sharedFolder0.hostPath = \"${HOME}\"
+sharedFolder0.guestName = \"${sharename}\"
+sharedFolder0.hostPath = \"${sharepath}\"
sharedFolder0.readAccess = \"TRUE\"
sharedFolder0.writeAccess = \"TRUE\"
sharedFolder.maxNum = \"1\"
@@ -300,30 +300,41 @@ case "$parallel" in
;;
esac
-# percentage of memory to use for vmwares in standard case
-permem=30
-if [ "${totalmem}" -ge "1600" ]; then
- permem=40
-fi
-# check if /tmp is on harddisk
-if grep -qe "/dev/.* /tmp " /proc/mounts ; then
- permem=60
- id44="1"
- # Hack, if more than 2,5G RAM use 40% of Ram and write vmem into Ram as well
- # (40% vmware | 40% confdir(vmem...) | 20% host
- # VMplayer 2+ issue
+# adjust memory available for vmware guests
+if [ -n "${forcemem}" ]; then
+ mem="${forcemem}"
+else
+ case "$vmversion" in
+ 2.*)
+ permem=30
+ ;;
+ 3.*)
+ permem=25
+ ;;
+ esac
if [ "${totalmem}" -ge "2500" ]; then
permem=40
- confdir=/dev/shm/vmware/$USER
- conffile=${confdir}/run-vmware.conf
- mkdir -p /dev/shm/vmware/$USER
fi
-fi
-mem=$(expr ${totalmem} / 100 \* ${permem} / 4 \* 4)
-if [ "${id44}" = "1" ]; then
- memhost=$(expr ${totalmem} - ${mem})
-else
- memhost=$(expr ${totalmem} - ${mem} - ${mem})
+ # check if /tmp is on harddisk
+ if grep -qe "/dev/.* /tmp " /proc/mounts ; then
+ permem=60
+ id44="1"
+ # Hack, if more than 2,5G RAM use 40% of Ram and write vmem into Ram as well
+ # (40% vmware | 40% confdir(vmem...) | 20% host
+ # VMplayer 2+ issue
+ if [ "${totalmem}" -ge "2500" ]; then
+ permem=40
+ confdir=/dev/shm/vmware/$USER
+ conffile=${confdir}/run-vmware.conf
+ mkdir -p /dev/shm/vmware/$USER
+ fi
+ fi
+ mem=$(expr ${totalmem} / 100 \* ${permem} / 4 \* 4)
+ if [ "${id44}" = "1" ]; then
+ hostmem=$(expr ${totalmem} - ${mem})
+ else
+ hostmem=$(expr ${totalmem} - ${mem} - ${mem})
+ fi
fi
# check if ide/scsi and hwver of image
@@ -390,8 +401,8 @@ writelog "# File created by $0 (VMversion ${vmversion})\n# on $(date)\n"
writelog "Starting with non-persistent mode ...\n"
# check memory range
-if [ "${mem}" -lt "256" ] || [ "${memhost}" -lt "256" ]; then
- writelog "\tMemory out of range: ${mem} MB (guest) / ${memhost} MB (host)!"
+if [ "${mem}" -lt "256" ] || [ "${hostmem}" -lt "256" ]; then
+ writelog "\tMemory out of range: ${mem} MB (guest) / ${hostmem} MB (host)!"
writelog "\tMin. 256 MB for host and guest!"
exit 1
fi
@@ -413,7 +424,8 @@ if [ -n "${network_card}" ]; then
writelog "\tNet Adaptor:\t${network_card}"
fi
writelog "\tMem:\t\t${mem} MB"
-writelog "\tHostmem:\t${memhost} MB"
+# echo nur wenn hostmem gesetzt
+[ -n "${hostmem}" ] && writelog "\tHostmem:\t${hostmem} MB"
writelog "\tMax. res.:\t${xres}x${yres}"
writelog "\tCD-ROM1:\t${cdrom0}"
writelog "\tCD-ROM2:\t${cdrom1}"
@@ -443,6 +455,6 @@ writelog ""
# finally set env for run-virt.sh
################################################################################
-VIRTCMD=vmplayer
+# using the modified version of the wrapper script
+VIRTCMD="${OPENSLX_DEFAULT_BINDIR}/vmplayer"
VIRTCMDOPTS="${vmopt} ${conffile}"
-
diff --git a/os-plugins/plugins/vmware/init-hooks/20-nw-bridge-config/bridge.sh b/os-plugins/plugins/vmware/init-hooks/20-nw-bridge-config/bridge.sh
index 6aabe8ad..07113867 100755
--- a/os-plugins/plugins/vmware/init-hooks/20-nw-bridge-config/bridge.sh
+++ b/os-plugins/plugins/vmware/init-hooks/20-nw-bridge-config/bridge.sh
@@ -1,5 +1,5 @@
#!/bin/ash
-# Copyright (c) 2009 - OpenSLX GmbH
+# Copyright (c) 2009..2010 - OpenSLX GmbH
#
# This program is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
diff --git a/os-plugins/plugins/vmware/init-hooks/60-have-servconfig/vm-dhcpd.sh b/os-plugins/plugins/vmware/init-hooks/60-have-servconfig/vm-dhcpd.sh
new file mode 100755
index 00000000..6bdfb8f1
--- /dev/null
+++ b/os-plugins/plugins/vmware/init-hooks/60-have-servconfig/vm-dhcpd.sh
@@ -0,0 +1,56 @@
+#!/bin/ash
+# Copyright (c) 2010 - 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 feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# Init hook to create a bridge on the active network interface
+# (should be kept identical to the files of virtualbox and qemukvm plugins)
+#############################################################################
+
+# configuring dhcpd stub for virtual networks
+testmkd /mnt/etc/opt/openslx
+echo "
+# general udhcpd configuration file for virtual machines written by
+# $0 during OpenSLX stage3 configuration
+
+# start and end of the IP lease block
+start CNETWORK.20
+end CNETWORK.100
+
+# interface that udhcpd will use
+interface NWIF
+
+# how long an offered address is reserved (leased) in seconds
+offer_time 6000
+
+# location of the leases file
+lease_file LEASEFILE
+
+# location of the pid file
+pidfile PIDFILE
+
+opt dns ${domain_name_servers}
+option subnet 255.255.255.0
+opt router CNETWORK.254
+opt wins CNETWORK.10
+option domain virtual.site ${domain_name}
+
+# additional options known to udhcpd
+#subnet #timezone
+#router #timesvr
+#namesvr #dns
+#logsvr #cookiesvr
+#lprsvr #bootsize
+#domain #swapsvr
+#rootpath #ipttl
+#mtu #broadcast
+#wins #lease
+#ntpsrv #tftp
+#bootfile
+" >/mnt/etc/opt/openslx/udhcpd.conf
diff --git a/os-plugins/plugins/xen/OpenSLX/OSPlugin/xen.pm b/os-plugins/plugins/xen/OpenSLX/OSPlugin/xen.pm
index 5e500b49..8af752b4 100644
--- a/os-plugins/plugins/xen/OpenSLX/OSPlugin/xen.pm
+++ b/os-plugins/plugins/xen/OpenSLX/OSPlugin/xen.pm
@@ -59,24 +59,126 @@ sub getAttrInfo
End-of-Here
content_regex => qr{^(0|1)$},
content_descr => '1 means active - 0 means inactive',
- default => '1',
+ # set active to 0, later set specially created Xen system to 1
+ default => '0',
+ },
+ # attribute 'imagesrc' defines where we can find xen images
+ 'xen::imagesrc' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Where do we store our xen images? NFS? Filesystem?
+ End-of-Here
+ content_regex => qr{^(/|nfs://)},
+ content_descr => 'local path or URI or "-" (unset)',
+ default => undef,
+ },
+ # attribute 'tftpdir' defines TFTP dir for network boots /w NAT
+ 'xen::tftpdir' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Do you want to define a stage 4 TFTP dir for netwoork boots?
+ Needed to boot Xen via NFS, we only need the initramfs
+ Hint: Mount your TFTP ro via NFS to a local dir
+ End-of-Here
+ content_regex => qr{^(/)},
+ content_descr => 'local path or "-" (unset)',
+ default => undef,
},
};
}
+sub installationPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ $self->{pluginRepositoryPath} = $info->{'plugin-repo-path'};
+ $self->{openslxBasePath} = $info->{'openslx-base-path'};
+
+ # 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 machine.include hvm.include ) ) {
+ copyFile("$pluginBasePath/$file", "$self->{pluginRepositoryPath}/");
+ chmod 0644, "$self->{pluginRepositoryPath}/$file";
+ }
+
+ return;
+}
+
+sub removalPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ return;
+}
+
sub suggestAdditionalKernelModules
{
my $self = shift;
my $makeInitRamFSEngine = shift;
my @suggestedModules;
-
- # Xen needs bridge module and for SUSE 10.2 netloop other OS: to be checked
- if ($makeInitRamFSEngine->{'distro-name'} =~ m{^suse}i) {
- push @suggestedModules, qw( bridge netloop )
- }
-
+
+ # Xen needs bridge module, for guests xennet and maybe xenblk
+ # earlier versions needed netloop
+ push @suggestedModules, qw( bridge xennet xenblk );
+
return @suggestedModules;
}
+#sub _xenLabel
+#{
+# # set label for each Xen system
+# foreach my $info (@$systemInfos) {
+# if ($info->{xen::active} eq 1) {
+# my $label = $info->{label} || '';
+# if (!length($label) || $label eq $info->{name}) {
+# if ($info->{name} =~ m{^(.+)::(.+)$}) {
+# my $system = $1;
+# my $exportType = $2;
+# $label = $system . "-xen" . ' ' x (36-length($system))
+# . $exportType;
+# } else {
+# $label = $info->{name};
+# }
+# }
+# }
+# $info->{pxeLabel} = $label;
+# }
+# return $info; #???
+#}
+
+#sub _xenBootEntry
+#{
+# # Xen entries look different
+# # Example:
+# # KERNEL mboot.c32 vendor-os/xen.gz dom0_mem=128000 ---
+# # vendor-os/vmlinuz-xen debug=3 --- vendor-os/initramfs-1
+# # TODO: versionsort oder per attr?
+# if ($info->{xen::active} eq 1) {
+# my $xenKernel = slxsystem(ls /boot/xen* | sort | tail -n 1);
+# $append .= " file=$bootURI" if length($bootURI);
+# $append .= " file=$tftpPrefix" if length($tftpPrefix);
+# $append .= " $clientAppend";
+# $append .= " --- $pxePrefix$vendorOSName/$info->{'initramfs-name'}";
+# $slxLabels .= "LABEL openslx-$info->{'external-id'}-xen\n";
+# # $slxLabels .= $pxeDefault;
+# $slxLabels .= "\tMENU LABEL ^$info->{pxeLabel}\n";
+# $slxLabels .= "\tKERNEL mboot.c32\n";
+# $slxLabels .= "\tAPPEND $pxePrefix$vendorOSName/$xenKernel";
+# # $slxLabels .= " dom0_mem=128000";
+# $slxLabels .= " --- $pxePrefix$vendorOSName/$kernelName";
+# $slxLabels .= " --- $append\n";
+# $slxLabels .= "\tIPAPPEND 3\n";
+# }
+# return $slxLabels;
+#}
+
1;
diff --git a/os-plugins/plugins/xen/XX_xen.sh b/os-plugins/plugins/xen/XX_xen.sh
index ba2c4f00..af3f6cc4 100644
--- a/os-plugins/plugins/xen/XX_xen.sh
+++ b/os-plugins/plugins/xen/XX_xen.sh
@@ -14,16 +14,60 @@
# script is included from init via the "." load function - thus it has all
# variables and functions available
-if [ -e /initramfs/plugin-conf/xen.conf ]; then
- . /initramfs/plugin-conf/xen.conf
- if [ $xen_active -ne 0 ]; then
+# include default directories
+. /etc/openslx.conf
+
+CONFFILE=/initramfs/plugin-conf/xen.conf
+PLUGINCONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/xen
+PLUGINDIR=/mnt/${OPENSLX_DEFAULT_DIR}/plugin-repo/xen
+VIRTDIR=/mnt/${OPENSLX_DEFAULT_VIRTDIR}/xen
+
+# check if the configuration file is available
+if [ -e ${CONFFILE} ]; then
+
+ # load needed variables
+ . ${CONFFILE}
+
+ # Test if this plugin is activated... more or less useless with the
+ # new plugin system
+ if [ $xen_active -ne 0 2>/dev/null ]; then
+
+ [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'xen' os-plugin ...";
+
+ # load general configuration
+ . /etc/initramfs-setup
+
+ # get source of xen image server (get type, server and path)
+ if strinstr "/" "${xen_imagesrc}" ; then
+ vbimgprot=$(uri_token ${xen_imagesrc} prot)
+ vbimgserv=$(uri_token ${xen_imagesrc} server)
+ vbimgpath="$(uri_token ${xen_imagesrc} path)"
+ fi
+ if [ -n "${vbimgserv}" ] ; then
+ # directory where qemu images are expected in
+ mnttarget=${VIRTDIR}
+ # mount the xen image source readonly (ro)
+ fsmount ${vbimgprot} ${vbimgserv} ${vbimgpath} ${mnttarget} ro
+ else
+ [ $DEBUGLEVEL -gt 1 ] && \
+ error " * Incomplete information in variable ${xen_imagesrc}." \
+ nonfatal
+ fi
+
+ # copy virtualization include files to config dir
+ testmkd ${PLUGINCONFDIR}
testmkd /mnt/var/log/xen
testmkd /mnt/var/run/xend
testmkd /mnt/var/run/xenstored
+ cp ${PLUGINDIR}/*.include ${PLUGINCONFDIR}
+ # copy ${CONFFILE} to ${PLUGINCONFDIR} just in case
+ cp ${CONFFILE} ${PLUGINCONFDIR}
+ # activate init files
+ # TODO: in xen-slx start
+ # increase loop devices for loop images
+ modprobe -q loop max_loop=64 >/tmp/xen.log 2>&1
rllinker "xendomains" 14 8
rllinker "xend" 13 9
-
- modprobe loop max_loop=64
fi
fi
diff --git a/os-plugins/plugins/xen/files/hvm.include b/os-plugins/plugins/xen/files/hvm.include
new file mode 100644
index 00000000..beb9315a
--- /dev/null
+++ b/os-plugins/plugins/xen/files/hvm.include
@@ -0,0 +1,209 @@
+# This is an machine template for run-virt.include of the Xen plugin.
+# This template was taken from an example in openSUSE 11.2
+# HVM template
+
+cat <<EOF
+# -*- mode: python; -*-
+#============================================================================
+# Python configuration setup for 'xm create'.
+# This configuration was created through $0 on $(date)
+#============================================================================
+
+import os, re
+
+arch_libdir = 'lib'
+arch = os.uname()[4]
+if os.uname()[0] == 'Linux' and re.search('64', arch):
+ arch_libdir = 'lib64'
+
+#----------------------------------------------------------------------------
+# Kernel image file.
+kernel = "/usr/lib/xen/boot/hvmloader"
+
+# The domain build function. HVM domain uses 'hvm'.
+builder='hvm'
+
+# Initial memory allocation (in megabytes) for the new domain.
+memory = ${mem}
+
+# Shadow pagetable memory for the domain, in MB.
+# If not explicictly set, xend will pick an appropriate value.
+# Should be at least 2KB per MB of domain memory, plus a few MB per vcpu.
+#shadow_memory = 8
+
+# A name for your domain. All domains must have different names.
+name = "${vm_name}"
+
+#-----------------------------------------------------------------------------
+# The number of cpus guest platform has, default=1
+#vcpus=1
+
+# Enable/disable HVM guest PAE, default=1 (enabled)
+#pae=1
+
+# Enable/disable HVM guest ACPI, default=1 (enabled)
+#acpi=1
+
+# Enable/disable HVM APIC mode, default=1 (enabled)
+# Note that this option is ignored if vcpus > 1
+#apic=1
+
+# Enable/disable extended power management support within HVM guest, i.e., beyond
+# S3, S4, S5 within guest like exposing battery meter.
+# 0 (default option, extended power management support disabled)
+# 1 (pass-through mode; uses pass-through as needed; efficient but limited in scope)
+# 2 (non pass-through mode; extended scope, likely to work on all applicable environment
+# but comparitively less efficient than pass-through mode)
+# xen_extended_power_mgmt=0
+
+# List of which CPUS this domain is allowed to use, default Xen picks
+#cpus = "" # leave to Xen to pick
+#cpus = "0" # all vcpus run on CPU0
+#cpus = "0-3,5,^1" # all vcpus run on cpus 0,2,3,5
+#cpus = ["2", "3"] # VCPU0 runs on CPU2, VCPU1 runs on CPU3
+
+#----------------------------------------------------------------------------
+# Optionally define mac and/or bridge for the network interfaces.
+# Random MACs are assigned if not given.
+#vif = [ 'type=ioemu, mac=00:16:3e:00:00:11, bridge=xenbr0, model=ne2k_pci' ]
+# type=ioemu specify the NIC is an ioemu device not netfront
+#vif = [ 'type=ioemu, bridge=xenbr0' ]
+vif = [ '${xen_vif}' ]
+
+#----------------------------------------------------------------------------
+# Define the disk devices you want the domain to have access to, and
+# what you want them accessible as.
+# Each disk entry is of the form phy:UNAME,DEV,MODE
+# where UNAME is the device, DEV is the device name the domain will see,
+# and MODE is r for read-only, w for read-write.
+#disk = [ 'phy:hda1,hda1,r' ]
+#disk = [ 'file:/var/lib/xen/images/disk.img,ioemu:hda,w', ',hdc:cdrom,r' ]
+disk = [ '${xen_disk}' ]
+
+#----------------------------------------------------------------------------
+# Configure the behaviour when a domain exits. There are three 'reasons'
+# for a domain to stop: poweroff, reboot, and crash. For each of these you
+# may specify:
+# "destroy", meaning that the domain is cleaned up as normal;
+# "restart", meaning that a new domain is started in place of the old
+# one;
+# "preserve", meaning that no clean-up is done until the domain is
+# manually destroyed (using xm destroy, for example); or
+# "rename-restart", meaning that the old domain is not cleaned up, but is
+# renamed and a new domain started in its place.
+# In the event a domain stops due to a crash, you have the additional options:
+# "coredump-destroy", meaning dump the crashed domain's core and then destroy;
+# "coredump-restart', meaning dump the crashed domain's core and the restart.
+# The default is
+# on_poweroff = 'destroy'
+# on_reboot = 'restart'
+# on_crash = 'restart'
+#on_poweroff = 'destroy'
+#on_reboot = 'restart'
+#on_crash = 'restart'
+
+#============================================================================
+# HVM specific
+#============================================================================
+# Device Model to be used
+device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm'
+
+#-----------------------------------------------------------------------------
+# boot on floppy (a), hard disk (c), Network (n) or CD-ROM (d)
+# default: hard disk, cd-rom, floppy
+#boot="cda"
+
+#-----------------------------------------------------------------------------
+# write to temporary files instead of disk image files
+#snapshot=1
+
+#----------------------------------------------------------------------------
+# enable SDL library for graphics, default = 0
+sdl=0
+
+#----------------------------------------------------------------------------
+# enable OpenGL for texture rendering inside the SDL window, default = 1
+# valid only if sdl is enabled.
+opengl=1
+
+#----------------------------------------------------------------------------
+# enable VNC library for graphics, default = 1
+vnc=1
+
+#----------------------------------------------------------------------------
+# address that should be listened on for the VNC server if vnc is set.
+# default is to use 'vnc-listen' setting from /etc/xen/xend-config.sxp
+#vnclisten="127.0.0.1"
+
+#----------------------------------------------------------------------------
+# set VNC display number, default = domid
+#vncdisplay=1
+
+#----------------------------------------------------------------------------
+# try to find an unused port for the VNC server, default = 1
+#vncunused=1
+
+#----------------------------------------------------------------------------
+# set password for domain's VNC console
+# default is depents on vncpasswd in xend-config.sxp
+vncpasswd=''
+
+#----------------------------------------------------------------------------
+# no graphics, use serial port
+#nographic=0
+
+#----------------------------------------------------------------------------
+# enable stdvga, default = 0 (use cirrus logic device model)
+stdvga=0
+
+#-----------------------------------------------------------------------------
+# serial port re-direct to pty deivce, /dev/pts/n
+# then xm console or minicom can connect
+serial='pty'
+
+
+#-----------------------------------------------------------------------------
+# Qemu Monitor, default is disable
+# Use ctrl-alt-2 to connect
+#monitor=1
+
+
+#-----------------------------------------------------------------------------
+# enable sound card support, [sb16|es1370|all|..,..], default none
+#soundhw='sb16'
+
+
+#-----------------------------------------------------------------------------
+# set the real time clock to local time [default=0 i.e. set to utc]
+#localtime=1
+
+
+#-----------------------------------------------------------------------------
+# set the real time clock offset in seconds [default=0 i.e. same as dom0]
+#rtc_timeoffset=3600
+
+#-----------------------------------------------------------------------------
+# start in full screen
+#full-screen=1
+
+
+#-----------------------------------------------------------------------------
+# Enable USB support (specific devices specified at runtime through the
+# monitor window)
+#usb=1
+# Enable USB mouse support (only enable one of the following, `mouse' for
+# PS/2 protocol relative mouse, `tablet' for
+# absolute mouse)
+#usbdevice='mouse'
+#usbdevice='tablet'
+
+#-----------------------------------------------------------------------------
+# Set keyboard layout, default is en-us keyboard.
+#keymap='de'
+
+#-----------------------------------------------------------------------------
+# Enable/disable xen platform PCI device, default=1 (enabled)
+#xen_platform_pci=1
+
+#============================================================================
+EOF
diff --git a/os-plugins/plugins/xen/files/machine.include b/os-plugins/plugins/xen/files/machine.include
new file mode 100644
index 00000000..06848949
--- /dev/null
+++ b/os-plugins/plugins/xen/files/machine.include
@@ -0,0 +1,167 @@
+# This is an machine template for run-virt.include of the Xen plugin.
+# This template was taken from an example in openSUSE 11.2
+
+cat <<EOF
+# -*- mode: python; -*-
+#============================================================================
+# Python configuration setup for 'xm create'.
+# This configuration was created through $0 on $(date)
+#============================================================================
+
+#----------------------------------------------------------------------------
+# Kernel image file and (optional) ramdisk (initrd).
+kernel = "${xen_kernel}"
+ramdisk = "${xen_ramdisk}"
+
+# Or use domUloader instead of kernel/ramdisk to get kernel from domU FS
+#bootloader = "/usr/lib/xen/boot/domUloader.py"
+#bootentry = "hda1:/${xen_kernel},/${xen_ramdisk}"
+# TODO: check these:
+#bootargs="--entry=xvda2:/boot/vmlinuz-xen,/boot/initrd-xen"
+
+localtime=0
+
+# The domain build function. Default is 'linux', HVM domain uses 'hvm'.
+builder = 'linux'
+
+# Initial memory allocation (in megabytes) for the new domain.
+memory = ${mem}
+
+# A name for your domain. All domains must have different names.
+name = "${vm_name}"
+
+# List of which CPUS this domain is allowed to use, default Xen picks
+#cpus = "" # leave to Xen to pick
+#cpus = "0" # all vcpus run on CPU0
+#cpus = "0-3,5,^1" # run on cpus 0,2,3,5
+#cpus = "${xen_cpus}"
+
+# Number of Virtual CPUS to use, default is 1
+#vcpus = ${xen_vcpus}
+
+#----------------------------------------------------------------------------
+# Define network interfaces.
+
+# By default, no network interfaces are configured. You may have one created
+# with sensible defaults using an empty vif clause:
+# vif = [ '' ]
+# or optionally override backend, bridge, ip, mac, script, type, or vifname:
+# vif = [ 'mac=00:16:3e:00:00:11, bridge=xenbr0' ]
+# or more than one interface may be configured:
+# vif = [ '', 'bridge=xenbr1' ]
+vif = [ '${xen_vif}' ]
+
+#----------------------------------------------------------------------------
+# Define the disk devices you want the domain to have access to, and
+# what you want them accessible as.
+# Each disk entry is of the form phy:UNAME,DEV,MODE
+# where UNAME is the device, DEV is the device name the domain will see,
+# and MODE is r for read-only, w for read-write.
+# disk = [ 'phy:hda1,hda1,w' ]
+${xen_disk}
+
+#----------------------------------------------------------------------------
+# Define frame buffer device.
+# By default, no frame buffer device is configured.
+# To create one using the SDL backend and sensible defaults:
+# vfb = [ 'type=sdl' ]
+# This uses environment variables XAUTHORITY and DISPLAY. You
+# can override that:
+# vfb = [ 'type=sdl,xauthority=/home/bozo/.Xauthority,display=:1' ]
+# To create one using the VNC backend and sensible defaults:
+# vfb = [ 'type=vnc' ]
+# The backend listens on 127.0.0.1 port 5900+N by default, where N is
+# the domain ID. You can override both address and N:
+# vfb = [ 'type=vnc,vnclisten=127.0.0.1,vncdisplay=1' ]
+# Or you can bind the first unused port above 5900:
+# vfb = [ 'type=vnc,vnclisten=0.0.0.0,vnunused=1' ]
+# You can override the password:
+# vfb = [ 'type=vnc,vncpasswd=MYPASSWD' ]
+# Empty password disables authentication. Defaults to the vncpasswd
+# configured in xend-config.sxp.
+
+#----------------------------------------------------------------------------
+# Define to which TPM instance the user domain should communicate.
+# The vtpm entry is of the form 'instance=INSTANCE,backend=DOM'
+# where INSTANCE indicates the instance number of the TPM the VM
+# should be talking to and DOM provides the domain where the backend
+# is located.
+# Note that no two virtual machines should try to connect to the same
+# TPM instance. The handling of all TPM instances does require
+# some management effort in so far that VM configration files (and thus
+# a VM) should be associated with a TPM instance throughout the lifetime
+# of the VM / VM configuration file. The instance number must be
+# greater or equal to 1.
+#vtpm = [ 'instance=1,backend=0' ]
+
+#----------------------------------------------------------------------------
+# Set the kernel command line for the new domain.
+# You only need to define the IP parameters and hostname if the domain's
+# IP config doesn't, e.g. in ifcfg-eth0 or via DHCP.
+# You can use 'extra' to set the runlevel and custom environment
+# variables used by custom rc scripts (e.g. VMID=, usr= ).
+
+# Set if you want dhcp to allocate the IP address.
+dhcp="${xen_dhcp}"
+# Set netmask.
+#netmask=
+# Set default gateway.
+#gateway=
+# Set the hostname.
+hostname= "${hostname}"
+
+# Set root device (eg. /dev/hda1).
+root = "${xen_root}"
+
+# Root device for nfs.
+#root = "/dev/nfs"
+# The nfs server.
+#nfs_server = '169.254.1.0'
+# Root directory on the nfs server.
+#nfs_root = '/full/path/to/root/directory'
+
+# Extra arguments to pass to the kernel.
+# Eg: set runlevel
+extra = "${xen_extra}"
+
+#----------------------------------------------------------------------------
+# Configure the behaviour when a domain exits. There are three 'reasons'
+# for a domain to stop: poweroff, reboot, and crash. For each of these you
+# may specify:
+# "destroy", meaning that the domain is cleaned up as normal;
+# "restart", meaning that a new domain is started in place of the old
+# one;
+# "preserve", meaning that no clean-up is done until the domain is
+# manually destroyed (using xm destroy, for example); or
+# "rename-restart", meaning that the old domain is not cleaned up, but is
+# renamed and a new domain started in its place.
+# In the event a domain stops due to a crash, you have the additional options:
+# "coredump-destroy", meaning dump the crashed domain's core and then destroy;
+# "coredump-restart', meaning dump the crashed domain's core and the restart.
+# The default is
+# on_poweroff = 'destroy'
+# on_reboot = 'restart'
+# on_crash = 'restart'
+#on_poweroff = 'destroy'
+#on_reboot = 'restart'
+#on_crash = 'restart'
+
+#-----------------------------------------------------------------------------
+# Configure PVSCSI devices:
+# PDEV gives physical SCSI device to be attached to specified guest
+# domain by one of the following identifier format.
+# - XX:XX:XX:XX (4-tuples with decimal notation which shows
+# "host:channel:target:lun")
+# - /dev/sdxx or sdx
+# - /dev/stxx or stx
+# - /dev/sgxx or sgx
+# - result of 'scsi_id -gu -s'.
+# ex. # scsi_id -gu -s /block/sdb
+# 36000b5d0006a0000006a0257004c0000
+# VDEV gives virtual SCSI device by 4-tuples (XX:XX:XX:XX) as
+# which the specified guest domain recognize.
+#vscsi = [ 'PDEV, VDEV' ]
+#vscsi = [ '/dev/sdx, 0:0:0:0' ]
+
+#============================================================================
+EOF
diff --git a/os-plugins/plugins/xen/files/run-virt.include b/os-plugins/plugins/xen/files/run-virt.include
new file mode 100644
index 00000000..43213e34
--- /dev/null
+++ b/os-plugins/plugins/xen/files/run-virt.include
@@ -0,0 +1,157 @@
+# run-virt.include
+# -----------------------------------------------------------------------------
+# Copyright (c) 2009..2010 - RZ Uni Freiburg
+# Copyright (c) 2009..2010 - OpenSLX GmbH
+#
+# This program/file 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 feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+# -----------------------------------------------------------------------------
+# run-virt.include
+# - Include script for running Xen on an OpenSLX client via the run-virt.sh
+# or run-vmgrid.sh
+################################################################################
+
+################################################################################
+### Include general configuration
+################################################################################
+if [ -f ${OPENSLX_DEFAULT_CONFDIR}/plugins/${self}/${self}.conf ]; then
+ . ${OPENSLX_DEFAULT_CONFDIR}/plugins/${self}/${self}.conf
+else
+ writelog "Problems reading config file of ${self} plugin"
+ exit 1
+fi
+
+################################################################################
+### Declaration of default variables
+################################################################################
+
+PLUGINCONFXEN="${PLUGINCONFROOT}/${self}"
+# create TMPDIR for all users
+mkdir -m 1777 /tmp/${self} 2>/dev/null
+# dir for configs
+confdir="/tmp/${self}/${USER}/${VM_ID}"
+# use vm_shortname for VM name since vm_name can be very long
+# add id so we can start more tahn one of the same image
+vm_name="${vm_shortname}-${VM_ID}"
+conffile=${confdir}/${vm_name}
+# define dirs and files which can be removed after exit, be carefull!
+rm -rf ${confdir} 2>/dev/null
+mkdir -p ${confdir} 2>/dev/null
+
+xen_kernel=${kernel:-"/boot/vmlinuz-xen"}
+xen_ramdisk=${initramfs:-"/boot/initrd-xen"}
+xen_extra="xencons=tty 3"
+[ -n "${imgname}" ] && xen_disk="disk = [ 'file:${vmpath},hda1,r' ]"
+
+writelog "Directories:"
+writelog "\tConfig dir:\t\t$confdir"
+
+################################################################################
+### Hardware checks
+################################################################################
+
+# memory part equal to vmware plugin
+# percentage of memory to use for virtualbox in standard case
+if [ -n "${forcemem}" ]; then
+ mem="${forcemem}"
+else
+ permem=30
+ if [ "${totalmem}" -ge "1600" ]; then
+ permem=40
+ fi
+ # check if /tmp is on harddisk
+ if grep -qe "/dev/.* /tmp " /proc/mounts ; then
+ permem=60
+ id44="1"
+ # Hack, if more than 2,5G RAM use 40% of Ram and write vmem into Ram as well
+ # (40% vmware | 40% confdir(vmem...) | 20% host
+ # VMplayer 2+ issue
+ # TODO: makes this sense for vbox?
+ #if [ "${totalmem}" -ge "2500" ]; then
+ #permem=40
+ #rmdir ${snapshotdir}
+ #snapshotdirold=${snapshotdir}
+ #snapshotdir=/dev/shm/${self}/${USER}/${VM_ID}
+ #mkdir -p ${snapshotdir}
+ #ln -sf ${snapshotdir} ${snapshotdirold}
+ #fi
+ fi
+ mem=$(expr ${totalmem} / 100 \* ${permem})
+ if [ "${id44}" = "1" ]; then
+ memhost=$(expr ${totalmem} - ${mem})
+ else
+ memhost=$(expr ${totalmem} - ${mem} - ${mem})
+ fi
+ #permem=40
+ #mem=$(expr ${totalmem} * ${permem})
+ if [ "${mem}" -lt "256" ] || [ "${memhost}" -lt "256" ]; then
+ writelog "Memory out of range: ${mem} MB (guest) / ${memhost} MB (host)!"
+ writelog "Min. 256 MB for host and guest!"
+ exit 1
+ fi
+fi
+
+# translate network kinds (nat, bridged, host-only)
+case "${network_kind}" in
+ bridge*)
+ xen_vif="mac=$macaddr, bridge=br0"
+ ;;
+ *)
+ xen_vif="mac=$macaddr"
+esac
+xen_dhcp="dhcp" # off
+
+# translate boot, use if set else set to disk
+xen_root=/dev/hda1
+case ${boot} in
+ n*|tftp)
+ pxe_label=$(grep -o 'pxe_label param=.*"' ${xmlfile} \
+ | sed -e "s/&.*;/; /g" | awk -F '"' '{print $2}')
+ pxe_label=$(grep -A 3 "^LABEL *${pxe_label}" \
+ ${xen_tftpdir}/pxelinux.cfg/default 2>/dev/null \
+ | grep "^ *KERNEL ")
+ if [ -n "${pxe_label}" ] && [ -n "${xen_tftpdir}" ]; then
+ xen_root=/dev/nfs
+ xen_kernel="${xen_tftpdir}/$(echo ${pxe_label} \
+ | awk -F " --- " '{print $2}' | awk '{print $1}')"
+ xen_ramdisk="${xen_tftpdir}/$(echo ${pxe_label} \
+ | awk -F " --- " '{print $3}')"
+ fi
+ ;;
+ # later maybe c|disk|hd*|sd*) for HD and d|cd*) for CD-ROM
+ *)
+ xen_root=/dev/hda1
+ ;;
+esac
+
+[ ${diskless} -eq 0 ] && writelog "Diskimage:"
+[ ${diskless} -eq 0 ] && writelog "\tMachine diskfile:\t$vmpath"
+writelog "Virtual Hardware:"
+writelog "\tGuest RAM:\t\t${mem} MB"
+# echo nur wenn memhost gesetzt
+[ -n "${memhost}" ] && writelog "\tHost RAM:\t\t${memhost} MB"
+writelog "\tMAC address:\t\t$macaddr"
+
+################################################################################
+### Pepare and configure virtual machine and disk image
+################################################################################
+
+. ${PLUGINCONFXEN}/machine.include > ${conffile}
+
+################################################################################
+### finally set env for run-virt.sh
+################################################################################
+
+# set the variables appropriately (several interfaces with different names)
+VIRTCMD=$(which xm 2>/dev/null)
+# '-c' for console, no graphical output available, later vnc possible
+VIRTCMDOPTS="create -c ${conffile}"
+
+# set headless mode
+VIRTCMDHL=$(which xm 2>/dev/null)
+VIRTCMDOPTSHL="create ${conffile}"
diff --git a/os-plugins/plugins/xen/init-hooks/10-have-nw-modules/xen.sh b/os-plugins/plugins/xen/init-hooks/10-have-nw-modules/xen.sh
deleted file mode 100644
index 321b6a06..00000000
--- a/os-plugins/plugins/xen/init-hooks/10-have-nw-modules/xen.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-# configure Xen bridge xenbr0
-modprobe ${MODPRV} netloop
-local ipls
-local vifnum="0"
-local bridge="xenbr${vifnum}"
-local netdev="eth${vifnum}"
-local pdev="p${netdev}"
-local vdev="veth${vifnum}"
-local vif0="vif0.${vifnum}"
-# fixme: that is the mac address of main ethernet device
-local mac=`ip link show ${netdev} | grep 'link\/ether' | sed -e 's/.*ether \(..:..:..:..:..:..\).*/\1/'`
-
-brctl addbr ${bridge}
-brctl stp ${bridge} off
-brctl setfd ${bridge} 0
-brctl addif ${bridge} ${vif0}
-for ipls in "${netdev} name ${pdev}" "${vdev} name ${netdev}" \
- "${pdev} down arp off" "${pdev} addr fe:ff:ff:ff:ff:ff" \
- "${netdev} addr ${mac} arp on" "${bridge} up" "${vif0} up" \
- "${pdev} up" "${netdev} up"; do
- ip link set ${ipls}
-done
-brctl addif ${bridge} ${pdev}
diff --git a/os-plugins/plugins/xen/init-hooks/10-nw-if-config/xennet.sh b/os-plugins/plugins/xen/init-hooks/10-nw-if-config/xennet.sh
new file mode 100644
index 00000000..d514b68d
--- /dev/null
+++ b/os-plugins/plugins/xen/init-hooks/10-nw-if-config/xennet.sh
@@ -0,0 +1,4 @@
+# load xennet if necessary, usualy within a NFS VM
+if grep -q "Xen Virtual Ethernet Card" /etc/hwinfo.netcard-usbctrl; then
+ modprobe xennet >/tmp/xennet.log 2>&1
+fi
diff --git a/os-plugins/plugins/xen/init-hooks/20-nw-bridge-config/bridge.sh b/os-plugins/plugins/xen/init-hooks/20-nw-bridge-config/bridge.sh
new file mode 100755
index 00000000..6aabe8ad
--- /dev/null
+++ b/os-plugins/plugins/xen/init-hooks/20-nw-bridge-config/bridge.sh
@@ -0,0 +1,30 @@
+#!/bin/ash
+# Copyright (c) 2009 - 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 feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# Init hook to create a bridge on the active network interface
+# (should be kept identical to the files of virtualbox and qemukvm plugins)
+#############################################################################
+
+local bridge=br0
+local brnwif=${nwif}
+local nwifmac=${macaddr}
+
+# bridge 0 already defined or some other problem
+brctl addbr ${bridge} || exit 0
+brctl stp ${bridge} 0
+brctl setfd ${bridge} 0.000000000001
+ip link set addr ${nwifmac} ${bridge}
+ip link set dev ${nwif} up
+brctl addif ${bridge} ${nwif}
+
+# fixme: sending back the variable to init does not work properly at the
+# moment
+nwif=${bridge}
diff --git a/os-plugins/plugins/xen/init-hooks/20-nw-bridge-config/xen-bridge.sh b/os-plugins/plugins/xen/init-hooks/20-nw-bridge-config/xen-bridge.sh
deleted file mode 100755
index 7267969c..00000000
--- a/os-plugins/plugins/xen/init-hooks/20-nw-bridge-config/xen-bridge.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/ash
-# Copyright (c) 2009 - 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 feedback to feedback@openslx.org
-#
-# General information about OpenSLX can be found at http://openslx.org
-#
-# XEN specific init hook to create a bridge on the active network interface
-#############################################################################
-
-# configure Xen bridge xenbr0 (would it be possible to make it just br0?)
-
-modprobe ${MODPRV} netloop
-local ipls
-local vifnum="0"
-local bridge="xenbr${vifnum}"
-local netdev="eth${vifnum}" # should be ${nwif}
-local pdev="p${netdev}"
-local vdev="veth${vifnum}"
-local vif0="vif0.${vifnum}"
-# fixme: that is the mac address of main ethernet device
-local mac=${macaddr}
-
-brctl addbr ${bridge}
-brctl stp ${bridge} off
-brctl setfd ${bridge} 0.000000000001
-brctl addif ${bridge} ${vif0}
-for ipls in "${netdev} name ${pdev}" "${vdev} name ${netdev}" \
- "${pdev} down arp off" "${pdev} addr fe:ff:ff:ff:ff:ff" \
- "${netdev} addr ${mac} arp on" "${netdev} addr ${mac} arp on" \
- "${bridge} up" "${vif0} up" "${pdev} up" ; do
- ip link set ${ipls}
-done
-brctl addif ${bridge} ${pdev}
-
-# fixme: sending back the variable to init does not work properly at the
-# moment
-nwif=${bridge}
diff --git a/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm b/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm
index 4cb7804b..61372d54 100644
--- a/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm
+++ b/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm
@@ -356,7 +356,6 @@ sub installAtiOldStyle
}
rmtree("$repopath/ati/temp");
-
}
1;
diff --git a/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_2.pm b/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_2.pm
new file mode 100644
index 00000000..5cddcef0
--- /dev/null
+++ b/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_2.pm
@@ -0,0 +1,53 @@
+# Copyright (c) 2010 - 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/
+# -----------------------------------------------------------------------------
+# xserver/OpenSLX/Distro/Suse_11_2.pm
+# - provides SUSE-specific overrides of the Distro API for the xserver
+# plugin.
+# -----------------------------------------------------------------------------
+package xserver::OpenSLX::Distro::Suse_11_2;
+
+use strict;
+use warnings;
+
+use base qw(xserver::OpenSLX::Distro::Base);
+
+use File::Path;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+use OpenSLX::DistroUtils;
+
+use Data::Dumper;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub setupXserverScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupXserverScript($repoPath);
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ # SuSE specific extension to stage3 xserver.sh
+ testmkd /mnt/var/lib/xkb/compiled
+ testmkd /mnt/var/lib/X11
+ testmkd /mnt/var/lib/xdm/authdir/authfiles 0700
+ ln -s /usr/bin/Xorg /mnt/var/lib/X11/X
+ rm /mnt/etc/X11/xdm/SuSEconfig.xdm
+ End-of-Here
+
+ return $script;
+}
+
+1;
diff --git a/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm b/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm
index 537ef54c..728e6a03 100644
--- a/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm
+++ b/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm
@@ -1,4 +1,4 @@
-# Copyright (c) 2008 - OpenSLX GmbH
+# Copyright (c) 2008..2010 - OpenSLX GmbH
#
# This program is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
@@ -26,6 +26,21 @@ use OpenSLX::Utils;
### interface methods
################################################################################
+# needs to be implemented ...
+sub XserverPathInfo
+{
+ my $self = shift;
+
+ my $pathInfo = {
+ config => '/etc/X11/xorg.openslx',
+ paths => [
+ '/usr/bin',
+ ],
+ };
+
+ return $pathInfo;
+}
+
sub setupXserverScript
{
my $self = shift;
@@ -37,6 +52,12 @@ sub setupXserverScript
# Ubuntu specific extension to stage3 xserver.sh
testmkd /mnt/var/run/xauth
testmkd /mnt/var/lib/xkb
+ ln -sf /usr/bin/Xorg /mnt/etc/X11/X
+ # newer Xorgs do not need predefined configuration file, not needed if
+ # XserverPathInfo gets implemented ...
+ sed -e "1i# xorg.conf not needed in most cases for Xorg 1.7+" \
+ /mnt/etc/X11/xorg.conf >/etc/X11/xorg.openslx 2>/dev/null
+ rm /mnt/etc/X11/xorg.conf 2>/dev/null
End-of-Here
return $script;
diff --git a/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu_8.pm b/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu_8.pm
new file mode 100644
index 00000000..0c152dba
--- /dev/null
+++ b/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu_8.pm
@@ -0,0 +1,71 @@
+# Copyright (c) 2008..2010 - 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/
+# -----------------------------------------------------------------------------
+# xserver/OpenSLX/Distro/Ubuntu_8.pm
+# - provides Ubuntu-specific overrides of the distro API for the xserver
+# plugin.
+# -----------------------------------------------------------------------------
+package xserver::OpenSLX::Distro::Ubuntu_8;
+
+use strict;
+use warnings;
+
+use base qw(xserver::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub setupXserverScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupXserverScript($repoPath);
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ # Ubuntu specific extension to stage3 xserver.sh
+ testmkd /mnt/var/run/xauth
+ testmkd /mnt/var/lib/xkb
+ ln -sf /usr/bin/Xorg /mnt/etc/X11/X
+ End-of-Here
+
+ return $script;
+}
+
+
+sub installNvidia
+{
+ my $self = shift;
+ my $repopath = shift || "/opt/openslx/plugin-repo/xserver/";
+ my $pkgpath = shift || "packages";
+
+ my $distroName = $self->{engine}->distroName();
+
+ system($repopath."/ubuntu-gfx-install.sh nvidia $distroName");
+
+}
+
+sub installAti
+{
+ my $self = shift;
+ my $repopath = shift || "/opt/openslx/plugin-repo/xserver/";
+ my $pkgpath = shift || "packages";
+
+ my $distroName = $self->{engine}->distroName();
+
+ system($repopath."/ubuntu-gfx-install.sh ati $distroName");
+
+}
+
+1;
diff --git a/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu_9.pm b/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu_9.pm
new file mode 100644
index 00000000..80dccbc9
--- /dev/null
+++ b/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu_9.pm
@@ -0,0 +1,30 @@
+# Copyright (c) 2008..2010 - 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/
+# -----------------------------------------------------------------------------
+# xserver/OpenSLX/Distro/Ubuntu_9.pm
+# - provides Ubuntu-specific overrides of the distro API for the xserver
+# plugin.
+# -----------------------------------------------------------------------------
+package xserver::OpenSLX::Distro::Ubuntu_9;
+
+use strict;
+use warnings;
+
+use base qw(xserver::OpenSLX::Distro::Ubuntu_8);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+
+1;
diff --git a/os-plugins/plugins/xserver/init-hooks/00-started/xserver.sh b/os-plugins/plugins/xserver/init-hooks/00-started/xserver.sh
index 71d185e0..f9c3e7a7 100644
--- a/os-plugins/plugins/xserver/init-hooks/00-started/xserver.sh
+++ b/os-plugins/plugins/xserver/init-hooks/00-started/xserver.sh
@@ -19,6 +19,11 @@
# automatic Xorg configation fails in this field. If no useable info was
# detected just delete the file.
+# not really needed for ubuntu 10.04
+# ToDo: fix so it is not installed by default
+#echo ${slx_distro_name}${slx_distro_ver}>/tmp/utest
+#[ ${slx_distro_name} = "ubuntu" ] && [ ${slx_distro_ver} = "10.04" ] && exit 0
+
# tablet detection function
tabletdetect () {
sleep 1; waitfor /etc/hwinfo.bios 20000
@@ -39,4 +44,3 @@ tabletdetect () {
( hwinfo --monitor >/etc/hwinfo.display; grep "Generic Monitor" \
/etc/hwinfo.display >/dev/null 2>&1 && rm /etc/hwinfo.display ) &
( tabletdetect ) &
-