2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-04 12:07:56 +00:00

refactor(netboot): centralize volatile kernel arguments

This commit is contained in:
Vinícius Ferrão
2026-09-01 16:13:05 -03:00
parent 47342c3321
commit 9bec1bff0e
3 changed files with 22 additions and 20 deletions
+18
View File
@@ -0,0 +1,18 @@
# IBM(c) 2026 EPL license http://www.eclipse.org/legal/epl-v10.html
package xCAT::BootUtils;
use strict;
use warnings;
use xCAT::Utils;
sub volatile_addkcmdline {
my ($kcmdline) = @_;
return $kcmdline unless $kcmdline;
my $cmdhashref = xCAT::Utils->splitkcmdline($kcmdline);
return $cmdhashref->{volatile} // '';
}
1;
+2 -10
View File
@@ -9,6 +9,7 @@ use File::Copy;
use File::Path;
use Getopt::Long;
require xCAT::Utils;
require xCAT::BootUtils;
require xCAT::TableUtils;
use xCAT::ServiceNodeUtils;
my $dhcpconf = "/etc/dhcpd.conf";
@@ -114,16 +115,7 @@ sub setstate {
my $kcmdlinehack = ($imgaddkcmdline) ? $kern->{addkcmdline} . " " . $imgaddkcmdline : $kern->{addkcmdline};
my $cmdhashref;
if ($kcmdlinehack) {
$cmdhashref = xCAT::Utils->splitkcmdline($kcmdlinehack);
}
if ($cmdhashref) {
# Use only volatile options for netboot; persistent (R::) options
# are handled separately for the installed OS via PERSKCMDLINE
$kcmdlinehack = $cmdhashref->{volatile} // "";
}
$kcmdlinehack = xCAT::BootUtils::volatile_addkcmdline($kcmdlinehack);
while ($kcmdlinehack =~ /#NODEATTRIB:([^:#]+):([^:#]+)#/) {
+2 -10
View File
@@ -9,6 +9,7 @@ use xCAT::Scope;
use xCAT::MsgUtils;
use Getopt::Long;
use xCAT::Utils;
require xCAT::BootUtils;
use xCAT::TableUtils;
use xCAT::ServiceNodeUtils;
use xCAT::Usage;
@@ -190,16 +191,7 @@ sub setstate {
my $kcmdlinehack = ($imgaddkcmdline) ? $kern->{addkcmdline} . " " . $imgaddkcmdline : $kern->{addkcmdline};
my $cmdhashref;
if ($kcmdlinehack) {
$cmdhashref = xCAT::Utils->splitkcmdline($kcmdlinehack);
}
if ($cmdhashref) {
# Use only volatile options for netboot; persistent (R::) options
# are handled separately for the installed OS via PERSKCMDLINE
$kcmdlinehack = $cmdhashref->{volatile} // "";
}
$kcmdlinehack = xCAT::BootUtils::volatile_addkcmdline($kcmdlinehack);
while ($kcmdlinehack =~ /#NODEATTRIB:([^:#]+):([^:#]+)#/) {