How to use workload partitioning with Red Hat OpenShift Container Platform

Learn how to use workload partitioning with Red Hat® OpenShift® Container Platform to benefit resource-constrained environments.

Learn how to use workload partitioning with Red Hat® OpenShift® Container Platform to benefit resource-constrained environments.

Testing workload isolation with a virtual machine

1 hr and 20 mins

We’ve seen how workload partitioning works on cluster nodes, but it can also be applied to virtual machines (VM). Now we can test with virtual machines managed by Red Hat OpenShift Virtualization.

What will you learn?

  • How virtual machines can use workload isolation

What you need before starting:

Create a virtual machine

Use the OpenShift console or virtctl to create a virtual machine with 4 CPU cores in a project/namespace.

A screenshot of Red Hat console showing a virtual machine created from the virtctl command.
A screenshot of Red Hat console showing a virtual machine created from the virtctl command.

Access the VM and run a stress test

Use virtctl to SSH into the VM and execute the stress-ng command.

# Download and install virtctl if you haven't already
wget --no-check-certificate https://hyperconverged-cluster-cli-download-openshift-cnv.apps.demo-01-rhsys.wzhlab.top/amd64/linux/virtctl.tar.gz
tar zvxf virtctl.tar.gz
mv virtctl ~/.local/bin/

# SSH into the VM and run the test
virtctl -n demo ssh user@vm-name --identity-file=~/.ssh/id_rsa
stress-ng --cpu 4 --cpu-load 100 --temp-path /tmp

Observe Host CPU usage

Checking top on the host node will again show that the QEMU process for the VM is consuming CPU cycles exclusively from the isolated cores (20-23).

# top output snippet
%Cpu19 :  1.7 us,  2.0 sy,  0.0 ni, 96.4 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu20 : 99.0 us,  0.3 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.7 hi,  0.0 si,  0.0 st
%Cpu21 : 96.7 us,  0.3 sy,  0.0 ni,  0.0 id,  0.0 wa,  1.0 hi,  2.0 si,  0.0 st
%Cpu22 : 98.7 us,  0.3 sy,  0.0 ni,  0.0 id,  0.0 wa,  1.0 hi,  0.0 si,  0.0 st
%Cpu23 : 99.0 us,  0.7 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.3 hi,  0.0 si,  0.0 st

Verifying VM Process CPU affinity

Finally, we can confirm the CPU affinity of the VM's QEMU process on the host node. This demonstrates that the entire virtual machine, as a workload, is constrained to the isolated CPU cores.

# Find the PID of the qemu-kvm process for the VM
ps -ef | grep qemu-kvm
# 107        44891   44699 62 03:04 ?        00:04:53 /usr/libexec/qemu-kvm -name guest=demo_centos-stream10-tan-tarantula-34,.............

# Check its CPU affinity
taskset -c -p 44891
# pid 44891's current affinity list: 20-23

Once you have finished this testing, we can take a look at how this all works together behind the scenes.  

Previous resource
Enabling partitioning
Next resource
Behind the scenes

This learning path is for operations teams or system administrators
Developers may want to check out Network observability with eBPF on developers.redhat.com. 

Get started on developers.redhat.com

Hybrid Cloud Logo LinkedIn YouTube Facebook Twitter

Platforms

Tools

Try, buy, sell

Communicate

About Red Hat

We’re the world’s leading provider of enterprise open source solutions—including Linux, cloud, container, and Kubernetes. We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2025 Red Hat