diff options
author | Oliver Tappe | 2007-03-23 00:25:58 +0100 |
---|---|---|
committer | Oliver Tappe | 2007-03-23 00:25:58 +0100 |
commit | e5a7b403cd48a87955a390c78139d4c489bfd0a1 (patch) | |
tree | 0a9b91fbef184a7fc5833084ab41e6e8a9296c05 | |
parent | * completed this script: (diff) | |
download | core-e5a7b403cd48a87955a390c78139d4c489bfd0a1.tar.gz core-e5a7b403cd48a87955a390c78139d4c489bfd0a1.tar.xz core-e5a7b403cd48a87955a390c78139d4c489bfd0a1.zip |
* adjusted to changed DB-schema
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@801 95ad53e4-c205-0410-b2fa-d234c58c8868
-rw-r--r-- | config-db/OpenSLX/ConfigDB.pm | 36 | ||||
-rwxr-xr-x | config-db/slxconfig-demuxer | 50 |
2 files changed, 32 insertions, 54 deletions
diff --git a/config-db/OpenSLX/ConfigDB.pm b/config-db/OpenSLX/ConfigDB.pm index b3606e9d..b7744b1f 100644 --- a/config-db/OpenSLX/ConfigDB.pm +++ b/config-db/OpenSLX/ConfigDB.pm @@ -116,14 +116,6 @@ sub _unique return grep { !$seenIDs{$_}++; } @_; } -sub _uniqueByKey -{ # return given array filtered to unique key elements - my $key = shift; - - my %seenIDs; - return grep { !$seenIDs{$_->{$key}}++; } @_; -} - ################################################################################ ### data access interface ################################################################################ @@ -836,9 +828,9 @@ sub aggregatedClientIDsOfSystem return _unique(@clientIDs); } -sub aggregatedSystemFileInfosOfSystem -{ # return aggregated list of hash-refs that contain information about - # the kernel- and initialramfs-files this system is using +sub aggregatedSystemFileInfoFor +{ # return aggregated information about the kernel and initialramfs + # this system is using my $self = shift; my $system = shift; @@ -849,29 +841,19 @@ sub aggregatedSystemFileInfosOfSystem my $kernelPath = "$openslxConfig{'private-path'}/stage1/$vendorOS->{name}/boot"; - my $exportURI = $system->{'export_uri'}; + my $exportURI = $export->{'uri'}; if ($exportURI !~ m[\w]) { # auto-generate export_uri if none has been given: - my $type = $system->{'export_type'}; + my $type = $export->{'type'}; my $serverIpToken = generatePlaceholderFor('serverip'); $exportURI = "$type://$serverIpToken$openslxConfig{'export-path'}/$type/$vendorOS->{name}"; } - my @infos; - foreach my $sys ($system) { - next if !length($sys->{kernel}); - my %info = %$sys; - $info{'kernel-file'} = "$kernelPath/$sys->{kernel}"; - $info{'export-uri'} = $exportURI; - if (!defined $info{'name'}) { - # compose full name and label for system-variant: - $info{'name'} = "$system->{name}-$info{name_addition}"; - $info{'label'} = "$system->{label} $info{label_addition}"; - } - push @infos, \%info; - } - return _uniqueByKey('name', @infos); + my $info = { %$system }; + $info->{'kernel-file'} = "$kernelPath/$system->{kernel}"; + $info->{'export-uri'} = $exportURI; + return $info; } ################################################################################ diff --git a/config-db/slxconfig-demuxer b/config-db/slxconfig-demuxer index b35489cd..97d7af2f 100755 --- a/config-db/slxconfig-demuxer +++ b/config-db/slxconfig-demuxer @@ -265,20 +265,18 @@ sub writePXEMenus my @systemIDs = $openslxDB->aggregatedSystemIDsOfClient($client); my @systems = $openslxDB->fetchSystemByID(\@systemIDs); foreach my $system (@systems) { - my @infos = $openslxDB->aggregatedSystemFileInfosOfSystem($system); - foreach my $info (@infos) { - my $extSysID = externalIDForSystem($info); - my $append = $system->{kernel_params}; - $append .= " initrd=$extSysID/initramfs"; - $append .= " $clientAppend"; - $append .= " rootfs=$info->{'export-uri'} file"; - print PXE "LABEL openslx-$extSysID\n"; -# print PXE "\tMENU DEFAULT\n"; - print PXE "\tMENU LABEL ^$info->{label}\n"; - print PXE "\tKERNEL $extSysID/kernel\n"; - print PXE "\tAPPEND $append\n"; - print PXE "\tIPAPPEND 1\n"; - } + my $info = $openslxDB->aggregatedSystemFileInfoFor($system); + my $extSysID = externalIDForSystem($info); + my $append = $system->{kernel_params}; + $append .= " initrd=$extSysID/initramfs"; + $append .= " $clientAppend"; + $append .= " rootfs=$info->{'export-uri'} file"; + print PXE "LABEL openslx-$extSysID\n"; +# print PXE "\tMENU DEFAULT\n"; + print PXE "\tMENU LABEL ^$info->{label}\n"; + print PXE "\tKERNEL $extSysID/kernel\n"; + print PXE "\tAPPEND $append\n"; + print PXE "\tIPAPPEND 1\n"; } close(PXE); } @@ -349,20 +347,18 @@ sub writeSystemPXEFiles my $export = $openslxDB->fetchExportByID($system->{export_id}); my $vendorOS = $openslxDB->fetchVendorOSByID($export->{vendor_os_id}); - my @infos = $openslxDB->aggregatedSystemFileInfosOfSystem($system); - foreach my $info (@infos) { - my $kernelFile = $info->{'kernel-file'}; - my $extSysID = externalIDForSystem($info); - my $pxeSysPath = "$pxePath/$extSysID"; - if (-e $pxeSysPath) { - die _tr('PXE-system %s already exists!', $pxeSysPath); - } - mkdir $pxeSysPath; - vlog 1, _tr('copying kernel %s to %s/kernel', $kernelFile, $pxeSysPath); - system(qq[cp -p "$kernelFile" $pxeSysPath/kernel]) unless $dryRun; - - generateInitalRamFS($info, $vendorOS, $pxeSysPath); + my $info = $openslxDB->aggregatedSystemFileInfoFor($system); + my $kernelFile = $info->{'kernel-file'}; + my $extSysID = externalIDForSystem($info); + my $pxeSysPath = "$pxePath/$extSysID"; + if (-e $pxeSysPath) { + die _tr('PXE-system %s already exists!', $pxeSysPath); } + mkdir $pxeSysPath; + vlog 1, _tr('copying kernel %s to %s/kernel', $kernelFile, $pxeSysPath); + system(qq[cp -p "$kernelFile" $pxeSysPath/kernel]) unless $dryRun; + + generateInitalRamFS($info, $vendorOS, $pxeSysPath); } sub writeDhcpConfig |