Skip to content

Commit 2c2ce59

Browse files
author
Shikha Jhala
committed
CNV-24949: Added procedure for real-time checkup
1 parent cec5669 commit 2c2ce59

5 files changed

+435
-5
lines changed
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt//support/monitoring/virt-running-cluster-checkups.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="virt-building-real-time-container-disk-image_{context}"]
7+
= Building a container disk image for {op-system-base} virtual machines
8+
9+
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.
10+
11+
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.
12+
13+
.Prerequisites
14+
* 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.
15+
* You have installed the image builder tool and its CLI (`composer-cli`) on the VM.
16+
17+
* You have installed the `virt-customize` tool by using the following command:
18+
+
19+
[source,terminal]
20+
----
21+
# dnf install libguestfs-tools
22+
----
23+
* You have installed the Podman CLI tool (`podman`).
24+
25+
.Procedure
26+
27+
. Verify that you can build a {op-system-base} 8.7 image:
28+
+
29+
[source,terminal]
30+
----
31+
# composer-cli distros list
32+
----
33+
+
34+
[NOTE]
35+
====
36+
To run the `composer-cli` commands as non-root, add your user to the `weldr` or `root` groups:
37+
38+
[source,terminal]
39+
----
40+
# usermod -a -G weldr user
41+
----
42+
[source,terminal]
43+
----
44+
$ newgrp weldr
45+
----
46+
====
47+
48+
. 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:
49+
+
50+
[source,terminal]
51+
----
52+
$ cat << EOF > real-time-vm.toml
53+
name = "realtime_image"
54+
description = "Image to use with the real-time checkup"
55+
version = "0.0.1"
56+
distro = "rhel-87"
57+
58+
[[customizations.user]]
59+
name = "root"
60+
password = "redhat"
61+
62+
[[packages]]
63+
name = "real-time"
64+
65+
[[packages]]
66+
name = "real-time-tools"
67+
68+
[[packages]]
69+
name = "driverctl"
70+
71+
[[packages]]
72+
name = "tuned-profiles-cpu-partitioning"
73+
74+
[customizations.kernel]
75+
append = "default_hugepagesz=1GB hugepagesz=1G hugepages=1"
76+
77+
[customizations.services]
78+
disabled = ["NetworkManager-wait-online", "sshd"]
79+
EOF
80+
----
81+
82+
. Push the blueprint file to the image builder tool by running the following command:
83+
+
84+
[source,terminal]
85+
----
86+
# composer-cli blueprints push realtime-vm.toml
87+
----
88+
89+
. 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.
90+
+
91+
[source,terminal]
92+
----
93+
# composer-cli compose start realtime_image qcow2
94+
----
95+
96+
. Wait for the compose process to complete. The compose status must show `FINISHED` before you can continue to the next step.
97+
+
98+
[source,terminal]
99+
----
100+
# composer-cli compose status
101+
----
102+
103+
. Enter the following command to download the `qcow2` image file by specifying its UUID:
104+
+
105+
[source,terminal]
106+
----
107+
# composer-cli compose image <UUID>
108+
----
109+
110+
. Create the customization scripts by running the following commands:
111+
+
112+
[source,terminal]
113+
----
114+
$ cat <<EOF >customize-vm
115+
#!/bin/bash
116+
117+
# Setup hugepages mount
118+
mkdir -p /mnt/huge
119+
echo "hugetlbfs /mnt/huge hugetlbfs defaults,pagesize=1GB 0 0" >> /etc/fstab
120+
121+
# Create vfio-noiommu.conf
122+
echo "options vfio enable_unsafe_noiommu_mode=1" > /etc/modprobe.d/vfio-noiommu.conf
123+
124+
# Enable guest-exec,guest-exec-status on the qemu-guest-agent configuration
125+
sed -i '/^BLACKLIST_RPC=/ { s/guest-exec-status//; s/guest-exec//g }' /etc/sysconfig/qemu-ga
126+
sed -i '/^BLACKLIST_RPC=/ { s/,\+/,/g; s/^,\|,$//g }' /etc/sysconfig/qemu-ga
127+
EOF
128+
----
129+
130+
. Use the `virt-customize` tool to customize the image generated by the image builder tool:
131+
+
132+
[source,terminal]
133+
----
134+
$ virt-customize -a <UUID>-disk.qcow2 --run=customize-vm --selinux-relabel
135+
----
136+
137+
. To create a Dockerfile that contains all the commands to build the container disk image, enter the following command:
138+
+
139+
[source,terminal]
140+
----
141+
$ cat << EOF > Dockerfile
142+
FROM scratch
143+
COPY --chown=107:107 <UUID>-disk.qcow2 /disk/
144+
EOF
145+
----
146+
+
147+
where:
148+
149+
<UUID>-disk.qcow2:: Specifies the name of the custom image in `qcow2` format.
150+
151+
. Build and tag the container by running the following command:
152+
+
153+
[source,terminal]
154+
----
155+
$ podman build . -t real-time-rhel:latest
156+
----
157+
158+
. Push the container disk image to a registry that is accessible from your cluster by running the following command:
159+
+
160+
[source,terminal]
161+
----
162+
$ podman push real-time-rhel:latest
163+
----
164+
165+
. Provide a link to the container disk image in the `spec.param.vmUnderTestContainerDiskImage` attribute in the real-time checkup config map.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/monitoring/virt-running-cluster-checkups.adoc
4+
5+
:_mod-docs-content-type: REFERENCE
6+
[id="virt-real-time-config-map-parameters_{context}"]
7+
= Real-time checkup config map parameters
8+
9+
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:
10+
11+
.Real-time checkup config map input parameters
12+
[cols="1,1,1", options="header"]
13+
|====
14+
|Parameter
15+
|Description
16+
|Is Mandatory
17+
18+
|`spec.timeout`
19+
|The time, in hours and minutes, before the checkup fails. For example, `2h10m`.
20+
|True
21+
22+
|`spec.param.vmUnderTestContainerDiskImage`
23+
|The container disk image for the VM under test.
24+
|True
25+
26+
|`spec.param.vmUnderTestTargetNodeName`
27+
|The node on which the VM under test is to be scheduled. The node should be configured to allow real-time traffic.
28+
|False
29+
30+
|`spec.param.oslatDuration`
31+
|The duration for which the OS level thread latency test program runs. The default value is 5 minutes.
32+
|False
33+
34+
|`spec.param.oslatLatencyThresholdMicroSeconds`
35+
|The maximum latency value, in micro seconds, after which the checkup fails. The default value is `40`.
36+
|False
37+
|====

0 commit comments

Comments
 (0)