diff --git a/docs/source/guides/admin-guides/references/man5/linuximage.5.rst b/docs/source/guides/admin-guides/references/man5/linuximage.5.rst index e89b345d5..e49d27e55 100644 --- a/docs/source/guides/admin-guides/references/man5/linuximage.5.rst +++ b/docs/source/guides/admin-guides/references/man5/linuximage.5.rst @@ -96,6 +96,7 @@ linuximage Attributes: IMG_ARCH(The architecture of the osimage, such as "ppc64le","x86_64"), IMG_NAME(The name of the osimage, such as "rhels7.3-ppc64le-netboot-compute"), IMG_OSVER(The os release of the osimage, such as "rhels7.3","sles11.4"), + IMG_KERNELVERSION(the "kernelver" attribute of the osimage), IMG_PROFILE(the profile of the osimage, such as "service","compute"), IMG_PKGLIST(the "pkglist" attribute of the osimage), IMG_PKGDIR(the "pkgdir" attribute of the osimage), diff --git a/docs/source/guides/admin-guides/references/man7/osimage.7.rst b/docs/source/guides/admin-guides/references/man7/osimage.7.rst index 6c318a877..287d406b6 100644 --- a/docs/source/guides/admin-guides/references/man7/osimage.7.rst +++ b/docs/source/guides/admin-guides/references/man7/osimage.7.rst @@ -317,6 +317,7 @@ osimage Attributes: IMG_ARCH(The architecture of the osimage, such as "ppc64le","x86_64"), IMG_NAME(The name of the osimage, such as "rhels7.3-ppc64le-netboot-compute"), IMG_OSVER(The os release of the osimage, such as "rhels7.3","sles11.4"), + IMG_KERNELVERSION(the "kernelver" attribute of the osimage), IMG_PROFILE(the profile of the osimage, such as "service","compute"), IMG_PKGLIST(the "pkglist" attribute of the osimage), IMG_PKGDIR(the "pkgdir" attribute of the osimage), diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 91fbf6638..8572ca7fe 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -778,6 +778,7 @@ passed as argument rather than by table value', IMG_ARCH(The architecture of the osimage, such as "ppc64le","x86_64"), IMG_NAME(The name of the osimage, such as "rhels7.3-ppc64le-netboot-compute"), IMG_OSVER(The os release of the osimage, such as "rhels7.3","sles11.4"), + IMG_KERNELVERSION(the "kernelver" attribute of the osimage), IMG_PROFILE(the profile of the osimage, such as "service","compute"), IMG_PKGLIST(the "pkglist" attribute of the osimage), IMG_PKGDIR(the "pkgdir" attribute of the osimage), diff --git a/xCAT-server/share/xcat/ib/scripts/Mellanox/mlnxofed_ib_install.v2 b/xCAT-server/share/xcat/ib/scripts/Mellanox/mlnxofed_ib_install.v2 index 635afb2d4..dc4df9918 100755 --- a/xCAT-server/share/xcat/ib/scripts/Mellanox/mlnxofed_ib_install.v2 +++ b/xCAT-server/share/xcat/ib/scripts/Mellanox/mlnxofed_ib_install.v2 @@ -157,7 +157,11 @@ function hack_uname() echo "\$ARCH" ;; "-r") - cd /lib/modules && for d in * ; do : ; done && echo \$d + if [ -n "\$KERNELVERSION" ]; then + echo \$KERNELVERSION + else + for d in \$(ls /lib/modules | sort -V) ; do : ; done && echo \$d + fi ;; "-s"|"") echo "Linux" diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index c4fbe9e31..5dd7365b4 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -722,6 +722,7 @@ if ($postinstall_filename) { $ENV{IMG_NAME}=$imagename if("" ne $imagename); $ENV{IMG_ARCH}=$arch if("" ne $arch); $ENV{IMG_OSVER}=$osver if("" ne $osver); + $ENV{IMG_KERNELVERSION} = $kernelver if("" ne $kernelver); $ENV{IMG_PROFILE}=$profile if("" ne $profile); $ENV{IMG_PKGLIST}=$pkglist if("" ne $pkglist); $ENV{IMG_PKGDIR}=$srcdir if("" ne $srcdir); @@ -745,7 +746,7 @@ if ($postinstall_filename) { } #delete the osimage attributes from environment variable - delete @ENV{qw(IMG_ARCH IMG_NAME IMG_OSVER IMG_PROFILE IMG_PKGLIST IMG_PKGDIR IMG_OTHERPKGLIST IMG_OTHERPKGDIR IMG_ROOTIMGDIR)}; + delete @ENV{qw(IMG_ARCH IMG_NAME IMG_OSVER IMG_KERNELVERSION IMG_PROFILE IMG_PKGLIST IMG_PKGDIR IMG_OTHERPKGLIST IMG_OTHERPKGDIR IMG_ROOTIMGDIR)}; unuse_hackuname(); } diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 26799e72e..01884a946 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -729,6 +729,7 @@ EOS_UNAME $ENV{IMG_NAME}=$imagename if("" ne $imagename); $ENV{IMG_ARCH}=$arch if("" ne $arch); $ENV{IMG_OSVER}=$osver if("" ne $osver); + $ENV{IMG_KERNELVERSION} = $kernelver if("" ne $kernelver); $ENV{IMG_PROFILE}=$profile if("" ne $profile); $ENV{IMG_PKGLIST}=$pkglist if("" ne $pkglist); $ENV{IMG_PKGDIR}=$srcdir if("" ne $srcdir); @@ -749,7 +750,7 @@ EOS_UNAME } #delete the osimage attributes from environment variable - delete @ENV{qw(IMG_ARCH IMG_NAME IMG_OSVER IMG_PROFILE IMG_PKGLIST IMG_PKGDIR IMG_OTHERPKGLIST IMG_OTHERPKGDIR IMG_ROOTIMGDIR)}; + delete @ENV{qw(IMG_ARCH IMG_NAME IMG_OSVER IMG_KERNELVERSION IMG_PROFILE IMG_PKGLIST IMG_PKGDIR IMG_OTHERPKGLIST IMG_OTHERPKGDIR IMG_ROOTIMGDIR)}; # restore the orig uname system("mv $rootimg_dir/bin/orig_uname $rootimg_dir/bin/uname"); diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index 1e9ccf0e8..14ddf618c 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -622,6 +622,7 @@ if ($postinstall_filename) { $ENV{IMG_ARCH}=$arch if("" ne $arch); $ENV{IMG_NAME}=$imagename if("" ne $imagename); $ENV{IMG_OSVER}=$osver if("" ne $osver); + $ENV{IMG_KERNELVERSION} = $kernelver if("" ne $kernelver); $ENV{IMG_PROFILE}=$profile if("" ne $profile); $ENV{IMG_PKGLIST}=$pkglist if("" ne $pkglist); $ENV{IMG_PKGDIR}=$srcdir if("" ne $srcdir); @@ -642,7 +643,7 @@ if ($postinstall_filename) { } #delete the osimage attributes from environment variable - delete @ENV{qw(IMG_ARCH IMG_NAME IMG_OSVER IMG_PROFILE IMG_PKGLIST IMG_PKGDIR IMG_OTHERPKGLIST IMG_OTHERPKGDIR IMG_ROOTIMGDIR)}; + delete @ENV{qw(IMG_ARCH IMG_NAME IMG_OSVER IMG_KERNELVERSION IMG_PROFILE IMG_PKGLIST IMG_PKGDIR IMG_OTHERPKGLIST IMG_OTHERPKGDIR IMG_ROOTIMGDIR)}; }