Skip to content

Commit

Permalink
CNV-24949: Added procedure for real-time checkup
Browse files Browse the repository at this point in the history
  • Loading branch information
Shikha Jhala committed May 9, 2024
1 parent 4472181 commit 83961dc
Show file tree
Hide file tree
Showing 4 changed files with 433 additions and 4 deletions.
165 changes: 165 additions & 0 deletions modules/virt-building-real-time-container-disk-image.adoc
@@ -0,0 +1,165 @@
// Module included in the following assemblies:
//
// * virt//support/monitoring/virt-running-cluster-checkups.adoc

:_mod-docs-content-type: PROCEDURE
[id="virt-building-real-time-container-disk-image_{context}"]
= Building a container disk image for {op-system-base} virtual machines

You can build a custom {op-system-base-full} 8 OS image in `qcow2` format and use it to create a container disk image. You can store the container disk image in a registry that is accessible from your cluster and specify the image location in the `spec.param.vmUnderTestContainerDiskImage` attribute of the real-time checkup config map.

To build a container disk image, you must create an image builder virtual machine (VM). The _image builder VM_ is a {op-system-base} 8 VM that can be used to build custom {op-system-base} images.

.Prerequisites
* The image builder VM must run {op-system-base} 8.7 and must have a minimum of 2 CPU cores, 4 GiB RAM, and 20 GB of free space in the `/var` directory.
* You have installed the image builder tool and its CLI (`composer-cli`) on the VM.
* You have installed the `virt-customize` tool by using the following command:
+
[source,terminal]
----
# dnf install libguestfs-tools
----
* You have installed the Podman CLI tool (`podman`).
.Procedure

. Verify that you can build a {op-system-base} 8.7 image:
+
[source,terminal]
----
# composer-cli distros list
----
+
[NOTE]
====
To run the `composer-cli` commands as non-root, add your user to the `weldr` or `root` groups:
[source,terminal]
----
# usermod -a -G weldr user
----
[source,terminal]
----
$ newgrp weldr
----
====

. Enter the following command to create an image blueprint file in TOML format that contains the packages to be installed, kernel customizations, and the services to be disabled during boot time:
+
[source,terminal]
----
$ cat << EOF > real-time-vm.toml
name = "dpdk_image"
description = "Image to use with the real-time checkup"
version = "0.0.1"
distro = "rhel-87"

[[customizations.user]]
name = "root"
password = "redhat"

[[packages]]
name = "real-time"

[[packages]]
name = "real-time-tools"

[[packages]]
name = "driverctl"

[[packages]]
name = "tuned-profiles-cpu-partitioning"

[customizations.kernel]
append = "default_hugepagesz=1GB hugepagesz=1G hugepages=1"

[customizations.services]
disabled = ["NetworkManager-wait-online", "sshd"]
EOF
----

. Push the blueprint file to the image builder tool by running the following command:
+
[source,terminal]
----
# composer-cli blueprints push dpdk-vm.toml
----

. Generate the system image by specifying the blueprint name and output file format. The Universally Unique Identifier (UUID) of the image is displayed when you start the compose process.
+
[source,terminal]
----
# composer-cli compose start dpdk_image qcow2
----

. Wait for the compose process to complete. The compose status must show `FINISHED` before you can continue to the next step.
+
[source,terminal]
----
# composer-cli compose status
----

. Enter the following command to download the `qcow2` image file by specifying its UUID:
+
[source,terminal]
----
# composer-cli compose image <UUID>
----

. Create the customization scripts by running the following commands:
+
[source,terminal]
----
$ cat <<EOF >customize-vm
#!/bin/bash

# Setup hugepages mount
mkdir -p /mnt/huge
echo "hugetlbfs /mnt/huge hugetlbfs defaults,pagesize=1GB 0 0" >> /etc/fstab

# Create vfio-noiommu.conf
echo "options vfio enable_unsafe_noiommu_mode=1" > /etc/modprobe.d/vfio-noiommu.conf

# Enable guest-exec,guest-exec-status on the qemu-guest-agent configuration
sed -i '/^BLACKLIST_RPC=/ { s/guest-exec-status//; s/guest-exec//g }' /etc/sysconfig/qemu-ga
sed -i '/^BLACKLIST_RPC=/ { s/,\+/,/g; s/^,\|,$//g }' /etc/sysconfig/qemu-ga
EOF
----

. Use the `virt-customize` tool to customize the image generated by the image builder tool:
+
[source,terminal]
----
$ virt-customize -a <UUID>-disk.qcow2 --run=customize-vm --selinux-relabel
----

. To create a Dockerfile that contains all the commands to build the container disk image, enter the following command:
+
[source,terminal]
----
$ cat << EOF > Dockerfile
FROM scratch
COPY --chown=107:107 <UUID>-disk.qcow2 /disk/
EOF
----
+
where:

<UUID>-disk.qcow2:: Specifies the name of the custom image in `qcow2` format.

. Build and tag the container by running the following command:
+
[source,terminal]
----
$ podman build . -t real-time-rhel:latest
----

. Push the container disk image to a registry that is accessible from your cluster by running the following command:
+
[source,terminal]
----
$ podman push real-time-rhel:latest
----

. Provide a link to the container disk image in the `spec.param.vmUnderTestContainerDiskImage` attribute in the real-time checkup config map.
37 changes: 37 additions & 0 deletions modules/virt-real-time-config-map-parameters.adoc
@@ -0,0 +1,37 @@
// Module included in the following assemblies:
//
// * virt/monitoring/virt-running-cluster-checkups.adoc

:_mod-docs-content-type: REFERENCE
[id="virt-real-time-config-map-parameters_{context}"]
= Real-time checkup config map parameters

The following table shows the mandatory and optional parameters that you can set in the `data` stanza of the input `ConfigMap` manifest when you run a real-time checkup:

.Real-time checkup config map input parameters
[cols="1,1,1", options="header"]
|====
|Parameter
|Description
|Is Mandatory

|`spec.timeout`
|The time, in hours and minutes, before the checkup fails.
|True

|`spec.param.vmUnderTestContainerDiskImage`
|The container disk image for the VM under test.
|True

|`spec.param.vmUnderTestTargetNodeName`
|The node on which the VM under test is to be scheduled. The node should be configured to allow real-time traffic.
|False

|`spec.param.oslatDuration`
|The duration for which the OS level thread latency test program runs.
|False

|`spec.param.oslatLatencyThresholdMicroSeconds`
|The maximum latency value after which the checkup fails.
|False
|====

0 comments on commit 83961dc

Please sign in to comment.