Skip to content

Commit 2c33e2b

Browse files
[Fixes issue: 343] Adding capability to set bootloader filename by profile
This commit adds the feature to aii-dhcp plugin to fetch bootloader filename for DHCP config to be included. Also handles situation if default bootloader may differ from the one would be used in case of rescue mode.
1 parent fd0feaf commit 2c33e2b

2 files changed

Lines changed: 33 additions & 2 deletions

File tree

aii-core/src/main/perl/Shellfe.pm

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,22 @@ sub run_plugin
577577
if ($plug->can('set_active_config')) {
578578
$plug->set_active_config($st->{configuration});
579579
}
580+
581+
my @params
582+
if ($modulename eq "dhcp") {
583+
if ($self->option("rescue") && $method eq CONFIGURE){
584+
$self->debug (4, "Setting params for DHCP plugin and rescue mode");
585+
@params = ($st->(configuration), "rescue");
586+
}
587+
else {
588+
$self->debug (4, "Setting params for DHCP plugin and non-rescue mode");
589+
@params = ($st ->(configuration), "none");
590+
}
591+
}
592+
else {
593+
$self->debug (4, "Setting generic params");
594+
@params = ($st ->(configuration));
595+
}
580596

581597
# The plugin method has to return success
582598
my $res = eval { $plug->$method ($st->{configuration}) };

aii-dhcp/src/main/perl/dhcp.pm

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,12 @@ sub update_dhcp_config_file
138138
push @newnodes, "$indent\t next-server $node->{ST_IP_TFTP};";
139139
}
140140

141-
# additional options
141+
# DHCP bootloader filename option
142+
if ($node->{FILENAME}) {
143+
push @newnodes, "$indent\t filename \"$node->{FILENAME}\";";
144+
}
145+
146+
# additional options
142147
if ($node->{MORE_OPT}) {
143148
push @newnodes, "$indent\t $node->{MORE_OPT}";
144149
}
@@ -293,7 +298,7 @@ sub update_dhcp_config {
293298
# Adds the entry to dhcp
294299
sub Configure
295300
{
296-
my ($self, $config) = @_;
301+
my ($self, $config, $rescue) = @_;
297302

298303
my $tree = $config->getElement("/system/network")->getTree();
299304
my $fqdn = $tree->{hostname} . "." . $tree->{domainname};
@@ -315,9 +320,18 @@ sub Configure
315320
my $opts = $config->getElement("/system/aii/dhcp")->getTree();
316321
my $tftpserver = "";
317322
my $additional = "";
323+
my filename = "";
318324
if ($opts->{tftpserver}) {
319325
$tftpserver = $opts->{tftpserver};
320326
}
327+
328+
if ($opts->(filename)) {
329+
$filename = $opts->(filename);
330+
}
331+
if ($rescue eq 'rescue' && $opts->(rescue)) {
332+
$filename = $opts->(rescue);
333+
}
334+
321335
if ($opts->{options}) {
322336
foreach my $k (sort keys %{$opts->{options}}) {
323337
$additional .= "option $k $opts->{options}->{$k};\n";
@@ -331,6 +345,7 @@ sub Configure
331345
IP => unpack('N', Socket::inet_aton($ip)),
332346
MAC => $cards->{$bootable}->{hwaddr},
333347
ST_IP_TFTP => $tftpserver,
348+
FILENAME => $filename,
334349
MORE_OPT => $additional,
335350
};
336351
if ($this_app->option('use_fqdn')) {

0 commit comments

Comments
 (0)