Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CNV-24949: Added procedure for real-time checkup #75211

Merged
merged 1 commit into from May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RamLavi @segevyos this part is a base for changes in a follow-up.
Please skip it.

//
// * 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.
sjhala-ccs marked this conversation as resolved.
Show resolved Hide resolved

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
sjhala-ccs marked this conversation as resolved.
Show resolved Hide resolved
----
* 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 = "realtime_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 realtime-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 realtime_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.
sjhala-ccs marked this conversation as resolved.
Show resolved Hide resolved

. 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. For example, `2h10m`.
|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. The default value is 5 minutes.
|False
sjhala-ccs marked this conversation as resolved.
Show resolved Hide resolved

|`spec.param.oslatLatencyThresholdMicroSeconds`
|The maximum latency value, in micro seconds, after which the checkup fails. The default value is `40`.
|False
|====