2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-22 11:42:05 +00:00

Merge pull request #1050 from gurevichmark/diskless_doc

trim diskless root image doc formatting
This commit is contained in:
Victor Hu 2016-05-06 13:42:14 -04:00
commit 38631134e6

View File

@ -1,121 +1,73 @@
Trim diskless rootimg
=====================
To reduce the memory and boot-up time for the diskless node, the initrd and rootimg.gz should be kept as compact as possible under the premise of meeting the user's requirements.
the exclude list attribute: linuximage.exlist
----------------------------------------------
Exclude list
------------
To reduce the memory occupation and boot-up time for the diskless node, the initrd and rootimg.gz should be kept as compact as possible under the premise of meeting the user's requirements.
xCAT provides an **exclude list** attribute ``linuximage.exlist`` in the **osimage** object definition, which enables user to trim the rootimg on the diskless node after the rpms are installed into the rootimg directory by ``genimage`` on management node.
xCAT provides an attribute ``exlist`` in the **osimage** object definition, that allows the user to select files to exclude when building the ``rootimg.gz`` file for the diskless node.
Take the osimage **sles12.1-ppc64le-netboot-compute** for example::
# lsdef -t osimage -o sles12.1-ppc64le-netboot-compute
# lsdef -t osimage -o sles12.1-ppc64le-netboot-compute -i exlist
Object name: sles12.1-ppc64le-netboot-compute
exlist=/opt/xcat/share/xcat/netboot/sles/compute.sles12.ppc64le.exlist
imagetype=linux
osarch=ppc64le
osdistroname=sles12.1-ppc64le
osname=Linux
osvers=sles12.1
otherpkgdir=/install/post/otherpkgs/sles12.1/ppc64le
permission=755
pkgdir=/install/sles12.1/ppc64le
pkglist=/opt/xcat/share/xcat/netboot/sles/compute.sles12.ppc64le.pkglist
postinstall=/opt/xcat/share/xcat/netboot/sles/compute.sles12.ppc64le.postinstall
profile=compute
provmethod=netboot
rootimgdir=/install/netboot/sles12.1/ppc64le/compute
the content of exlist file
--------------------------
Content of the Exclude List file
--------------------------------
The file specified in ``linuximage.exlist`` includes **relative path** of the directories and files that will be excluded from the **rootimg.gz** generated by ``packimage``. The **relative path** suppose the ``rootimg`` directory, ``/install/netboot/sles12.1/ppc64le/compute/rootimg`` here, to be the base directory. [1]_ [2]_
The file specified in ``linuximage.exlist`` includes **relative path** of the directories and files that will be excluded from the **rootimg.gz** generated by ``packimage``. The **relative path** assumes the ``rootimg`` directory, ``/install/netboot/sles12.1/ppc64le/compute/rootimg`` here, to be the base directory. [1]_
xCAT ships a default exlist file, user can add or remove entries based on it according to their need.
The following is a sample of ``exlist`` file ::
The content of the default exlist file ``/opt/xcat/share/xcat/netboot/sles/compute.sles12.ppc64le.exlist`` is: ::
# cat /opt/xcat/share/xcat/netboot/sles/compute.sles12.ppc64le.exlist
./boot*
./etc/bootsplash/themes/SLES/images*
./opt/sci/include*
./usr/include*
./usr/lib/locale*
./usr/lib/perl[0-9]/[0-9.]*/ppc64le-linux-thread-multi/auto/Encode/CN*
./usr/lib/perl[0-9]/[0-9.]*/ppc64le-linux-thread-multi/auto/Encode/JP*
./usr/lib/perl[0-9]/[0-9.]*/ppc64le-linux-thread-multi/auto/Encode/TW*
./usr/lib/perl[0-9]/[0-9.]*/ppc64le-linux-thread-multi/auto/Encode/KR*
./usr/lib/perl[0-9]/[0-9.]*/ppc64le-linux-thread-multi/Encode/CN*
./usr/lib/perl[0-9]/[0-9.]*/ppc64le-linux-thread-multi/Encode/JP*
./usr/lib/perl[0-9]/[0-9.]*/ppc64le-linux-thread-multi/Encode/KR*
./usr/lib/perl[0-9]/[0-9.]*/ppc64le-linux-thread-multi/Encode/TW*
./usr/lib64/gcc/powerpc64le-suse-linux/4.8/include*
./usr/local/include*
./usr/local/man*
./usr/powerpc64le-suse-linux/include*
...
./usr/share/X11/locale/*
+./usr/share/X11/locale/en_US.UTF-8*
./usr/lib/perl[0-9]/[0-9.]*/ppc64le-linux-thread-multi/Encode/JP*
+./usr/share/X11/locale/C*
./usr/share/cracklib*
./usr/share/doc*
./usr/share/doc/packages/cyrus-sasl/doc*
./usr/share/gnome*
./usr/share/i18n*
./usr/share/info*
./usr/share/locale/*
+./usr/share/locale/en_US*
+./usr/share/locale/C*
./usr/share/man*
./usr/share/omf*
./usr/share/vim/site/doc*
./usr/share/vim/vim[0-9]*/doc*
./var/cache/man*
./var/cache/zypp*
...
The content above presents some syntax supported in exlist file:
* exclude entry::
* Exclude files::
./usr/share/X11/locale/*
./usr/share/X11/locale/*
all the files and subdirectories under ``rootimg/usr/share/X11/locale/`` will be excluded.
All the files and subdirectories under ``rootimg/usr/share/X11/locale/`` will be excluded.
* include entry::
..
+./usr/share/locale/C*
* Exclude Files using Patterns [2]_::
all the files and subdirectories with the name matching pattern ``C*`` under ``/usr/share/locale/`` will be included in the **rootimg.gz**, it is quite useful to use ``+`` initialed entries following an exclude entry to include some specific files or directories under the excluded parent directory.
./usr/lib/perl[0-9]/[0-9.]*/ppc64le-linux-thread-multi/Encode/JP*
* pattern of the file name and directory [3]_::
Use regular expression to easily exclude files. The above example will exclude any Perl library installed under ``/usr/lib/`` matching ``ppc64le-linux-thread-multi/Encode/JP*``
./usr/lib/perl[0-9]/[0-9.]*/ppc64le-linux-thread-multi/Encode/JP*
..
all the files and subdirectories matching the pattern ``./usr/lib/perl[0-9]/[0-9.]*/ppc64le-linux-thread-multi/Encode/JP*`` will be excluded, such as ::
* Include files::
./usr/lib/perl5/5.18.2/ppc64le-linux-thread-multi/Encode/JP
./usr/lib/perl5/5.18.2/ppc64le-linux-thread-multi/Encode/JP/H2Z.pm
./usr/lib/perl5/5.18.2/ppc64le-linux-thread-multi/Encode/JP/JIS7.pm
./usr/lib/perl5/5.18.2/ppc64le-linux-thread-multi/Encode/JP.pm
+./usr/share/locale/C*
It is useful to include files following an exclude entry to qiuckly remove a larger set of files using a wildcard and then adding back the few necessary files using the + sign. In the above example, all the files and sub-directories matching the pattern ``/usr/share/locale/C*`` will be included in the ``rootimg.gz`` file.
customize the exlist file and the osimage definition
----------------------------------------------------
Customize the ``exlist`` file and the osimage definition
--------------------------------------------------------
Please check the default exlist file and make sure:
Check the default exlist file and make sure:
* all files and directories you do not want in the image will be excluded from the rootimg.
* no file or directory you need will be excluded from the rootimg.
If you want to customize the osimage ``sles12.1-ppc64le-netboot-compute`` with your own exlist file, please follow the following steps: ::
If you want to customize the osimage ``sles12.1-ppc64le-netboot-compute`` with your own exlist file, follow the following steps: ::
#create a customized exlist file based on the default one
cp /opt/xcat/share/xcat/netboot/sles/compute.sles12.ppc64le.exlist /install/custom/netboot/sles/compute.sles12.ppc64le.exlist
cp /opt/xcat/share/xcat/netboot/sles/compute.sles12.ppc64le.exlist /install/custom/netboot/sles/compute.sles12.ppc64le.exlist
#edit the newly created exlist file according to your need
vi /install/custom/netboot/sles/compute.sles12.ppc64le.exlist
@ -123,8 +75,6 @@ If you want to customize the osimage ``sles12.1-ppc64le-netboot-compute`` with y
#specify the newly created exlist file in the osimage definition
chdef -t osimage -o sles12.1-ppc64le-netboot-compute exlist=/install/custom/netboot/sles/compute.sles12.ppc64le.exlist
.. [1] It would only make sense to use an absolute path name here. It means that this entry will never match anything: ``/usr/share/locale/*``.
.. [1] The ``exlist`` file entry should not end with a slash ``/``, For example, this entry will never match anything: ``./usr/lib/perl[0-9]/[0-9.]*/ppc64le-linux-thread-multi/Encode/``.
.. [2] The exlist file entry should not be ended with a slash ``/``, it means that this entry will never match anything: ``./usr/lib/perl[0-9]/[0-9.]*/ppc64le-linux-thread-multi/Encode/``.
.. [3] Pattern match test applies to the whole file name,starting from one of the start points specified in the exlist file entry. The regex syntax comply the with the regex syntax of system command ``find -path``, please refer to its doc for details.
.. [2] Pattern match test applies to the whole file name,starting from one of the start points specified in the ``exlist`` file entry. The regex syntax should comply with the regex syntax of system command ``find -path``, refer to its doc for details.