summaryrefslogtreecommitdiffstats
path: root/os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm
diff options
context:
space:
mode:
authorSebastian Schmelzer2010-09-02 17:50:49 +0200
committerSebastian Schmelzer2010-09-02 17:50:49 +0200
commit416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5 (patch)
tree4715f7d742fec50931017f38fe6ff0a89d4ceccc /os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm
parentFix for the problem reported on the list (sed filter forgotten for the (diff)
downloadcore-416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5.tar.gz
core-416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5.tar.xz
core-416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5.zip
change dir structure
Diffstat (limited to 'os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm')
-rw-r--r--os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm319
1 files changed, 0 insertions, 319 deletions
diff --git a/os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm b/os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm
deleted file mode 100644
index 0965b482..00000000
--- a/os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm
+++ /dev/null
@@ -1,319 +0,0 @@
-# Copyright (c) 2010 - RZ Uni Freiburg
-# 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
-# -----------------------------------------------------------------------------
-# 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{^(virtualbox|qemukvm|xen)$},
- #openvz|vserver
- content_descr => '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 /w relative 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 /w relative 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::vt' => {
- 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
- (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
- (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 do not 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::maxmem' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- maximum RAM used by one vm
- (only if supported by plugin)
- End-of-Here
- content_regex => qr{^(\d\d\d\d??\d??)$},
- content_descr => 'absolute amount: \d\d\d\d??\d??',
- default => undef,
- },
- 'vmgrid::minmem' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- minimum RAM used by one vm
- (only if supported by plugin)
- End-of-Here
- content_regex => qr{^(\d\d\d\d??\d??)$},
- content_descr => 'absolute amount: \d\d\d\d??\d??',
- 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");
- $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;