Skip to main content

HPCM 1.9

Node provisioning and Image management

 

1) Dump the discover config file information for nodes
admin10:~ # discover --show-configfile --images --kernel --bmc-info --kernel-parameters --ips > discover-show.txt

2) Omit switch configuration steps during future discover commands
admin10:~ # cadmin --show-discover-skip-switchconfig (Should show 'yes')

3) List images
admin10:~ # cm image show
 

4) List nodes with their assigned images
admin10:~ # cm node show --image

5) Clone an image
admin10:~ # cm image copy --original-image kaust-cos-2.5.130-cpe_v5 --image kaust-cos-2.5.130-cpe_v5_mhk

6) Search for a package on node (Does not survive reboot)
admin10:~ # cm node zypper -n nid[00001] --repo-group kaust-cos-2.5.130-cpe search liboath0

7) Install a package on a node (Does not survive reboot)
admin10:~ # cm node zypper -n nid[00001] --repo-group kaust-cos-2.5.130-cpe install liboath0 

8) Search if a package is installed on an image or cloned image
admin10:~ # cm image zypper --image kaust-cos-2.5.130-cpe_v5_mhk --repo-group kaust-cos-2.5.130-cpe search fail2ban

9) Install a package to an image or cloned image
admin10:~ # cm image zypper --image kaust-cos-2.5.130-cpe_v5_mhk --repo-group kaust-cos-2.5.130-cpe install fail2ban

10) List the image of the node to test
admin10:~ # cm node show --image --nodes nid00001

11) Set the image to the cloned test image for the node
admin10:~ # cm node set --image kaust-cos-2.5.130-cpe_v5_mhk --nodes nid00001

12) Check power status for a node or group
admin10:~ # cm power status --nodes nid00001
admin10:~ # cm power status --nodes 'nid0000[1-2]'
admin10:~ # cm power status --type node 'nid0000[1-4]' --confirm

13) Shutdown a node
admin10:~ # cm power shutdown --nodes nid00001 --confirm

14) Power on a node
admin10:~ # cm power on --nodes nid00001 --confirm

15) Create a custom repo
All repos are in /opt/clmgr/repos 
admin10:~ # cm repo add --custom 'Site-packages' /opt/clmgr/repos/site-local/site-rpms
To add additonal rpms to the repo, copy the rpms to the custo repo directory and do a cm repo refresh for the custom repo to update repo metadata.

16) Applying image overrides:
You can specify that the cluster manager install additional files into an image during the post-install deployment process.
The path to include the overrides directory is /opt/clmgr/image/overrides/image_name/
 

17) Create a repo group
admin10:~ # cm repo group add [--repos list] group_name
 

18) Assign a repo group

The following command assigns repository groups to images for use by the cm node provision command: 
admin10:~ # cm image set -i image --repo-group group

The following command removes an assignment of a repository group to an image:
admin10:~ # cm image unset -i image --repo-group

The following example command displays repository groups and their assignments:
admin10:~ # cm image show --settings -i rhel8.X | grep repo-group
 

19) All package management should be done through the `cm [node|image] zypper` command.

It also needs to know what repositories to pull packages from.

  • To see your repositories run:

                `cm repo show`

  • To see repo groups (groups for repositories):

                `cm repo group show`

  • To see repos in a specific repo group:

                `cm repo group <group_name>`

  • For instance, I think there I created a repo group called kaust-cos-2.5.130-cpe:

                `cm repo group show kaust-cos-2.5.130-cpe`

                `cm node zypper -n ln\* --repo-group kaust-cos-2.5.130-cpe install fail2ban`

NOTE: this takes all the parameters that zypper does, so you can install multiple packages at a time etc.

  • To keep the corresponding image up to date (using version control, cloning the image etc.)

                `cm image zypper -i kaust-cos-2.5.130-cpe install fail2ban`

NOTE: you may want to assign the base image to a node to test, or add additional packages before commiting.

                `cm image revision commit -i kaust-cos-2.5.130-cpe -m “added fail2ban”`

                `cm image copy -i kaust-cos-2.5.130-cpe_v?? -o kaust-cos-2.5.130-cpe`

                `cm image activate -i kaust-cos-2.5.130-cpe_v??`

 

                `cm node set -i kaust-cos-2.5.130-cpe_v?? -n nid\*,ln\*`

20)Steps to create or copy images are
a. create or clone an image
b. install the packages into the cloned image
b. power off node to apply the image
c. activate the image (tell cm manager that image is suitable for clients e.g. cm image activate -i kaust-cos-2.5.130-cpe_v7)
d. Synchronise the image with the image on the SU leader nodes (su-sync-image image)
e. assign an image to a node and provision the node (transfer the image to the node i.e. pushes the new image, reboots and reprovision. 
e.g cm node provision -i kaust-cos-2.5.130-cpe_v5 -n nid00001)
 

21) Pre-post install scripts
You might have scripts that you want to run before or after an image is created or updated. The cluster manager can run these scripts for you if you install a new image on a node or if you update an existing node image.
The cluster manager runs the script in the package install environment with /proc, /sys, and other standard directories mounted.

  1. Log into the admin node as the root user.
  2. Create the script and write it to the image directory:

    The script name determines how the cluster manager handles the script, as follows:

    • If the script name starts with the slash (/) character, the cluster manager copies the script to /tmp in the image

      and runs the script from the /tmp directory.

    • If the script name starts with a character other than the slash (/) character, the cluster manager assumes that the script exists in the image. The cluster manager runs scripts named in this manner in a chroot environment relative to the root (/) directory.
  3. Run the cm image create command or the cm image update command.
    For the cm image create command or the cm image update command, you can run the script after

    image creation or after image update. Specify the script on the command line as follows:

    -p scriptname
    For the cm image create command, you can run the script after the image bootstraps, but before the packages

    in the list are added to the image. Specify the script on the command line as follows:

    -P scriptname
    Enter one of the following commands to display the complete syntax for the commands that accept the -p and -P

  4. script parameters:

22) Work in progress
1)Clone the image with:
# cm image copy --original-image kaust-cos-2.5.130-cpe_v6 --image kaust-cos-2.5.130-cpe_v7

2)Create custom repo and assigned it to a repo group
All repos are in /opt/clmgr/repos 
admin10:~ # cm repo add --custom 'Site-packages' /opt/clmgr/repos/site-local/site-rpms
To add additonal rpms to the repo, copy the rpms to the custo repo directory and do a cm repo refresh for the custom repo to update repo metadata.

a. Create a repo group
admin10:~ # cm repo group add [--repos list] group_name
b. Assign a repo group

The following command assigns repository groups to images for use by the cm node provision command: 
admin10:~ # cm image set -i image --repo-group group

The following command removes an assignment of a repository group to an image:
admin10:~ # cm image unset -i image --repo-group

The following example command displays repository groups and their assignments:
admin10:~ # cm image show --settings -i rhel8.X | grep repo-group

3)Install a package into the cloned image
# cm image zypper --image kaust-cos-2.5.130-cpe_v6 --repo-group ksl-login install fail2ban

 4)Sync the image
#su-sync-image kaust-cos-2.5.130-cpe_v7

5)Activate the image
# cm image activate -i kaust-cos-2.5.130-cpe_v7

6)Power off the node
#cm power shutdown -n ln2

7)Set the image
#cm node set -i kaust-cos-2.5.130-cpe_v7 -n ln2

8)Check & Set the node to install (optional as provision is supposed to do this for diskful)
# To check 'cm node show -I -n ln2' to set 'cinstallman --next-boot image -node ln2'

9)Provisioned the node
#cm node provision -i kaust-cos-2.5.130-cpe_v7 -n ln2
--
Additional useful commands & tips
1)To force an image to update on su-leaders, use 'cm image activate -i <IMAGE> –force'
2)Don’t forget to double check output of 'cm node show -I' to verify image pending is set to 'True'.
3)If needed, set the ‘IMAGE PENDING’ field in 'cm node show -I -n ln2' to true.
4)To set to 'True' use 'cinstallman --next-boot image -node ln2'
3)diskless: you just need to activate the image (activating should run su-sync-image for you IIRC) , then assign. 
A reboot will then pick up the new image.
4)diskful: activate image, then provision. Provision will set the image for you (if you do a `cm node provision -n node -i image) , 
set IMAGE PENDING to true, and reboot the node for you.
5)Note: You only really need to run su-sync-image if making changes to overrides/post-install scripts outside of an activate.
6)If bittorrent image hasn’t updated for any reason then run: 
#cinstallman --create-bt-tarball --image <IMAGE> to force it to be re-created, then provision.

9) Power on ln2