2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-12 00:00:12 +00:00

Enhancements to synclist (#5880)

This commit is contained in:
Mark Gurevich
2018-12-10 20:53:38 -05:00
committed by Bin Xu
parent c495973ee3
commit 5e5a4ac89d

View File

@ -6,7 +6,7 @@ The synclist file
.. _The_Format_of_synclist_file_label:
The Format of synclist file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~
The synclist file contains the configuration entries that specify where the files should be synced to. In the synclist file, each line is an entry which describes the location of the source files and the destination location of files on the target node.
The basic entry format looks like following: ::
@ -21,9 +21,9 @@ The ``path_of_dst_file*`` should be the full path of the destination file on tar
The ``path_of_dst_directory`` should be the full path of the destination directory. Make ``sure path_of_dst_directory`` is not a existing file on target node, otherwise, the file sync with ``updatenode -r /usr/bin/scp`` or ``xdcp -r /usr/bin/scp`` will fail.
Since the synclist file is for common purpose, the target node need not be configured in it.
If no target node is specified, the files will be synced to all nodes in the cluster. See "Support nodes in synclist file" below for how to specify a noderange.
Example: the following synclist formats are supported:
The following synclist formats are supported:
sync file **/etc/file2** to the file **/etc/file2** on the node (with same file name) ::
@ -52,9 +52,7 @@ sync all files in **/home/mikev** to directory **/home/mikev** on the node ::
Note: Don't try to sync files to the read only directory on the target node.
An example of synclist file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assume a user wants to sync files to a node as following, the corresponding entries should be added in a synclist file.
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sync the file **/etc/common_hosts** to the two places on the target node: put one to the **/etc/hosts**, the other to the **/tmp/etc/hosts**. Following configuration entries should be added ::
@ -80,7 +78,7 @@ Sample synclist file ::
/tmp/* -> /tmp/
/etc/testfile -> /etc/
If the above syncfile is performed by the **updatenode/xdcp** commands, or performed in a node installation process, the following files will exist on the target node with the following contents. ::
If the above syncfile is used by the **updatenode/xdcp** commands, or used in a node installation process, the following files will exist on the target node with the following contents. ::
/etc/hosts(It has the same content with /etc/common_hosts on the MN)
/tmp/etc/hosts(It has the same content with /etc/common_hosts on the MN)
@ -93,18 +91,18 @@ If the above syncfile is performed by the **updatenode/xdcp** commands, or perfo
Support nodes in synclist file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Note: From xCAT 2.9.2 on AIX and from xCAT 2.12 on Linux, xCAT support a new format for syncfile. The new format is ::
Starting with xCAT 2.9.2 on AIX and with xCAT 2.12 on Linux, xCAT supports a new format for syncfile. The new format is ::
file -> (noderange for permitted nodes) file
The noderange would have several format. Following examples show that /etc/hosts file is synced to the nodes which is specified before the file name ::
The noderange can have several formats. Following examples show that **/etc/hosts** file is synced to the nodes which are specified before the file name ::
/etc/hosts -> (node1,node2) /etc/hosts # The /etc/hosts file is synced to node1 and node2
/etc/hosts -> (node1-node4) /etc/hosts # The /etc/hosts file is synced to node1,node2,node3 and node4
/etc/hosts -> (node[1-4]) /etc/hosts # The /etc/hosts file is synced to node1, node2, node3 and node4
/etc/hosts -> (node1,node[2-3],node4) /etc/hosts # The /etc/hosts file is synced to node1, node2, node3 and node4
/etc/hosts -> (group1) /etc/hosts # The /etc/hosts file is synced to nodes in group1
/etc/hosts -> (group1,group2) /etc/hosts # The /etc/hosts file is synced to nodes in group1 and group2
/etc/hosts -> (group1,group2) /etc/hosts # The /etc/hosts file is synced to nodes in group1 and group2
postscript support
~~~~~~~~~~~~~~~~~~
@ -112,13 +110,19 @@ postscript support
Putting the filename.post in the **rsyncfile** to ``rsync`` to the node is required for hierarchical clusters. It is optional for non-hierarchical cluster.
Advanced synclist file features
''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''
After you define the files to rsync in the syncfile, you can add an **EXECUTEALWAYS** clause in the syncfile. The **EXECUTEALWAYS** clause will list all the postscripts you would always like to run after the files are sync'd, whether or not any file is actually updated. The files in this list must be added to the list of files to rsync, if hierarchical.
**EXECUTE**
For example, your rsyncfile may look like this.
.. note:: the path to the file to EXECUTE, is the location of the *.post file on the MN**. ::
The **EXECUTE** clause is used to list all the postscripts you would like to run after the files are sync'd, only if the file is updated. The files in this list must be added to the list of files to rsync. If noderange is used in the synclistfor the file listed in the **EXECUTE** clause, the script will only be exectuted on the nodes in that noderange.
**EXECUTEALWAYS**
The **EXECUTEALWAYS** clause is used to list all the postscripts you would like to run after the files are sync'd, whether or not any file is actually updated. The files in this list must be added to the list of files to rsync. If noderange is used in the synclist for the file listed in the **EXECUTEALWAYS** clause, the script will only be exectuted on the nodes in that noderange.
.. note:: The path to the file to EXECUTE or EXECUTEALWAYS, is the location of the file on the MN.
For example, your rsyncfile may look like this.::
/tmp/share/file2 -> /tmp/file2
/tmp/share/file2.post -> /tmp/file2.post (required for hierarchical clusters)
@ -126,7 +130,7 @@ For example, your rsyncfile may look like this.
/tmp/share/file3.post -> /tmp/file3.post (required for hierarchical clusters)
/tmp/myscript1 -> /tmp/myscript1
/tmp/myscript2 -> /tmp/myscript2
# the below are postscripts
# Postscripts
EXECUTE:
/tmp/share/file2.post
/tmp/share/file3.post
@ -136,7 +140,7 @@ For example, your rsyncfile may look like this.
If **/tmp/file2** is updated on the node in **/tmp/file2**, then **/tmp/file2**.post is automatically run on that node. If **/tmp/file3** is updated on the node in **/tmp/filex**, then **/tmp/file3**.post is automatically run on that node.
You can add an **APPEND** clause to your syncfile.
**APPEND**
The **APPEND** clause is used to append the contents of the input file to an existing file on the node. The file to be appended must already exist on the node and not be part of the synclist that contains the **APPEND** clause.
@ -147,7 +151,7 @@ For example, your synclist file may look like this: ::
/tmp/share/file3 -> /tmp/filex
/tmp/share/file3.post -> /tmp/file3.post
/tmp/myscript -> /tmp/myscript
# the below are postscripts
# Postscripts
EXECUTE:
/tmp/share/file2.post
/tmp/share/file3.post
@ -157,15 +161,13 @@ For example, your synclist file may look like this: ::
/etc/myappenddir/appendfile -> /etc/mysetup/setup
/etc/myappenddir/appendfile2 -> /etc/mysetup/setup2
When you use the **APPEND** clause, the file (left) of the arrow is appended to the file right of the arrow. In this example, **/etc/myappenddir/appendfile** is appended to **/etc/mysetup/setup** file, which must already exist on the node. The **/opt/xcat/share/xcat/scripts/xdcpappend.sh** is used to accomplish this.
When you use the **APPEND** clause, the source file to the left of the arrow is appended to the file to the right of the arrow. In this example, **/etc/myappenddir/appendfile** is appended to **/etc/mysetup/setup** file, which must already exist on the node. The **/opt/xcat/share/xcat/scripts/xdcpappend.sh** is used to accomplish this.
The script creates a backup of the original file on the node in the directory defined by the site table nodesyncfiledir attribute, which is **/var/xcat/node/syncfiles** by default. To update the original file when using the function, you need to rsync a new original file to the node, removed the old original from the **/var/xcat/node/syncfiles/org** directory. If you want to cleanup all the files for the append function on the node, you can use the ``xdsh -c`` flag. See man page for ``xdsh``.
The script creates a backup of the original file on the node in the directory defined by the site table `nodesyncfiledir` attribute, which is **/var/xcat/node/syncfiles** by default. To update the original file when using the function, you need to rsync a new original file to the node, removed the old original from the **/var/xcat/node/syncfiles/org** directory. If you want to cleanup all the files for the append function on the node, you can use ``xdsh -c`` flag. See man page for ``xdsh``.
.. note:: no order of execution may be assumed by the order that the **EXECUTE,EXECUTEALWAYS and APPEND** clause fall in the synclist file.
**MERGE** (supported on Linux only).
You can add an **MERGE** clause to your syncfile. This is only supported on Linux.
The **MERGE** clause is used to append the contents of the input file to either the **/etc/passwd**, **/etc/shadow** or **/etc/group** files. They are the only supported files. You must not put the **/etc/passwd**, **/etc/shadow**, **/etc/group** files in an **APPEND** clause if using a **MERGE** clause. For these three file you should use a **MERGE** clause. The **APPEND** will add the information to the end of the file. The **MERGE** will add or replace the information and insure that there are no duplicate entries in these files.
The **MERGE** clause is used to append the contents of the input file to either the **/etc/passwd**, **/etc/shadow** or **/etc/group** files. They are the only supported files. You must not put the **/etc/passwd**, **/etc/shadow**, **/etc/group** files in an **APPEND** clause if using a **MERGE** clause. For these three files you should use the **MERGE** clause. The **APPEND** will add the information to the end of the file. The **MERGE** will add or replace the information and insure that there are no duplicate entries in these files.
For example, your synclist file may look like this ::
@ -174,7 +176,7 @@ For example, your synclist file may look like this ::
/tmp/share/file3 -> /tmp/filex
/tmp/share/file3.post -> /tmp/file3.post
/tmp/myscript -> /tmp/myscript
# the below are postscripts
# Postscripts
EXECUTE:
/tmp/share/file2.post
/tmp/share/file3.post
@ -185,20 +187,21 @@ For example, your synclist file may look like this ::
/etc/mydir/mergeshadow -> /etc/shadow
/etc/mydir/mergegroup -> /etc/group
When you use the **MERGE** clause, the file (left) of the arrow is merged into the file right of the arrow. It will replace any common userid's found in those files and add new userids. The **/opt/xcat/share/xcat/scripts/xdcpmerge.sh** is used to accomplish this.
When you use the **MERGE** clause, the source file to the left of the arrow is merged into the file to the right of the arrow. It will replace any common userid's found in those files and add new userids. The **/opt/xcat/share/xcat/scripts/xdcpmerge.sh** is used to accomplish this.
.. note:: no order of execution may be assumed by the order that the **EXECUTE,EXECUTEALWAYS,APPEND and MERGE** clause fall in the synclist file.
.. note:: no order of execution may be assumed by the order of **EXECUTE, EXECUTEALWAYS, APPEND and MERGE** clauses in the synclist file.
.. _the_localtion_of_synclist_file_for_updatenode_label:
The location of synclist file for updatenode and install process
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In the installation process or updatenode process, xCAT needs to figure out the location of the synclist file automatically, so the synclist should be put into the specified place with the proper name.
In the installation process or **updatenode** process, xCAT needs to figure out the location of the synclist file automatically, so the synclist should be put into the specified place with the proper name.
If the provisioning method for the node is an osimage name, then the path to the synclist will be read from the osimage definition synclists attribute. You can display this information by running the following command, supplying your osimage name. ::
If the provisioning method for the node is an osimage name, then the path to the synclist will be read from the osimage definition `synclists` attribute. You can display this information by running the following command, supplying your osimage name. ::
lsdef -t osimage -l <os>-<arch>-netboot-compute
Object name: <os>-<arch>-netboot-compute
exlist=/opt/xcat/share/xcat/netboot/<os>/compute.exlist
imagetype=linux
@ -213,24 +216,25 @@ If the provisioning method for the node is an osimage name, then the path to the
rootimgdir=/install/netboot/<os>/<arch>/compute
**synclists=/install/custom/netboot/compute.synclist**
You can set the synclist path using the following command ::
You can set the `synclist` path using the following command ::
chdef -t osimage -o <os>-<arch>-netboot-compute synclists="/install/custom/netboot/compute.synclist
If the provisioning method for the node is install,or netboot then the path to the synclist should be of the following format ::
If the provisioning method for the node is `install`, or `netboot` then the path to the synclist should be in the following format ::
/install/custom/<inst_type>/<distro>/<profile>.<os>.<arch>.synclist
<inst_type>: "install", "netboot"
<distro>: "rh", "centos", "fedora", "sles"
<profile>,<os>and <arch> are what you set for the node
<profile>, <os> and <arch> are what you set for the node
For example:
The location of synclist file for the diskful installation of <os> with 'compute' as the profile ::
The location of synclist file for the diskful installation of RedHat 7.5 with 'compute' as the profile ::
/install/custom/<inst_type>/<distro>/<profile>.<os>.synclist
/install/custom/install/rh/compute.rhels7.5.synclist
The location of synclist file for the diskless netboot of <os> with '<profile>' as the profile ::
The location of synclist file for the diskless netboot of SLES 12.3 with 'service' as the profile ::
/install/custom/<inst_type>/<distro>/<profile>.<os>.synclist
/install/custom/netboot/sles/service.sles12.3.synclist