diff options
| author | Michael Janczyk | 2010-03-19 17:33:58 +0100 |
|---|---|---|
| committer | Michael Janczyk | 2010-03-19 17:33:58 +0100 |
| commit | 0da1acc25f8d5f36c660f2d2fa83d1c0240c3909 (patch) | |
| tree | 233449e24758c5c903faa8aa84189962e31a0581 /os-plugins/plugins/vmgrid/OpenSLX | |
| parent | virtualbox, vmgrix und xen anpassungen (diff) | |
| download | core-0da1acc25f8d5f36c660f2d2fa83d1c0240c3909.tar.gz core-0da1acc25f8d5f36c660f2d2fa83d1c0240c3909.tar.xz core-0da1acc25f8d5f36c660f2d2fa83d1c0240c3909.zip | |
virtualbox, vmgrix und xen anpassungen, jetzt auch geadded
Diffstat (limited to 'os-plugins/plugins/vmgrid/OpenSLX')
| -rw-r--r-- | os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm | 244 |
1 files changed, 244 insertions, 0 deletions
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..a4f08bc1 --- /dev/null +++ b/os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm @@ -0,0 +1,244 @@ +# 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; + +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 => 'possible values: 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 => 'possible values: "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 => 'possible values: 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 => 'possible values: 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 => 'vals: \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 => 'values can be 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 => 'values can be 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'}; + + # 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; +} + +1; + |
