The Image Management Service (IMS) is typically used to build images from IMS recipes and customize Images that are already known to IMS. However, it is sometimes the case that an image is built using a mechanism other than by IMS and needs to be added to IMS. In these cases, the following procedure can be used to add this external image to IMS and upload the image’s artifacts to the Simple Storage Service (S3).
An automated tool is available to help the specific case of starting with image artifacts for a Non-Compute Node (NCN) that are not yet in S3 or IMS. For more information, see Import an NCN Image to IMS.
initrd
, and kernel parameters file.root
user..txz
compressed format need to be converted to SquashFS in order to use IMS image customization.This procedure may be run on any master or worker NCN.
The procedure on this page uses example commands that assume the image has an associated kernel and initrd
artifact. This is the case,
for example, for NCN boot images. If the actual set of image artifacts differs from this, then be sure to modify the commands accordingly.
Ensure that the image root is in a supported format.
IMS requires that an image’s root filesystem is in SquashFS format. Select one of the following options based on the current state of the image root being used:
tgz
format, then refer to Convert TGZ Archives to SquashFS Images.tgz
or SquashFS, then convert the image root to tgz
/SquashFS before continuing.Set variables for all of the image artifact files, if needed. For example, IMS_ROOTFS_FILENAME
, IMS_INITRD_FILENAME
, and IMS_KERNEL_FILENAME
.
If this procedure is being done as part of Management Node Image Customization, then these should already be set. In this case, skip this section and proceed to Record artifact checksums.
(ncn-mw#
) Set the IMS_ROOTFS_FILENAME
variable to the file name of the SquashFS image root file to be uploaded.
For example:
IMS_ROOTFS_FILENAME=sles_15_image.squashfs
(ncn-mw#
) Set the IMS_INITRD_FILENAME
variable to the file name of the initrd
file to be uploaded.
Skip this if no
initrd
file is associated with this image.
For example:
IMS_INITRD_FILENAME=initrd
(ncn-mw#
) Set the IMS_KERNEL_FILENAME
variable to the file name of the kernel file to be uploaded.
Skip this if no kernel file is associated with this image.
For example:
IMS_KERNEL_FILENAME=vmlinuz
Navigate to the directory containing the artifact files.
(ncn-mw#
) Verify that all image artifacts exist in the current working directory.
If necessary, modify the following command to reflect the actual set of artifacts included in the image.
ls -al "${IMS_ROOTFS_FILENAME}" "${IMS_INITRD_FILENAME}" "${IMS_KERNEL_FILENAME}"
(ncn-mw#
) Record the checksums of all of the artifacts.
Record the SquashFS image root checksum in the IMS_ROOTFS_MD5SUM
variable.
IMS_ROOTFS_MD5SUM=$(md5sum "${IMS_ROOTFS_FILENAME}" | awk '{ print $1 }')
echo "${IMS_ROOTFS_MD5SUM}"
Record the initrd
checksum in the IMS_INITRD_MD5SUM
variable.
Skip this if no
initrd
file is associated with this image.
IMS_INITRD_MD5SUM=$(md5sum "${IMS_INITRD_FILENAME}" | awk '{ print $1 }')
echo "${IMS_INITRD_MD5SUM}"
Record the kernel checksum in the IMS_KERNEL_MD5SUM
variable.
Skip this if no kernel file is associated with this image.
IMS_KERNEL_MD5SUM=$(md5sum "${IMS_KERNEL_FILENAME}" | awk '{ print $1 }')
echo "${IMS_KERNEL_MD5SUM}"
(ncn-mw#
) Create a new IMS image record for the image.
cray ims images create --name "${IMS_ROOTFS_FILENAME}" --format toml
Example output:
created = "2018-12-04T17:25:52.482514+00:00"
id = "4e78488d-4d92-4675-9d83-97adfc17cb19"
name = "sles_15_image.squashfs"
(ncn-mw#
) Create an environment variable for the ID of the new IMS image record.
Set the IMS_IMAGE_ID
variable, using the id
field value from the returned data in the previous step.
IMS_IMAGE_ID=4e78488d-4d92-4675-9d83-97adfc17cb19
If this procedure is being done as part of Management Node Image Customization, then these artifacts should already exist in S3. In this case, skip this section and proceed to Create image manifest file and upload to S3.
Navigate to the directory containing the artifact files.
(ncn-mw#
) Verify that all image artifacts exist in the current working directory.
If necessary, modify the following command to reflect the actual set of artifacts included in the image.
ls -al "${IMS_ROOTFS_FILENAME}" "${IMS_INITRD_FILENAME}" "${IMS_KERNEL_FILENAME}"
(ncn-mw#
) Upload the artifacts to S3.
Upload the SquashFS image root to S3.
cray artifacts create boot-images "${IMS_IMAGE_ID}/${IMS_ROOTFS_FILENAME}" "${IMS_ROOTFS_FILENAME}"
Upload the kernel to S3.
cray artifacts create boot-images "${IMS_IMAGE_ID}/${IMS_KERNEL_FILENAME}" "${IMS_KERNEL_FILENAME}"
Upload the initrd
to S3.
cray artifacts create boot-images "${IMS_IMAGE_ID}/${IMS_INITRD_FILENAME}" "${IMS_INITRD_FILENAME}"
HPE Cray uses a manifest file that associates multiple related boot artifacts (kernel, initrd
, image root, etc.) into
an image description that is used by IMS and other services to boot nodes. Artifacts listed within the manifest are
identified by a type
value:
application/vnd.cray.image.rootfs.squashfs
application/vnd.cray.image.initrd
application/vnd.cray.image.kernel
application/vnd.cray.image.parameters.boot
(ncn-mw#
) Generate an image manifest file.
If necessary, modify the following example to reflect the actual set of artifacts included in the image.
Note that the following command makes use of several variables that have been set during this procedure. The command must be run from the Bash shell in order for them to be properly evaluated.
cat <<EOF> manifest.json
{
"created": "`date '+%Y-%m-%d %H:%M:%S'`",
"version": "1.0",
"artifacts": [
{
"link": {
"path": "s3://boot-images/${IMS_IMAGE_ID}/${IMS_ROOTFS_FILENAME}",
"type": "s3"
},
"md5": "${IMS_ROOTFS_MD5SUM}",
"type": "application/vnd.cray.image.rootfs.squashfs"
},
{
"link": {
"path": "s3://boot-images/${IMS_IMAGE_ID}/${IMS_KERNEL_FILENAME}",
"type": "s3"
},
"md5": "${IMS_KERNEL_MD5SUM}",
"type": "application/vnd.cray.image.kernel"
},
{
"link": {
"path": "s3://boot-images/${IMS_IMAGE_ID}/${IMS_INITRD_FILENAME}",
"type": "s3"
},
"md5": "${IMS_INITRD_MD5SUM}",
"type": "application/vnd.cray.image.initrd"
}
]
}
EOF
(ncn-mw#
) Upload the manifest to S3.
cray artifacts create boot-images "${IMS_IMAGE_ID}/manifest.json" manifest.json
(ncn-mw#
) Update the IMS image record with the image manifest information.
cray ims images update "${IMS_IMAGE_ID}" \
--link-type s3 \
--link-path "s3://boot-images/${IMS_IMAGE_ID}/manifest.json" \
--format toml
Example output:
created = "2018-12-04T17:25:52.482514+00:00"
id = "4e78488d-4d92-4675-9d83-97adfc17cb19"
name = "sles_15_image.squashfs"
[link]
type = "s3"
path = "s3://boot-images/4e78488d-4d92-4675-9d83-97adfc17cb19/manifest.json"
etag = ""