diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 55bd7405d..dd0962f13 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -232,6 +232,7 @@ sub mknetboot my $crashkernelsize; my $rootfstype; my $tftpdir; + my $cfgpart; if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{tftpdir}) { $tftpdir = $reshash->{$node}->[0]->{tftpdir}; } else { @@ -257,7 +258,7 @@ sub mknetboot if (!$linuximagetab) { $linuximagetab=xCAT::Table->new('linuximage', -create=>1); } - (my $ref1) = $linuximagetab->getAttribs({imagename => $imagename}, 'rootimgdir', 'nodebootif', 'dump', 'crashkernelsize'); + (my $ref1) = $linuximagetab->getAttribs({imagename => $imagename}, 'rootimgdir', 'nodebootif', 'dump', 'crashkernelsize', 'partitionfile'); if (($ref1) && ($ref1->{'rootimgdir'})) { $img_hash{$imagename}->{rootimgdir}=$ref1->{'rootimgdir'}; } @@ -272,6 +273,27 @@ sub mknetboot if (($ref1) && ($ref1->{'crashkernelsize'})) { $img_hash{$imagename}->{crashkernelsize} = $ref1->{'crashkernelsize'}; } + if ($ref1 && $ref1->{'partitionfile'}) { + # check the validity of the partition configuration file + if ($ref1->{'partitionfile'} =~ /^s:(.*)/) { + # the configuration file is a script + if (-r $1) { + $img_hash{$imagename}->{'cfgpart'} = "yes"; + } + } else { + if (open (FILE, "<$ref1->{'partitionfile'}")) { + while () { + if (/enable=yes/) { + $img_hash{$imagename}->{'cfgpart'} = "yes"; + last; + } + } + } + close (FILE); + } + + $img_hash{$imagename}->{'partfile'} = $ref1->{'partitionfile'}; + } } else { $callback->( {error => ["The os image $imagename does not exists on the osimage table for $node"], @@ -279,15 +301,14 @@ sub mknetboot next; } } - my $ph=$img_hash{$imagename}; + my $ph=$img_hash{$imagename}; - $osver = $ph->{osver}; - $arch = $ph->{osarch}; - $profile = $ph->{profile}; + $osver = $ph->{osver}; + $arch = $ph->{osarch}; + $profile = $ph->{profile}; $rootfstype = $ph->{rootfstype}; - - $rootimgdir=$ph->{rootimgdir}; + $rootimgdir=$ph->{rootimgdir}; unless ($rootimgdir) { $rootimgdir="$installroot/netboot/$osver/$arch/$profile"; } @@ -295,6 +316,7 @@ sub mknetboot $nodebootif = $ph->{nodebootif}; $crashkernelsize = $ph->{crashkernelsize}; $dump = $ph->{dump}; + $cfgpart = $ph->{'cfgpart'}; } else { $osver = $ent->{os}; @@ -331,13 +353,32 @@ sub mknetboot $linuximagetab = xCAT::Table->new('linuximage'); } if ( $linuximagetab ) { - (my $ref1) = $linuximagetab->getAttribs({imagename => $imgname}, 'dump', 'crashkernelsize'); + (my $ref1) = $linuximagetab->getAttribs({imagename => $imgname}, 'dump', 'crashkernelsize', 'partitionfile'); if($ref1 and $ref1->{'dump'}) { $dump = $ref1->{'dump'}; } if($ref1 and $ref1->{'crashkernelsize'}) { $crashkernelsize = $ref1->{'crashkernelsize'}; } + if($ref1 and $ref1->{'partitionfile'}) { + # check the validity of the partition configuration file + if ($ref1->{'partitionfile'} =~ /^s:(.*)/) { + # the configuration file is a script + if (-r $1) { + $cfgpart = "yes"; + } + } else { + if (-r $ref1->{'partitionfile'} && open (FILE, "<$ref1->{'partitionfile'}")) { + while () { + if (/enable=yes/) { + $cfgpart = "yes"; + last; + } + } + } + close (FILE); + } + } } else { $callback->( { error => [qq{ Cannot find the linux image called "$osver-$arch-$imgname-$profile", maybe you need to use the "nodeset osimage=" command to set the boot state}], @@ -756,6 +797,11 @@ sub mknetboot } } + # add the cmdline parameters for handling the local disk for stateless + if ($cfgpart eq "yes") { + $kcmdline .= " PARTITION"; + } + # add the addkcmdline attribute to the end # of the command, if it exists #my $addkcmd = $addkcmdhash->{$node}->[0]; diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index 5ec1ac2cb..92a707f00 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -111,64 +111,87 @@ sub mknetboot my $dump; #for kdump my $crashkernelsize; my $rootfstype; + my $cfgpart; - my $ent= $ntents->{$node}->[0]; + my $ent= $ntents->{$node}->[0]; if ($ent and $ent->{provmethod} and ($ent->{provmethod} ne 'install') and ($ent->{provmethod} ne 'netboot') and ($ent->{provmethod} ne 'statelite')) { - my $imagename=$ent->{provmethod}; - #print "imagename=$imagename\n"; - if (!exists($img_hash{$imagename})) { - if (!$osimagetab) { - $osimagetab=xCAT::Table->new('osimage', -create=>1); - } - (my $ref) = $osimagetab->getAttribs({imagename => $imagename}, 'osvers', 'osarch', 'profile', 'rootfstype', 'provmethod'); - if ($ref) { - $img_hash{$imagename}->{osver}=$ref->{'osvers'}; - $img_hash{$imagename}->{osarch}=$ref->{'osarch'}; - $img_hash{$imagename}->{profile}=$ref->{'profile'}; + my $imagename=$ent->{provmethod}; + #print "imagename=$imagename\n"; + if (!exists($img_hash{$imagename})) { + if (!$osimagetab) { + $osimagetab=xCAT::Table->new('osimage', -create=>1); + } + (my $ref) = $osimagetab->getAttribs({imagename => $imagename}, 'osvers', 'osarch', 'profile', 'rootfstype', 'provmethod'); + if ($ref) { + $img_hash{$imagename}->{osver}=$ref->{'osvers'}; + $img_hash{$imagename}->{osarch}=$ref->{'osarch'}; + $img_hash{$imagename}->{profile}=$ref->{'profile'}; $img_hash{$imagename}->{rootfstype}=$ref->{'rootfstype'}; - $img_hash{$imagename}->{provmethod}=$ref->{'provmethod'}; - if (!$linuximagetab) { - $linuximagetab=xCAT::Table->new('linuximage', -create=>1); - } - (my $ref1) = $linuximagetab->getAttribs({imagename => $imagename}, 'rootimgdir', 'nodebootif', 'dump', 'crashkernelsize'); - if (($ref1) && ($ref1->{'rootimgdir'})) { - $img_hash{$imagename}->{rootimgdir}=$ref1->{'rootimgdir'}; - } + $img_hash{$imagename}->{provmethod}=$ref->{'provmethod'}; + if (!$linuximagetab) { + $linuximagetab=xCAT::Table->new('linuximage', -create=>1); + } + (my $ref1) = $linuximagetab->getAttribs({imagename => $imagename}, 'rootimgdir', 'nodebootif', 'dump', 'crashkernelsize', 'partitionfile'); + if (($ref1) && ($ref1->{'rootimgdir'})) { + $img_hash{$imagename}->{rootimgdir}=$ref1->{'rootimgdir'}; + } if (($ref1) && ($ref1->{'nodebootif'})) { $img_hash{$imagename}->{nodebootif} = $ref1->{'nodebootif'}; } - if (($ref1) && ($ref1->{'dump'})){ - $img_hash{$imagename}->{dump} = $ref1->{'dump'}; - } - if (($ref1) && ($ref1->{'crashkernelsize'})) { + if (($ref1) && ($ref1->{'dump'})){ + $img_hash{$imagename}->{dump} = $ref1->{'dump'}; + } + if (($ref1) && ($ref1->{'crashkernelsize'})) { $img_hash{$imagename}->{crashkernelsize} = $ref1->{'crashkernelsize'}; } - } else { - $callback->( - {error => ["The os image $imagename does not exists on the osimage table for $node"], - errorcode => [1]}); - next; - } - } - my $ph=$img_hash{$imagename}; - $osver = $ph->{osver}; - $arch = $ph->{osarch}; - $profile = $ph->{profile}; + if ($ref1 && $ref1->{'partitionfile'}) { + # check the validity of the partition configuration file + if ($ref1->{'partitionfile'} =~ /^s:(.*)/) { + # the configuration file is a script + if (-r $1) { + $img_hash{$imagename}->{'cfgpart'} = "yes"; + } + } else { + if (open (FILE, "<$ref1->{'partitionfile'}")) { + while () { + if (/enable=yes/) { + $img_hash{$imagename}->{'cfgpart'} = "yes"; + last; + } + } + } + close (FILE); + } + + $img_hash{$imagename}->{'partfile'} = $ref1->{'partitionfile'}; + } + + } else { + $callback->( + {error => ["The os image $imagename does not exists on the osimage table for $node"], + errorcode => [1]}); + next; + } + } + my $ph=$img_hash{$imagename}; + $osver = $ph->{osver}; + $arch = $ph->{osarch}; + $profile = $ph->{profile}; $rootfstype = $ph->{rootfstype}; $nodebootif = $ph->{nodebootif}; - $provmethod = $ph->{provmethod}; - $dump = $ph->{dump}; - $crashkernelsize = $ph->{crashkernelsize}; - - $rootimgdir = $ph->{rootimgdir}; - unless ($rootimgdir) { - $rootimgdir = "$installroot/netboot/$osver/$arch/$profile"; - } - } - else { - $osver = $ent->{os}; - $arch = $ent->{arch}; - $profile = $ent->{profile}; + $provmethod = $ph->{provmethod}; + $dump = $ph->{dump}; + $crashkernelsize = $ph->{crashkernelsize}; + $cfgpart = $ph->{'cfgpart'}; + + $rootimgdir = $ph->{rootimgdir}; + unless ($rootimgdir) { + $rootimgdir = "$installroot/netboot/$osver/$arch/$profile"; + } + }else { + $osver = $ent->{os}; + $arch = $ent->{arch}; + $profile = $ent->{profile}; $rootfstype = "nfs"; # TODO: try to get it from the option or table my $imgname; if ($statelite) { @@ -193,26 +216,44 @@ sub mknetboot ); } - #get the dump path and kernel crash memory side for kdump on sles - if (!$linuximagetab){ - $linuximagetab = xCAT::Table->new('linuximage'); - } - if ($linuximagetab){ - (my $ref1) = $linuximagetab->getAttribs({imagename => $imgname}, 'dump', 'crashkernelsize'); - if ($ref1 && $ref1->{'dump'}){ - $dump = $ref1->{'dump'}; - } - if ($ref1 and $ref1->{'crashkernelsize'}){ - $crashkernelsize = $ref1->{'crashkernelsize'}; - } - } - else{ - $callback->( - { error => [qq{ Cannot find the linux image called "$osver-$arch-$imgname-$profile", maybe you need to use the "nodeset osimage=" command to set the boot state}], - errorcode => [1] } + #get the dump path and kernel crash memory side for kdump on sles + if (!$linuximagetab){ + $linuximagetab = xCAT::Table->new('linuximage'); + } + if ($linuximagetab){ + (my $ref1) = $linuximagetab->getAttribs({imagename => $imgname}, 'dump', 'crashkernelsize', 'partitionfile'); + if ($ref1 && $ref1->{'dump'}){ + $dump = $ref1->{'dump'}; + } + if ($ref1 and $ref1->{'crashkernelsize'}){ + $crashkernelsize = $ref1->{'crashkernelsize'}; + } + if($ref1 and $ref1->{'partitionfile'}) { + # check the validity of the partition configuration file + if ($ref1->{'partitionfile'} =~ /^s:(.*)/) { + # the configuration file is a script + if (-r $1) { + $cfgpart = "yes"; + } + } else { + if (-r $ref1->{'partitionfile'} && open (FILE, "<$ref1->{'partitionfile'}")) { + while () { + if (/enable=yes/) { + $cfgpart = "yes"; + last; + } + } + } + close (FILE); + } + } + } + else{ + $callback->( + { error => [qq{ Cannot find the linux image called "$osver-$arch-$imgname-$profile", maybe you need to use the "nodeset osimage=" command to set the boot state}], + errorcode => [1] } ); - } - + } $rootimgdir="$installroot/netboot/$osver/$arch/$profile"; } @@ -228,7 +269,7 @@ sub mknetboot } #print"osvr=$osver, arch=$arch, profile=$profile, imgdir=$rootimgdir\n"; - my $platform; + my $platform; if ($osver =~ /sles.*/) { $platform = "sles"; @@ -500,9 +541,7 @@ sub mknetboot } - if (defined $sent->{serialport}) - { - + if (defined $sent->{serialport}) { #my $sent = $hmtab->getNodeAttribs($node,['serialspeed','serialflow']); unless ($sent->{serialspeed}) { @@ -524,44 +563,46 @@ sub mknetboot } } - #create the kcmd for node to support kdump - if ($dump){ - if ($crashkernelsize){ - $kcmdline .= " crashkernel=$crashkernelsize dump=$dump "; - } - else{ - # for ppc64, the crashkernel paramter should be "128M@32M", otherwise, some kernel crashes will be met - if ($arch eq "ppc64"){ - $kcmdline .= " crashkernel=256M\@64M dump=$dump "; - } - if ($arch =~ /86/){ - $kcmdline .= " crashkernel=128M dump=$dump "; - } - } - } + #create the kcmd for node to support kdump + if ($dump){ + if ($crashkernelsize){ + $kcmdline .= " crashkernel=$crashkernelsize dump=$dump "; + } + else{ + # for ppc64, the crashkernel paramter should be "128M@32M", otherwise, some kernel crashes will be met + if ($arch eq "ppc64"){ + $kcmdline .= " crashkernel=256M\@64M dump=$dump "; + } + if ($arch =~ /86/){ + $kcmdline .= " crashkernel=128M dump=$dump "; + } + } + } + # add the cmdline parameters for handling the local disk for stateless + if ($cfgpart eq "yes") { + $kcmdline .= " PARTITION"; + } my $initrdstr = "xcat/netboot/$osver/$arch/$profile/initrd-stateless.gz"; $initrdstr = "xcat/netboot/$osver/$arch/$profile/initrd-statelite.gz" if ($statelite); - if($statelite) - { - my $statelitetb = xCAT::Table->new('statelite'); - my $mntopts = $statelitetb->getNodeAttribs($node, ['mntopts']); - - my $mntoptions = $mntopts->{'mntopts'}; - if(defined($mntoptions)) - { - $kcmdline .= "MNTOPTS=\'$mntoptions\'"; - } - } + if($statelite) + { + my $statelitetb = xCAT::Table->new('statelite'); + my $mntopts = $statelitetb->getNodeAttribs($node, ['mntopts']); + + my $mntoptions = $mntopts->{'mntopts'}; + if(defined($mntoptions)) { + $kcmdline .= "MNTOPTS=\'$mntoptions\'"; + } + } $bptab->setNodeAttribs( - $node, - { - kernel => "xcat/netboot/$osver/$arch/$profile/kernel", - initrd => $initrdstr, - kcmdline => $kcmdline - } - ); + $node, + { + kernel => "xcat/netboot/$osver/$arch/$profile/kernel", + initrd => $initrdstr, + kcmdline => $kcmdline + }); } } diff --git a/xCAT-server/lib/xcat/plugins/statelite.pm b/xCAT-server/lib/xcat/plugins/statelite.pm index f95ffbdff..88279db7e 100644 --- a/xCAT-server/lib/xcat/plugins/statelite.pm +++ b/xCAT-server/lib/xcat/plugins/statelite.pm @@ -21,6 +21,7 @@ Getopt::Long::Configure("pass_through"); my $cmdname = "liteimg"; my $statedir = ".statelite"; +my $lddir = ".sllocal"; my $verbose = "0"; sub handled_commands { return { @@ -269,6 +270,13 @@ sub process_request { # the directory/file in litefile table must be the absolute path ("/***") foreach my $entry (@$listNew) { my @tmp = split (/\s+/, $entry); + + # check the validity of the option + if ($tmp[1] !~ /^(tmpfs|persistent|localdisk|rw|link|tmpfs,rw|link,ro|link,persistent|link,con)$/) { + $callback->({error=>[qq{ $tmp[2] has invalid option. The valid options: tmpfs persistent localdisk rw link tmpfs,rw link,ro link,persistent link,con}], errorcode=>[1]}); + return; + } + unless ($tmp[2] =~ m{^/}) { $callback->({error=>[qq{ $tmp[2] is not one absolute path. }], errorcode=>[1]}); return; @@ -549,6 +557,12 @@ sub liteMe { xCAT::Utils->runcmd("mkdir -p $rootimg_dir/$statedir/tmpfs", 0, 1); } + # ceate the dir for local disk mount point + unless (-d "$rootimg_dir/$lddir") { + $callback->({info=>["creating $rootimg_dir/$lddir"]}); + xCAT::Utils->runcmd("mkdir -p $rootimg_dir/$lddir", 0, 1); + } + foreach my $line (keys %{$hashNewRef}) { liteItem($rootimg_dir, $line, 0, $callback); if($hashNewRef->{$line}) { # there're children diff --git a/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite b/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite index 83f86be42..4d39cda22 100755 --- a/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite +++ b/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite @@ -15,6 +15,7 @@ SYNCLIST="${MNTDIR}/$SL/litefile" # the list of files to sync TREEMOUNT="${MNTDIR}/$SL/mnt" # where I mount all the trees. TMPFS="${MNTDIR}/$SL/tmpfs" DEFAULT="${MNTDIR}/.default" +LOCAL="${MNTDIR}/.sllocal" LOG="${MNTDIR}/${SL}/statelite.log" ELIST=[] # entry list, each entry will contain the type and the path declare -a CLIST @@ -387,6 +388,33 @@ ProcessType () { /bin/mount --bind ${TMPFS}${2} ${MNTDIR}${ORIG}>>$LOG 2>&1 fi ;; + localdisk) + ORIG=`echo ${2} | /bin/sed -e 's/\/$//'` + TARGET=`echo ${1}` + + if [ ! -d ${LOCAL}${PPATH} ] && [ ! -L ${LOCAL}${PPATH} ]; then + /bin/mkdir -p ${LOCAL}${PPATH} + echo "mkdir -p ${LOCAL}${PPATH}" >>$LOG + fi + + # check it is a dir or file + if [ -d ${1} ]; then + if [ ! -d ${LOCAL}${2} ]; then + /bin/cp -r -a ${1} ${LOCAL}${PPATH} + echo "cp -r -a ${1} ${LOCAL}${PPATH}" >>$LOG + fi + else + if [ ! -f ${LOCAL}${2} ]; then + /bin/cp -r -a ${1} ${LOCAL}${2} + echo "cp -r -a ${1} ${LOCAL}${2}" >>$LOG + fi + fi + + if [ "$isChild" = "0" ]; then + echo "mount --bind ${LOCAL}${2} ${MNTDIR}${ORIG}" >>$LOG + /bin/mount --bind ${LOCAL}${2} ${MNTDIR}${ORIG}>>$LOG 2>&1 + fi + ;; rw) # the default option, same as "tmpfs" and "NULL" ORIG=`echo ${2} | /bin/sed -e 's/\/$//'` TARGET=`echo ${1}` diff --git a/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite.ppc.redhat b/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite.ppc.redhat index 297b7c211..f52b1f315 100755 --- a/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite.ppc.redhat +++ b/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite.ppc.redhat @@ -15,6 +15,7 @@ SYNCLIST="${MNTDIR}/$SL/litefile" # the list of files to sync TREEMOUNT="${MNTDIR}/$SL/mnt" # where I mount all the trees. TMPFS="${MNTDIR}/$SL/tmpfs" DEFAULT="${MNTDIR}/.default" +LOCAL="${MNTDIR}/.sllocal" LOG="${MNTDIR}/${SL}/statelite.log" ELIST=[] # entry list, each entry will contain the type and the path declare -a CLIST @@ -387,6 +388,33 @@ ProcessType () { /bin/mount --bind ${TMPFS}${2} ${MNTDIR}${ORIG}>>$LOG 2>&1 fi ;; + localdisk) + ORIG=`echo ${2} | /bin/sed -e 's/\/$//'` + TARGET=`echo ${1}` + + if [ ! -d ${LOCAL}${PPATH} ] && [ ! -L ${LOCAL}${PPATH} ]; then + /bin/mkdir -p ${LOCAL}${PPATH} + echo "mkdir -p ${LOCAL}${PPATH}" >>$LOG + fi + + # check it is a dir or file + if [ -d ${1} ]; then + if [ ! -d ${LOCAL}${2} ]; then + /bin/cp -r -a ${1} ${LOCAL}${PPATH} + echo "cp -r -a ${1} ${LOCAL}${PPATH}" >>$LOG + fi + else + if [ ! -f ${LOCAL}${2} ]; then + /bin/cp -r -a ${1} ${LOCAL}${2} + echo "cp -r -a ${1} ${LOCAL}${2}" >>$LOG + fi + fi + + if [ "$isChild" = "0" ]; then + echo "mount --bind ${LOCAL}${2} ${MNTDIR}${ORIG}" >>$LOG + /bin/mount --bind ${LOCAL}${2} ${MNTDIR}${ORIG}>>$LOG 2>&1 + fi + ;; rw) # the default option, same as "tmpfs" and "NULL" ORIG=`echo ${2} | /bin/sed -e 's/\/$//'` TARGET=`echo ${1}` diff --git a/xCAT-server/share/xcat/netboot/rh/dracut/install.netboot b/xCAT-server/share/xcat/netboot/rh/dracut/install.netboot index 6436b7302..e9beb2376 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut/install.netboot +++ b/xCAT-server/share/xcat/netboot/rh/dracut/install.netboot @@ -3,5 +3,6 @@ echo $drivers dracut_install wget cpio gzip dash modprobe touch echo cut wc dracut_install grep ifconfig hostname awk egrep grep dirname expr dracut_install mount.nfs +dracut_install parted mke2fs bc mkswap swapon chmod inst "$moddir/xcatroot" "/sbin/xcatroot" inst_hook cmdline 10 "$moddir/xcat-cmdline.sh" diff --git a/xCAT-server/share/xcat/netboot/rh/dracut/install.statelite b/xCAT-server/share/xcat/netboot/rh/dracut/install.statelite index 19e3f95b3..456fe5799 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut/install.statelite +++ b/xCAT-server/share/xcat/netboot/rh/dracut/install.statelite @@ -2,4 +2,5 @@ echo $drivers dracut_install wget cpio gzip dash modprobe wc touch echo cut dracut_install grep ifconfig hostname awk egrep grep dirname expr +dracut_install parted mke2fs bc mkswap swapon chmod inst_hook pre-pivot 5 "$moddir/xcat-prepivot.sh" diff --git a/xCAT-server/share/xcat/netboot/rh/dracut/xcat-prepivot.sh b/xCAT-server/share/xcat/netboot/rh/dracut/xcat-prepivot.sh index 5c6256df6..40ee23008 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut/xcat-prepivot.sh +++ b/xCAT-server/share/xcat/netboot/rh/dracut/xcat-prepivot.sh @@ -68,6 +68,8 @@ if [ ! -z $SNAPSHOTSERVER ]; then fi # TODO: handle the dhclient/resolv.conf/ntp, etc +echo "Get to enable localdisk" +$NEWROOT/etc/init.d/localdisk $NEWROOT/etc/init.d/statelite READONLY=yes export READONLY diff --git a/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot index 05cadab92..900cdad84 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot @@ -119,6 +119,7 @@ elif [ -r /rootimg-statelite.gz ]; then done fi + $NEWROOT/etc/init.d/localdisk $NEWROOT/etc/init.d/statelite fastboot=yes export fastboot diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 09fa0ab7f..9fce9b6c6 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -618,6 +618,7 @@ unless (-f "$cwd/../add-on/statelite/rc.statelite") { } system("cp $cwd/../add-on/statelite/rc.statelite $rootimg_dir/etc/init.d/statelite"); +system("cp $cwd/../add-on/statelite/rc.localdisk $rootimg_dir/etc/init.d/localdisk"); # also need to add this file: # may have already been made into a symbolic link, if so ignore it @@ -710,7 +711,9 @@ sub mkinitrd_dracut { chmod($perm&07777, "$dracutmpath/check"); foreach (@ndrivers) { s/\.ko$//; } - + # Add drivers to support local disk + push @ndrivers, "ext3"; + push @ndrivers, "ext4"; my $add_drivers = join(' ', @ndrivers); my $DRACUTCONF; diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 4a065ecb5..8aa157a5e 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -688,6 +688,7 @@ unless( -r "$pathtofiles/../add-on/statelite/rc.statelite") { exit; } system("cp $pathtofiles/../add-on/statelite/rc.statelite $rootimg_dir/etc/init.d/statelite"); +system("cp $pathtofiles/../add-on/statelite/rc.localdisk $rootimg_dir/etc/init.d/localdisk"); # the dhcp client information stores in the directory "/var/lib/dhcpcd/" unless(-l "$rootimg_dir/var/lib/dhcpcd") { @@ -730,6 +731,9 @@ if (@new_order) { @ndrivers = (@new_order, @ndrivers); } +# add drivers for local disk support +push @ndrivers, ("ext3.ko", "virtio_pci.ko", "virtio_blk.ko", "ata_piix.ko", "libata.ko", "scsi_mod.ko", "ibmvscsi.ko", "megaraid_sas.ko", "pcieport.ko", "scsi_mod.ko", "sd_mod.ko"); + open($moddeps,"<","$rootimg_dir/lib/modules/$kernelver/modules.dep"); my @moddeps = <$moddeps>; my @checkdeps = @ndrivers; @@ -941,6 +945,10 @@ EOS1 # Start udev print $inifile < /dev/null && shell @@ -1259,6 +1270,14 @@ sleep 5 EOMS print $inifile " exit\n"; print $inifile "fi\n"; + + # udevd needed by s390x for networking + # but for other type of machine, udevd will affect the start of devices which detected + # after the chroot, so kill it before the switching root + if ($arch ne "s390x") { + print $inifile "killall -9 udevd\n"; + } + print $inifile "cd /\n"; print $inifile "mkdir \$NEWROOT/var/lib/dhcpcd/\n"; #neccessary for SLES11, not sure for SLES10 print $inifile "cp /var/lib/dhcpcd/* \$NEWROOT/var/lib/dhcpcd/\n"; @@ -1293,7 +1312,7 @@ END } } if($mode eq "statelite") { - foreach ("sbin/ifconfig", "usr/bin/clear","usr/bin/touch","bin/hostname","usr/bin/egrep","bin/ln","bin/ls","usr/bin/dirname","usr/bin/expr","usr/bin/chroot","usr/bin/grep","bin/cpio","bin/sleep","bin/mount","bin/umount","sbin/dhcpcd","bin/bash","sbin/insmod","bin/mkdir","bin/mknod","sbin/ip","bin/cat","usr/bin/awk","usr/bin/wget","bin/cp","usr/bin/cpio","usr/bin/zcat","usr/bin/gzip","lib/mkinitrd/bin/run-init","usr/bin/uniq","usr/bin/sed","usr/bin/wc", "bin/sed","sbin/udevd", "usr/bin/readlink") { + foreach ("sbin/ifconfig", "usr/bin/clear","usr/bin/touch","bin/hostname","usr/bin/egrep","bin/ln","bin/ls","usr/bin/dirname","usr/bin/expr","usr/bin/chroot","usr/bin/grep","bin/cpio","bin/sleep","bin/mount","bin/umount","sbin/dhcpcd","bin/bash","sbin/insmod","bin/mkdir","bin/mknod","sbin/ip","bin/cat","usr/bin/awk","usr/bin/wget","bin/cp","usr/bin/cpio","usr/bin/zcat","usr/bin/gzip","lib/mkinitrd/bin/run-init","usr/bin/uniq","usr/bin/sed","usr/bin/wc", "bin/sed","sbin/udevd", "usr/bin/readlink", "usr/sbin/parted", "sbin/mke2fs", "sbin/mkswap", "sbin/swapon", "bin/chmod", "usr/bin/bc") { getlibs($_); push @filestoadd,$_; }