diff options
-rw-r--r-- | boot-env/OpenSLX/BootEnvironment/PXE.pm | 14 | ||||
-rw-r--r-- | config-db/OpenSLX/DBSchema.pm | 39 |
2 files changed, 39 insertions, 14 deletions
diff --git a/boot-env/OpenSLX/BootEnvironment/PXE.pm b/boot-env/OpenSLX/BootEnvironment/PXE.pm index fe72b1cf..f3c20e19 100644 --- a/boot-env/OpenSLX/BootEnvironment/PXE.pm +++ b/boot-env/OpenSLX/BootEnvironment/PXE.pm @@ -83,12 +83,22 @@ sub writeBootloaderMenuFor my $vendorOSName = $info->{'vendor-os'}->{name}; my $kernelName = basename($info->{'kernel-file'}); my $append = $info->{attrs}->{kernel_params}; - $append .= " initrd=$vendorOSName/$info->{'initramfs-name'}"; + my $pxePrefix = ''; + my $tftpPrefix = ''; + + # pxe_prefix_ip set and looks like a ip + if ($info->{'pxe_prefix_ip'} =~ m/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/) { + $pxePrefix = "$info->{'pxe_prefix_ip'}::"; + $tftpPrefix = "tftp://$info->{'pxe_prefix_ip'}" if ! length($bootURI); + } + + $append .= " initrd=$pxePrefix$vendorOSName/$info->{'initramfs-name'}"; $append .= " file=$bootURI" if length($bootURI); + $append .= " file=$tftpPrefix" if length($tftpPrefix); $append .= " $clientAppend"; $slxLabels .= "LABEL openslx-$info->{'external-id'}\n"; $slxLabels .= "\tMENU LABEL ^$info->{pxeLabel}\n"; - $slxLabels .= "\tKERNEL $vendorOSName/$kernelName\n"; + $slxLabels .= "\tKERNEL $pxePrefix$vendorOSName/$kernelName\n"; $slxLabels .= "\tAPPEND $append\n"; $slxLabels .= "\tIPAPPEND 3\n"; my $helpText = $info->{description} || ''; diff --git a/config-db/OpenSLX/DBSchema.pm b/config-db/OpenSLX/DBSchema.pm index 976d9c6a..f11ced10 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.34; +my $VERSION = 0.35; my $DbSchema = { 'version' => $VERSION, @@ -187,17 +187,18 @@ my $DbSchema = { # represents a selectable line in the PXE boot menu of all the # clients associated with this system 'cols' => [ - 'id:pk', # primary key - 'export_id:fk', # foreign key - 'name:s.64', # unique name of system, is automatically - # constructed like this: - # <vendor-os-name>-<export-type>-<kernel> - 'label:s.64', # name visible to user (pxe-label) - # if empty, this will be autocreated from - # the name - 'kernel:s.128', # path to kernel file, relative to /boot - 'description:s.512',# visible description (for PXE TEXT) - 'comment:s.1024', # internal comment (optional, for admins) + 'id:pk', # primary key + 'export_id:fk', # foreign key + 'name:s.64', # unique name of system, is automatically + # constructed like this: + # <vendor-os-name>-<export-type>-<kernel> + 'label:s.64', # name visible to user (pxe-label) + # if empty, this will be autocreated from + # the name + 'kernel:s.128', # path to kernel file, relative to /boot + 'description:s.512', # visible description (for PXE TEXT) + 'pxe_prefix_ip:s.16', # ip prefix for PXE Menu entry + 'comment:s.1024', # internal comment (optional, for admins) ], 'vals' => [ { # add default system @@ -792,6 +793,20 @@ sub _schemaUpgradeDBFrom return 1; }, + 0.35 => sub { + my $metaDB = shift; + + # add new column system.pxe_prefix_ip + $metaDB->schemaAddColumns( + 'system', + [ + 'pxe_prefix_ip:s.16', + ], + undef + ); + + return 1; + }, ); 1; |