support persistent kernel cmdline after diskful installation
This commit is contained in:
parent
520a74e3da
commit
43ec8b55ef
@ -326,7 +326,7 @@ bootparams => {
|
||||
'kernel' => 'The kernel that network boot actions should currently acquire and use. Note this could be a chained boot loader such as memdisk or a non-linux boot loader',
|
||||
'initrd' => 'The initial ramdisk image that network boot actions should use (could be a DOS floppy or hard drive image if using memdisk as kernel)',
|
||||
'kcmdline' => 'Arguments to be passed to the kernel',
|
||||
'addkcmdline' => 'User specified one or more parameters to be passed to the kernel',
|
||||
'addkcmdline' => 'User specified one or more parameters to be passed to the kernel. For the kernel options need to be persistent after installation, specify them with prefix "P::"',
|
||||
'dhcpstatements' => 'xCAT manipulated custom dhcp statements (not intended for user manipulation)',
|
||||
'adddhcpstatements' => 'Custom dhcp statements for administrator use (not implemneted yet)',
|
||||
comments => 'Any user-written notes.',
|
||||
@ -754,7 +754,7 @@ linuximage => {
|
||||
imagename => 'The name of this xCAT OS image definition.',
|
||||
template => 'The fully qualified name of the template file that will be used to create the OS installer configuration file for stateful installations (e.g. kickstart for RedHat, autoyast for SLES).',
|
||||
boottarget => 'The name of the boottarget definition. When this attribute is set, xCAT will use the kernel, initrd and kernel params defined in the boottarget definition instead of the default.',
|
||||
addkcmdline=> 'User specified arguments to be passed to the kernel. The user arguments are appended to xCAT.s default kernel arguments. This attribute is ignored if linuximage.boottarget is set.',
|
||||
addkcmdline=> 'User specified arguments to be passed to the kernel. The user arguments are appended to xCAT.s default kernel arguments. For the kernel options need to be persistent after installation, specify them with prefix "P::". This attribute is ignored if linuximage.boottarget is set.',
|
||||
pkglist => 'The fully qualified name of the file that stores the distro packages list that will be included in the image. Make sure that if the pkgs in the pkglist have dependency pkgs, the dependency pkgs should be found in one of the pkgdir',
|
||||
pkgdir => 'The name of the directory where the distro packages are stored. It could be set multiple paths.The multiple paths must be seperated by ",". The first path in the value of osimage.pkgdir must be the OS base pkg dir path, such as pkgdir=/install/rhels6.2/x86_64,/install/updates . In the os base pkg path, there are default repository data. And in the other pkg path(s), the users should make sure there are repository data. If not, use "createrepo" command to create them. For ubuntu, multiple mirrors can be specified in the pkgdir attribute, the mirrors must be prefixed by the protocol(http/ssh) and delimited with "," between each other.',
|
||||
otherpkglist => 'The fully qualified name of the file that stores non-distro package lists that will be included in the image. It could be set multiple paths.The multiple paths must be seperated by ",".',
|
||||
|
@ -4505,5 +4505,32 @@ sub parseMacTabEntry{
|
||||
return $mac_ret;
|
||||
}
|
||||
|
||||
#The splitkcmdline subroutine is used to split the "persistent kernel options"
|
||||
#and "provision-time kernel options" out of the kernel cmdline string
|
||||
#Arguments:
|
||||
# $kcmdline: the native kernel cmdline string
|
||||
#Return value:
|
||||
# a reference of hash with the following KEY-VALUE def:
|
||||
# "persistent" ==> string of persistent kernel options,delimited with space " "
|
||||
# "volatile" ==> string of provision-time kernel options,delimited with space " "
|
||||
sub splitkcmdline{
|
||||
my $kcmdline=shift;
|
||||
if( $kcmdline =~ /xCAT::Utils/) {
|
||||
$kcmdline=shift;
|
||||
}
|
||||
|
||||
my %cmdhash;
|
||||
|
||||
my @cmdlist=split(/[, ]/,$kcmdline);
|
||||
foreach my $cmd (@cmdlist){
|
||||
if($cmd =~ /^P::(.*)$/){
|
||||
$cmdhash{persistent}.="$1 ";
|
||||
}else{
|
||||
$cmdhash{volatile}.="$cmd ";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return \%cmdhash;
|
||||
}
|
||||
1;
|
||||
|
@ -104,7 +104,7 @@ sub subvars {
|
||||
$ENV{NODESTATUS}=$tmp;
|
||||
}
|
||||
|
||||
|
||||
$ENV{PERSKCMDLINE}=getPersistentKcmdline($node);
|
||||
|
||||
#replace the env with the right value so that correct include files can be found
|
||||
$inc =~ s/#ENV:([^#]+)#/envvar($1)/eg;
|
||||
@ -250,6 +250,7 @@ sub subvars {
|
||||
$inc =~ s/#KICKSTARTNET#/kickstartnetwork()/eg;
|
||||
$inc =~ s/#MIRRORSPEC#/mirrorspec()/eg;
|
||||
$inc =~ s/#YAST2NET#/yast2network()/eg;
|
||||
$inc =~ s/#KICKSTARTBOOTLOADER#/kickstartbootloader()/eg;
|
||||
$inc =~ s/#ESXIPV6SETUP#/esxipv6setup()/eg;
|
||||
$inc =~ s/#WINTIMEZONE#/xCAT::TZUtils::get_wintimezone()/eg;
|
||||
$inc =~ s/#WINPRODKEY:([^#]+)#/get_win_prodkey($1)/eg;
|
||||
@ -662,6 +663,66 @@ sub get_node_domain {
|
||||
|
||||
}
|
||||
|
||||
|
||||
#get persistent command options from node and osimage definition
|
||||
sub getPersistentKcmdline {
|
||||
my $lcnode=shift;
|
||||
if ( $lcnode eq 'THISNODE' ){
|
||||
$lcnode=$node;
|
||||
}
|
||||
|
||||
my @nodes=($lcnode);
|
||||
|
||||
my $bptab=xCAT::Table->new('bootparams',-create=>1);
|
||||
my $bphash = $bptab->getNodesAttribs(\@nodes,['addkcmdline']);
|
||||
|
||||
my $typetab=xCAT::Table->new('nodetype',-create=>1);
|
||||
my $typehash=$typetab->getNodesAttribs(\@nodes,['provmethod']);
|
||||
my $linuximgtab=xCAT::Table->new('linuximage',-create=>1);
|
||||
|
||||
my $ent = $typehash->{$lcnode}->[0];
|
||||
my $osimgname = $ent->{'provmethod'};
|
||||
|
||||
my $linuximghash = $linuximgtab->getAttribs({imagename => $osimgname}, 'boottarget', 'addkcmdline');
|
||||
my $kern = $bphash->{$lcnode}->[0];
|
||||
|
||||
my $addkcmdline;
|
||||
if ($kern->{addkcmdline}) {
|
||||
$addkcmdline .= $kern->{addkcmdline}." ";
|
||||
}
|
||||
|
||||
if($linuximghash and $linuximghash->{'addkcmdline'})
|
||||
{
|
||||
unless($linuximghash->{'boottarget'})
|
||||
{
|
||||
$addkcmdline .= $linuximghash->{'addkcmdline'}." ";
|
||||
}
|
||||
}
|
||||
|
||||
my $cmdhashref;
|
||||
if($addkcmdline){
|
||||
$cmdhashref=xCAT::Utils->splitkcmdline($addkcmdline);
|
||||
}
|
||||
|
||||
my $ret="";
|
||||
if($cmdhashref and $cmdhashref->{persistent})
|
||||
{
|
||||
$ret=$cmdhashref->{persistent};
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
sub kickstartbootloader {
|
||||
my $line="bootloader";
|
||||
if($ENV{PERSKCMDLINE}){
|
||||
$line.=" --append=\"".$ENV{PERSKCMDLINE}."\"";
|
||||
}
|
||||
return $line;
|
||||
}
|
||||
|
||||
|
||||
sub esxipv6setup {
|
||||
if (not $::XCATSITEVALS{managedaddressmode} or $::XCATSITEVALS{managedaddressmode} =~ /v4/) { return ""; } # blank line for ipv4 schemes
|
||||
my $v6addr;
|
||||
|
@ -132,17 +132,29 @@ sub setstate {
|
||||
$kern->{kcmdline} =~ s/!myipfn!/$ipfn/g;
|
||||
}
|
||||
}
|
||||
|
||||
my $addkcmdline;
|
||||
if ($kern->{addkcmdline}) {
|
||||
$kern->{kcmdline} .= " ".$kern->{addkcmdline};
|
||||
$addkcmdline .= $kern->{addkcmdline}." ";
|
||||
}
|
||||
|
||||
if($linuximghash and $linuximghash->{'addkcmdline'})
|
||||
{
|
||||
unless($linuximghash->{'boottarget'})
|
||||
{
|
||||
$kern->{kcmdline} .= " ".$linuximghash->{'addkcmdline'};
|
||||
$addkcmdline .= $linuximghash->{'addkcmdline'}." ";
|
||||
}
|
||||
}
|
||||
|
||||
my $cmdhashref;
|
||||
if($addkcmdline){
|
||||
$cmdhashref=xCAT::Utils->splitkcmdline($addkcmdline);
|
||||
}
|
||||
|
||||
if($cmdhashref and $cmdhashref->{volatile})
|
||||
{
|
||||
$kern->{kcmdline}.=" ".$cmdhashref->{volatile};
|
||||
}
|
||||
|
||||
my $pcfg;
|
||||
unless (-d "$tftpdir/boot/grub2") {
|
||||
|
@ -108,6 +108,16 @@ sub setstate {
|
||||
|
||||
my $kcmdlinehack = ($imgaddkcmdline)?$kern->{addkcmdline}." ".$imgaddkcmdline : $kern->{addkcmdline};
|
||||
|
||||
my $cmdhashref;
|
||||
if($kcmdlinehack){
|
||||
$cmdhashref=xCAT::Utils->splitkcmdline($kcmdlinehack);
|
||||
}
|
||||
|
||||
if($cmdhashref and $cmdhashref->{volatile})
|
||||
{
|
||||
$kcmdlinehack=$cmdhashref->{volatile};
|
||||
}
|
||||
|
||||
|
||||
while ($kcmdlinehack =~ /#NODEATTRIB:([^:#]+):([^:#]+)#/) {
|
||||
my $natab = xCAT::Table->new($1);
|
||||
|
@ -119,6 +119,17 @@ sub setstate {
|
||||
|
||||
my $kcmdlinehack = ($imgaddkcmdline)?$kern->{addkcmdline}." ".$imgaddkcmdline : $kern->{addkcmdline};
|
||||
|
||||
my $cmdhashref;
|
||||
if($kcmdlinehack){
|
||||
$cmdhashref=xCAT::Utils->splitkcmdline($kcmdlinehack);
|
||||
}
|
||||
|
||||
if($cmdhashref and $cmdhashref->{volatile})
|
||||
{
|
||||
$kcmdlinehack=$cmdhashref->{volatile};
|
||||
}
|
||||
|
||||
|
||||
while ($kcmdlinehack =~ /#NODEATTRIB:([^:#]+):([^:#]+)#/) {
|
||||
my $natab = xCAT::Table->new($1);
|
||||
my $naent = $natab->getNodeAttribs($node,[$2]);
|
||||
|
@ -127,18 +127,32 @@ sub setstate {
|
||||
$kern->{kcmdline} =~ s/!myipfn!/$ipfn/g;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
my $addkcmdline;
|
||||
if ($kern->{addkcmdline}) {
|
||||
$kern->{kcmdline} .= " ".$kern->{addkcmdline};
|
||||
$addkcmdline .= $kern->{addkcmdline}." ";
|
||||
}
|
||||
|
||||
|
||||
if($linuximghash and $linuximghash->{'addkcmdline'})
|
||||
{
|
||||
unless($linuximghash->{'boottarget'})
|
||||
unless($linuximghash->{'boottarget'})
|
||||
{
|
||||
$kern->{kcmdline} .= " ".$linuximghash->{'addkcmdline'};
|
||||
}
|
||||
$addkcmdline .= $linuximghash->{'addkcmdline'}." ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
my $cmdhashref;
|
||||
if($addkcmdline){
|
||||
$cmdhashref=xCAT::Utils->splitkcmdline($addkcmdline);
|
||||
}
|
||||
|
||||
if($cmdhashref and $cmdhashref->{volatile})
|
||||
{
|
||||
$kern->{kcmdline}.=" ".$cmdhashref->{volatile};
|
||||
}
|
||||
|
||||
|
||||
my $pcfg;
|
||||
unless (-d "$tftpdir/etc") {
|
||||
|
@ -75,7 +75,7 @@ key --skip
|
||||
# --useLilo
|
||||
# --md5pass <crypted MD5 password for GRUB>
|
||||
#
|
||||
bootloader
|
||||
#KICKSTARTBOOTLOADER#
|
||||
|
||||
#
|
||||
# install or upgrade
|
||||
|
@ -76,7 +76,8 @@ clearpart --all --initlabel
|
||||
# --useLilo
|
||||
# --md5pass <crypted MD5 password for GRUB>
|
||||
#
|
||||
bootloader
|
||||
#KICKSTARTBOOTLOADER#
|
||||
|
||||
|
||||
#
|
||||
# install or upgrade
|
||||
|
@ -78,8 +78,7 @@ part / --size 1 --grow --fstype ext4 --ondisk sda
|
||||
# --useLilo
|
||||
# --md5pass <crypted MD5 password for GRUB>
|
||||
#
|
||||
bootloader
|
||||
|
||||
#KICKSTARTBOOTLOADER#
|
||||
#
|
||||
# install or upgrade
|
||||
#
|
||||
|
@ -74,8 +74,7 @@ key --skip
|
||||
# --useLilo
|
||||
# --md5pass <crypted MD5 password for GRUB>
|
||||
#
|
||||
bootloader
|
||||
|
||||
#KICKSTARTBOOTLOADER#
|
||||
#
|
||||
# install or upgrade
|
||||
#
|
||||
|
@ -76,8 +76,7 @@ clearpart --all --initlabel
|
||||
# --useLilo
|
||||
# --md5pass <crypted MD5 password for GRUB>
|
||||
#
|
||||
bootloader
|
||||
|
||||
#KICKSTARTBOOTLOADER#
|
||||
#
|
||||
# install or upgrade
|
||||
#
|
||||
|
@ -5,7 +5,7 @@
|
||||
<bootloader>
|
||||
<write_bootloader config:type="boolean">true</write_bootloader>
|
||||
<activate config:type="boolean">true</activate>
|
||||
<kernel_parameters></kernel_parameters>
|
||||
<kernel_parameters>#XCATVAR:PERSKCMDLINE#</kernel_parameters>
|
||||
<lba_support config:type="boolean">false</lba_support>
|
||||
<linear config:type="boolean">false</linear>
|
||||
<location>mbr</location>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<bootloader>
|
||||
<write_bootloader config:type="boolean">true</write_bootloader>
|
||||
<activate config:type="boolean">true</activate>
|
||||
<kernel_parameters></kernel_parameters>
|
||||
<kernel_parameters>#XCATVAR:PERSKCMDLINE#</kernel_parameters>
|
||||
<lba_support config:type="boolean">false</lba_support>
|
||||
<linear config:type="boolean">false</linear>
|
||||
<location>mbr</location>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<bootloader>
|
||||
<write_bootloader config:type="boolean">true</write_bootloader>
|
||||
<activate config:type="boolean">true</activate>
|
||||
<kernel_parameters></kernel_parameters>
|
||||
<kernel_parameters>#XCATVAR:PERSKCMDLINE#</kernel_parameters>
|
||||
<lba_support config:type="boolean">false</lba_support>
|
||||
<linear config:type="boolean">false</linear>
|
||||
<location>mbr</location>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<bootloader>
|
||||
<write_bootloader config:type="boolean">true</write_bootloader>
|
||||
<activate config:type="boolean">true</activate>
|
||||
<kernel_parameters></kernel_parameters>
|
||||
<kernel_parameters>#XCATVAR:PERSKCMDLINE#</kernel_parameters>
|
||||
<lba_support config:type="boolean">false</lba_support>
|
||||
<linear config:type="boolean">false</linear>
|
||||
<location>mbr</location>
|
||||
|
@ -24,6 +24,11 @@ d-i netcfg/dhcp_timeout string 120
|
||||
#d-i mirror/udeb/suite string testing
|
||||
|
||||
|
||||
# Use the following option to add additional boot parameters for the
|
||||
# installed system (if supported by the bootloader installer).
|
||||
# Note: options passed to the installer will be added automatically.
|
||||
d-i debian-installer/add-kernel-opts string #XCATVAR:PERSKCMDLINE#
|
||||
|
||||
### Partitioning
|
||||
# This creates a small /boot partition, suitable
|
||||
# swap, and uses the rest of the space for the root partition:
|
||||
|
@ -22,7 +22,11 @@ d-i netcfg/dhcp_timeout string 120
|
||||
#d-i mirror/suite string testing
|
||||
# Suite to use for loading installer components (optional).
|
||||
#d-i mirror/udeb/suite string testing
|
||||
|
||||
|
||||
# Use the following option to add additional boot parameters for the
|
||||
# installed system (if supported by the bootloader installer).
|
||||
# Note: options passed to the installer will be added automatically.
|
||||
d-i debian-installer/add-kernel-opts string #XCATVAR:PERSKCMDLINE#
|
||||
|
||||
### Partitioning
|
||||
# This creates a small /boot partition, suitable
|
||||
|
Loading…
Reference in New Issue
Block a user