From c44835d6a46e2febe548a522881f70254ad20db8 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Wed, 3 Jun 2009 21:56:14 +0000 Subject: Refactored implementation of preboot evironment to support the creation of several preboot media from a single preboot client: * added new client attribute preboot_media which holds the list of media that shall be created for that preboot client (currently, only 'cd' is known) * the boot_type value 'preboot_cd' has been renamed to 'preboot' * db-schema has been bumped to 0.36 to adjust the db-contents to the new expectations * adjusted config-demuxer accordingly git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2929 95ad53e4-c205-0410-b2fa-d234c58c8868 --- config-db/OpenSLX/AttributeRoster.pm | 25 ++++++++++++++++++++----- config-db/OpenSLX/DBSchema.pm | 19 ++++++++++++++++++- config-db/slxconfig-demuxer | 14 +++++++++----- 3 files changed, 47 insertions(+), 11 deletions(-) (limited to 'config-db') diff --git a/config-db/OpenSLX/AttributeRoster.pm b/config-db/OpenSLX/AttributeRoster.pm index 3c359e82..89fe6577 100644 --- a/config-db/OpenSLX/AttributeRoster.pm +++ b/config-db/OpenSLX/AttributeRoster.pm @@ -67,12 +67,13 @@ sub _init Currently the following boot types are supported: pxe (is the default) uses PXE to boot client over LAN - preboot-cd - generates a bootable CD-image that can be used to - remotely boot the systems referred to by this client + preboot + generates a set of images (see preboot_media) that can + be used to remotely boot the systems referred to by + this client End-of-Here - content_regex => qr{^(pxe|preboot-cd)$}, - content_descr => '"pxe" or "preboot-cd"', + content_regex => qr{^(pxe|preboot)$}, + content_descr => '"pxe" or "preboot"', default => 'pxe', }, 'boot_uri' => { @@ -126,6 +127,20 @@ sub _init content_descr => 'kernel cmdline fragment', default => '', }, + 'preboot_media' => { + applies_to_systems => 0, + applies_to_clients => 1, + description => unshiftHereDoc(<<' End-of-Here'), + List of preboot media supported by this client. + Currently the following preboot media are supported: + cd + generates a bootable CD-image that can be used to + remotely boot the systems referred to by this client + End-of-Here + content_regex => undef, + content_descr => undef, + default => '', + }, 'ramfs_fsmods' => { applies_to_systems => 1, applies_to_clients => 0, diff --git a/config-db/OpenSLX/DBSchema.pm b/config-db/OpenSLX/DBSchema.pm index f11ced10..b4130e15 100644 --- a/config-db/OpenSLX/DBSchema.pm +++ b/config-db/OpenSLX/DBSchema.pm @@ -34,7 +34,7 @@ use OpenSLX::Basics; ### fk => foreign key (integer) ################################################################################ -my $VERSION = 0.35; +my $VERSION = 0.36; my $DbSchema = { 'version' => $VERSION, @@ -805,6 +805,23 @@ sub _schemaUpgradeDBFrom undef ); + return 1; + }, + 0.36 => sub { + my $metaDB = shift; + + # value 'preboot-cd' in client-attr 'boot_type' has been changed + # to 'preboot', and a separate attribute 'preboot_media' has been + # introduced: + foreach my $client ($metaDB->fetchClientByFilter()) { + my $attrs = $metaDB->fetchClientAttrs($client->{id}); + if ($attrs->{boot_type} eq 'preboot-cd') { + $attrs->{boot_type} = 'preboot'; + $attrs->{preboot_media} = 'cd'; + $metaDB->setClientAttrs($client->{id}, $attrs); + } + } + return 1; }, ); diff --git a/config-db/slxconfig-demuxer b/config-db/slxconfig-demuxer index 9cbc03c1..e812dd93 100755 --- a/config-db/slxconfig-demuxer +++ b/config-db/slxconfig-demuxer @@ -324,13 +324,17 @@ sub createTarOfPath sub bootEnvironmentForType { - my $bootType = shift || 'pxe'; + my $bootTypeIn = shift || 'pxe'; my %bootTypeMap = ( - 'pxe' => 'PXE', - 'preboot-cd' => 'PrebootCD', + 'pxe' => 'PXE', + 'preboot' => 'Preboot', ); - $bootType = $bootTypeMap{lc($bootType)}; + my $bootType = $bootTypeMap{lc($bootTypeIn)} + or die _tr( + "'%s' is not one of the supported boot-types (pxe,preboot)", + $bootTypeIn + ); if (!$bootEnvMap{$bootType}) { my $bootEnv = instantiateClass("OpenSLX::BootEnvironment::$bootType"); @@ -494,7 +498,7 @@ sub writeClientConfigurationsForSystem "$bootEnv->{'target-path'}/client-config/$externalSystemID" ); } - case 'preboot-cd' { + case 'preboot' { # for preboot types my $cname = $client->{name}; createTarOfPath( -- cgit v1.2.3-55-g7522