From 4578a3dd6491fc1c5a0eeecd3e66a93bdae7aafa Mon Sep 17 00:00:00 2001 From: Michael Janczyk Date: Sun, 4 Jul 2010 20:55:55 +0200 Subject: changed copyright years, added ovz plugin stubs --- .../plugins/openvz/OpenSLX/OSPlugin/openvz.pm | 110 +++++++++++++++++++++ os-plugins/plugins/openvz/XX_openvz.sh | 66 +++++++++++++ os-plugins/plugins/openvz/files/machine.include | 0 os-plugins/plugins/openvz/files/run-virt.include | 37 +++++++ .../init-hooks/20-nw-bridge-config/bridge.sh | 30 ++++++ .../plugins/qemukvm/OpenSLX/OSPlugin/qemukvm.pm | 3 +- os-plugins/plugins/qemukvm/XX_qemukvm.sh | 1 + .../init-hooks/80-after-plugins/virtualization.sh | 4 +- .../plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm | 3 +- os-plugins/plugins/vmgrid/XX_vmgrid.sh | 4 +- os-plugins/plugins/vmgrid/files/run-vmgrid.sh | 4 +- os-plugins/plugins/vmgrid/files/vmgrid | 4 +- .../init-hooks/80-after-plugins/virtualization.sh | 4 +- os-plugins/plugins/xen/OpenSLX/OSPlugin/xen.pm | 3 +- os-plugins/plugins/xen/XX_xen.sh | 4 +- os-plugins/plugins/xen/files/run-virt.include | 4 +- 16 files changed, 264 insertions(+), 17 deletions(-) create mode 100644 os-plugins/plugins/openvz/OpenSLX/OSPlugin/openvz.pm create mode 100644 os-plugins/plugins/openvz/XX_openvz.sh create mode 100644 os-plugins/plugins/openvz/files/machine.include create mode 100644 os-plugins/plugins/openvz/files/run-virt.include create mode 100755 os-plugins/plugins/openvz/init-hooks/20-nw-bridge-config/bridge.sh (limited to 'os-plugins') diff --git a/os-plugins/plugins/openvz/OpenSLX/OSPlugin/openvz.pm b/os-plugins/plugins/openvz/OpenSLX/OSPlugin/openvz.pm new file mode 100644 index 00000000..35e12bb2 --- /dev/null +++ b/os-plugins/plugins/openvz/OpenSLX/OSPlugin/openvz.pm @@ -0,0 +1,110 @@ +# 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/ +# ----------------------------------------------------------------------------- +# openvz.pm +# - implementation of the 'openvz' plugin +# ----------------------------------------------------------------------------- +package OpenSLX::OSPlugin::openvz; + +use strict; +use warnings; + +use base qw(OpenSLX::OSPlugin::Base); + +use File::Path; + +use OpenSLX::Basics; +use OpenSLX::Utils; + +sub new +{ + my $class = shift; + + my $self = { + name => 'openvz', + }; + + return bless $self, $class; +} + +sub getInfo +{ + my $self = shift; + + return { + description => unshiftHereDoc(<<' End-of-Here'), + Configures openVZ diskless boot, no installation yet. + End-of-Here + precedence => 20, + }; +} + +sub getAttrInfo +{ + my $self = shift; + + return { + 'openvz::active' => { + applies_to_systems => 1, + applies_to_clients => 1, + description => unshiftHereDoc(<<' End-of-Here'), + should the 'openvz'-plugin be executed during boot? + End-of-Here + content_regex => qr{^(0|1)$}, + content_descr => '1 means active - 0 means inactive', + # set active to 0, later set specially created openVZ system to 1 + default => '0', + }, + # attribute 'imagesrc' defines where we can find openvz images + 'openvz::imagesrc' => { + applies_to_systems => 1, + applies_to_clients => 1, + description => unshiftHereDoc(<<' End-of-Here'), + Where do we store our openvz images? NFS? Filesystem? + End-of-Here + content_regex => qr{^(/|nfs://)}, + content_descr => 'local path or URI 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 ) ) { + copyFile("$pluginBasePath/$file", "$self->{pluginRepositoryPath}/"); + chmod 0644, "$self->{pluginRepositoryPath}/$file"; + } + + return; +} + +sub removalPhase +{ + my $self = shift; + my $info = shift; + + return; +} + +1; diff --git a/os-plugins/plugins/openvz/XX_openvz.sh b/os-plugins/plugins/openvz/XX_openvz.sh new file mode 100644 index 00000000..721c76a4 --- /dev/null +++ b/os-plugins/plugins/openvz/XX_openvz.sh @@ -0,0 +1,66 @@ +# Copyright (c) 2010 - RZ Uni Freiburg +# Copyright (c) 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 +# +# stage3 part of 'openvz' plugin - the runlevel script +# +# 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/openvz.conf +PLUGINCONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/openvz +PLUGINDIR=/mnt/${OPENSLX_DEFAULT_DIR}/plugin-repo/openvz +VIRTDIR=/mnt/${OPENSLX_DEFAULT_VIRTDIR}/openvz + +# 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 [ $openvz_active -ne 0 2>/dev/null ]; then + + [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'openvz' os-plugin ..."; + + # load general configuration + . /etc/initramfs-setup + + # get source of openvz image server (get type, server and path) + if strinstr "/" "${openvz_imagesrc}" ; then + vbimgprot=$(uri_token ${openvz_imagesrc} prot) + vbimgserv=$(uri_token ${openvz_imagesrc} server) + vbimgpath="$(uri_token ${openvz_imagesrc} path)" + fi + if [ -n "${vbimgserv}" ] ; then + # directory where qemu images are expected in + mnttarget=${VIRTDIR} + # mount the openvz image source readonly (ro) + fsmount ${vbimgprot} ${vbimgserv} ${vbimgpath} ${mnttarget} ro + else + [ $DEBUGLEVEL -gt 1 ] && \ + error " * Incomplete information in variable ${openvz_imagesrc}." \ + nonfatal + fi + + # copy virtualization include files to config dir + testmkd ${PLUGINCONFDIR} + cp ${PLUGINDIR}/*.include ${PLUGINCONFDIR} + # copy ${CONFFILE} to ${PLUGINCONFDIR} just in case + cp ${CONFFILE} ${PLUGINCONFDIR} + + # activate init files + + fi +fi diff --git a/os-plugins/plugins/openvz/files/machine.include b/os-plugins/plugins/openvz/files/machine.include new file mode 100644 index 00000000..e69de29b diff --git a/os-plugins/plugins/openvz/files/run-virt.include b/os-plugins/plugins/openvz/files/run-virt.include new file mode 100644 index 00000000..53c982c8 --- /dev/null +++ b/os-plugins/plugins/openvz/files/run-virt.include @@ -0,0 +1,37 @@ +# run-virt.include +# ----------------------------------------------------------------------------- +# Copyright (c) 2010 - RZ Uni Freiburg +# Copyright (c) 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 openVZ on an OpenSLX client via 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}" diff --git a/os-plugins/plugins/openvz/init-hooks/20-nw-bridge-config/bridge.sh b/os-plugins/plugins/openvz/init-hooks/20-nw-bridge-config/bridge.sh new file mode 100755 index 00000000..6aabe8ad --- /dev/null +++ b/os-plugins/plugins/openvz/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/qemukvm/OpenSLX/OSPlugin/qemukvm.pm b/os-plugins/plugins/qemukvm/OpenSLX/OSPlugin/qemukvm.pm index e4ef657f..14e5917f 100644 --- a/os-plugins/plugins/qemukvm/OpenSLX/OSPlugin/qemukvm.pm +++ b/os-plugins/plugins/qemukvm/OpenSLX/OSPlugin/qemukvm.pm @@ -1,4 +1,5 @@ -# 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 diff --git a/os-plugins/plugins/qemukvm/XX_qemukvm.sh b/os-plugins/plugins/qemukvm/XX_qemukvm.sh index 36ff4f59..8a41ff3b 100644 --- a/os-plugins/plugins/qemukvm/XX_qemukvm.sh +++ b/os-plugins/plugins/qemukvm/XX_qemukvm.sh @@ -1,3 +1,4 @@ +# Copyright (c) 2009..2010 - RZ Uni Freiburg # Copyright (c) 2008..2010 - OpenSLX GmbH # # This program/file is free software distributed under the GPL version 2. 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 index 23095abf..73a65ac5 100644 --- a/os-plugins/plugins/vmchooser/init-hooks/80-after-plugins/virtualization.sh +++ b/os-plugins/plugins/vmchooser/init-hooks/80-after-plugins/virtualization.sh @@ -1,5 +1,5 @@ -# Copyright (c) 2008..2010 - RZ Uni Freiburg -# Copyright (c) 2008..2010 - OpenSLX GmbH +# Copyright (c) 2010 - RZ Uni Freiburg +# Copyright (c) 2010 - OpenSLX GmbH # # This program/file is free software distributed under the GPL version 2. # See http://openslx.org/COPYING diff --git a/os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm b/os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm index d90a6f53..0965b482 100644 --- a/os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm +++ b/os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm @@ -1,4 +1,5 @@ -# Copyright (c) 2008, 2010 - OpenSLX GmbH +# 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 diff --git a/os-plugins/plugins/vmgrid/XX_vmgrid.sh b/os-plugins/plugins/vmgrid/XX_vmgrid.sh index f75c895d..16f5fbd1 100644 --- a/os-plugins/plugins/vmgrid/XX_vmgrid.sh +++ b/os-plugins/plugins/vmgrid/XX_vmgrid.sh @@ -1,5 +1,5 @@ -# Copyright (c) 2008..2010 - RZ Uni Freiburg -# Copyright (c) 2008..2010 - OpenSLX GmbH +# Copyright (c) 2010 - RZ Uni Freiburg +# Copyright (c) 2010 - OpenSLX GmbH # # This program/file is free software distributed under the GPL version 2. # See http://openslx.org/COPYING diff --git a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh index 376e8182..56cdbfce 100644 --- a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh +++ b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh @@ -1,7 +1,7 @@ #!/bin/bash # ----------------------------------------------------------------------------- -# Copyright (c) 2007..2010 - RZ Uni FR -# Copyright (c) 2007..2010 - OpenSLX GmbH +# Copyright (c) 2010 - RZ Uni FR +# Copyright (c) 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/vmgrid/files/vmgrid b/os-plugins/plugins/vmgrid/files/vmgrid index 9450ecf7..2bb91481 100644 --- a/os-plugins/plugins/vmgrid/files/vmgrid +++ b/os-plugins/plugins/vmgrid/files/vmgrid @@ -1,7 +1,7 @@ #!/bin/bash # ----------------------------------------------------------------------------- -# Copyright (c) 2007..2010 - RZ Uni FR -# Copyright (c) 2007..2010 - OpenSLX GmbH +# Copyright (c) 2010 - RZ Uni FR +# Copyright (c) 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/vmgrid/init-hooks/80-after-plugins/virtualization.sh b/os-plugins/plugins/vmgrid/init-hooks/80-after-plugins/virtualization.sh index 23095abf..73a65ac5 100644 --- a/os-plugins/plugins/vmgrid/init-hooks/80-after-plugins/virtualization.sh +++ b/os-plugins/plugins/vmgrid/init-hooks/80-after-plugins/virtualization.sh @@ -1,5 +1,5 @@ -# Copyright (c) 2008..2010 - RZ Uni Freiburg -# Copyright (c) 2008..2010 - OpenSLX GmbH +# Copyright (c) 2010 - RZ Uni Freiburg +# Copyright (c) 2010 - OpenSLX GmbH # # This program/file is free software distributed under the GPL version 2. # See http://openslx.org/COPYING diff --git a/os-plugins/plugins/xen/OpenSLX/OSPlugin/xen.pm b/os-plugins/plugins/xen/OpenSLX/OSPlugin/xen.pm index 8af752b4..12331983 100644 --- a/os-plugins/plugins/xen/OpenSLX/OSPlugin/xen.pm +++ b/os-plugins/plugins/xen/OpenSLX/OSPlugin/xen.pm @@ -1,4 +1,5 @@ -# Copyright (c) 2007 - OpenSLX GmbH +# 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 diff --git a/os-plugins/plugins/xen/XX_xen.sh b/os-plugins/plugins/xen/XX_xen.sh index af3f6cc4..7dddeee0 100644 --- a/os-plugins/plugins/xen/XX_xen.sh +++ b/os-plugins/plugins/xen/XX_xen.sh @@ -1,5 +1,5 @@ -# Copyright (c) 2007..2008 - RZ Uni Freiburg -# Copyright (c) 2008 - OpenSLX GmbH +# Copyright (c) 2010 - RZ Uni Freiburg +# Copyright (c) 2010 - OpenSLX GmbH # # This program/file is free software distributed under the GPL version 2. # See http://openslx.org/COPYING diff --git a/os-plugins/plugins/xen/files/run-virt.include b/os-plugins/plugins/xen/files/run-virt.include index 43213e34..36a1d1f4 100644 --- a/os-plugins/plugins/xen/files/run-virt.include +++ b/os-plugins/plugins/xen/files/run-virt.include @@ -1,7 +1,7 @@ # run-virt.include # ----------------------------------------------------------------------------- -# Copyright (c) 2009..2010 - RZ Uni Freiburg -# Copyright (c) 2009..2010 - OpenSLX GmbH +# Copyright (c) 2010 - RZ Uni Freiburg +# Copyright (c) 2010 - OpenSLX GmbH # # This program/file is free software distributed under the GPL version 2. # See http://openslx.org/COPYING -- cgit v1.2.3-55-g7522