Appendix C: the RDMA architecture on OpenShift Virtualization

How the cross-host RDMA architecture maps onto OpenShift Virtualization, with a bridge-networked KubeVirt soft-RoCE proof that runs on single-node OpenShift Local and a named, not-run-here SR-IOV path for the real hardware.

⏱ 25 minutesChapter 14Appendices

Learning objectives

By the end of this appendix you can:

  • Say why bridge binding, not masquerade, is the one networking choice that decides whether two KubeVirt virtual machines on the same pod network can address each other at all.
  • Run a soft-RoCE proof between two KubeVirt VMs on single-node OpenShift Local and say exactly what it proves: a correct verbs flow, nothing about latency.
  • Name the three operators a production SR-IOV RDMA path on OpenShift Virtualization needs, and what each one is responsible for.
  • Explain why a Virtual Function with isRdma: true goes to the guest’s own kernel driver rather than through a container RDMA CNI, and why that VM keeps the same one-sided property the cross-host RDMA appendix described on bare metal.
  • Say why a VM holding a passthrough SR-IOV device cannot live-migrate, and why single-node OpenShift Local has no migration to give up in the first place.

Diagram

A single OpenShift node running two KubeVirt virtual machines side by side. On the left, the runnable path: both VMs attach to the pod network through bridge binding, each with its own distinct pod IP, and each loads a soft rxe device over that interface; a one-sided RDMA write runs directly between the two IPs. On the right, the production path, drawn as not built here: a physical RDMA NIC is split by the SR-IOV Network Operator into Virtual Functions, one VF is bound to vfio-pci and passed straight into a VM's guest kernel driver, bypassing the pod network entirely, with Node Feature Discovery and a PerformanceProfile labelled alongside it as prerequisites.
Figure C.1: The runnable soft-RoCE path on the left shares the pod network with bridge binding; the production SR-IOV path on the right hands a VM its own Virtual Function straight through to the guest kernel, no pod network in between.

Why this matters

The cross-host RDMA appendix drew a hard line between what a real RDMA NIC delivers in principle and what a single, unprivileged host could actually run: SR-IOV passthrough into a guest, a lossless fabric, and a second physical host were all named and none of them built. OpenShift Virtualization is where that line gets interesting again, because a KubeVirt virtual machine is not a bare KVM guest anyone drives by hand with qemu-system-x86_64. It is a workload the platform schedules, networks, and reschedules on its own terms, and every one of those platform defaults, the pod network chief among them, was built for a web service, not for two peers that need to address each other directly across a cluster.

This appendix maps the cross-host RDMA architecture onto that platform in two parts. The first part is runnable on single-node OpenShift Local (CRC) with nested virtualization: two KubeVirt VMs, soft RoCE between them, and a networking choice, bridge binding instead of masquerade, that turns out to be the one decision that makes VM-to-VM RDMA possible at all. The second part is not runnable here for the same reason the cross-host RDMA appendix’s own hardware path was not: it needs a physical RDMA-capable NIC and a cluster built to hand Virtual Functions to VMs, neither of which a single CRC node carries. That path is described in full, named for what it requires, and left there.

The runnable path: two KubeVirt VMs on OpenShift Local

OpenShift Local (CRC) 4.22.14, with nested virtualization enabled so the single CRC node can itself run virtual machines, hosts the whole demo. Installing the OpenShift Virtualization operator (CNV 4.22.16) from the redhat-operators catalog source and applying a HyperConverged resource brings up KubeVirt’s own control plane, virt-api, virt-controller, and virt-handler, inside the openshift-cnv namespace. Once the HyperConverged resource reports Available, the cluster can run VirtualMachine objects the same way it already runs pods.

Two VMs, named roce-a and roce-b, come up from a Fedora cloud container disk with cloud-init installing rdma-core and loading the rdma_rxe kernel module at boot. The networking choice is where the platform’s own defaults work against the demo if left alone. KubeVirt’s usual pod-network binding is masquerade: it puts the VM behind a NAT translation inside its own pod, and every masqueraded VM sees the same internal gateway address, 10.0.2.2, no matter which pod it runs in. Two VMs on masquerade can each reach the outside world, but neither can address the other, because there is no “the other” address to reach, only the same NAT’d loopback-like view repeated per pod. The fix is the bridge binding on the VM’s interface instead:

interfaces:
  - name: default
    bridge: {}
networks:
  - name: default
    pod: {}

Bridge binding attaches the VM’s interface straight to the pod network bridge, the same way an ordinary pod’s interface works, so each VM gets its own distinct, directly reachable pod IP. That is the one change VM-to-VM RDMA needs before anything else: without a routable address on each side, there is no rkey or address exchange to perform, because there is nothing to exchange.

With bridge binding in place, each VM’s cloud-init script adds an rxe device over its own pod-network interface:

modprobe rdma_rxe
rdma link add rxe0 type rxe netdev eth0

That single rdma link add command is the entire soft-RoCE setup: it tells the kernel’s rxe module to answer verbs calls, ibv_reg_mr, ibv_post_send, completion polling, over the ordinary Ethernet interface already in the VM, the exact same emulation the cross-host RDMA appendix used across two throwaway KVM guests. The same C++23 one-sided RDMA program that appendix runs, rdma_write_demo, is delivered into each VM and built there at boot, then runs as a server on roce-b’s pod IP and a client on roce-a, posting an IBV_WR_RDMA_WRITE work request that lands directly in the server’s pinned buffer.

This proves one thing: the verbs flow works end to end between two VMs on this platform, over this networking binding, with no kernel change and no sudo reaching outside either VM. It proves nothing about latency. rxe answers every verbs call by walking the guest kernel’s own network stack on an ordinary vCPU, the identical caveat the cross-host RDMA appendix’s own soft-RoCE lab carried. A round trip timed here would be a software emulation artifact layered on top of a nested hypervisor, two caveats deep instead of one, and treating it as a stand-in for RDMA hardware latency would compound the mistake the earlier appendix already warned against.

Build, run, observe

cd examples/14-openshift-virt-rdma
./demo.sh up    # crc start, install OpenShift Virtualization, deploy HyperConverged
./demo.sh vms   # create roce-a and roce-b, build the C++ demo in each, bring up rxe
./demo.sh run   # C++ one-sided RDMA_WRITE between the two VMs, write results/
./demo.sh down  # delete the VMs (add 'stop' to also crc stop)

run starts the rdma_write_demo server on roce-b’s pod IP, then runs the client against it from roce-a, and writes the exchange to results/. The line worth reading is the server’s RDMA WRITE verified: 4096 bytes matched: the client wrote a known pattern straight into the server’s pinned buffer over RDMA, between two separate virtual machines rather than two processes sharing one guest, and the server read it back intact with its CPU uninvolved in the transfer. No latency figure accompanies it, because none would describe anything but this emulation’s own overhead.

Exercise it yourself

The section above gives the four commands. This one walks through each, with the output to expect and a note on what it tells you. Most of the clock time is the cluster and the two VMs coming up, so the run is mostly waiting, with three short bursts of activity.

Before you start

This demo runs on a single-node OpenShift Local (CRC) cluster. If you have not set that up yet, the Lab setup page has the prerequisites and the one-time steps: CRC installed with nested virtualization, sized at roughly 12 vCPU and 32 GB, with crc, oc, and curl on your PATH. The demo reads the kubeadmin password from crc at run time and never stores it, downloads virtctl from the cluster on first use, and changes nothing on the host, since CRC is itself a virtual machine. Clone the repository and work from its root:

git clone https://github.com/patterncatalyst/latency-patterns-in-cpp.git
cd latency-patterns-in-cpp/examples/14-openshift-virt-rdma

Step 1: Bring up the cluster and the operator

./demo.sh up

This starts CRC if it is not already running, waits for the redhat-operators catalog to reconnect after the cold start, installs the OpenShift Virtualization operator, and applies the HyperConverged resource that deploys KubeVirt. Each wait prints as it clears, and the step ends with:

ok: redhat-operators catalog READY
ok: operator CSV Succeeded
ok: HyperConverged Available
OpenShift Virtualization is ready.

What you are looking at: the platform is now able to run VirtualMachine objects the same way it runs pods. This is the longest step, because a cold CRC start and an operator install both take minutes.

Step 2: Create the two VMs and bring up soft-RoCE

./demo.sh vms

This creates roce-a and roce-b from the bridge-bound VM template, waits for both to reach Running, and waits for each VM’s cloud-init to finish building the C++ program and loading rxe over its pod-network interface. It ends by listing the VMs:

ok: both VMIs Running
ok: roce-a rxe ready
ok: roce-a rdma build ready
ok: roce-b rxe ready
ok: roce-b rdma build ready
NAME     AGE   PHASE     IP            NODENAME   READY
roce-a   7m    Running   10.217.0.59   crc        True
roce-b   7m    Running   10.217.0.77   crc        True

What you are looking at: two VMs, each with its own distinct pod IP in the CRC pod network’s 10.217.0.0/22 range. That distinct address per VM is the whole point of bridge binding; under masquerade both VMs would sit behind the same NAT address and could not reach each other.

Step 3: RDMA between the two VMs

./demo.sh run

The program was compiled in each VM at boot, so this only runs it: it starts the rdma_write_demo server on roce-b’s pod IP, runs the client against it from roce-a, and writes the exchange into results/:

== C++ one-sided RDMA_WRITE: server on roce-b (10.217.0.77), client on roce-a ==
client: connected, remote buffer rkey 0x364
client: RDMA_WRITE completed locally, sending done signal
server: established, buffer exposed with rkey 0x364
server: done signal received, verifying buffer contents
RDMA WRITE verified: 4096 bytes matched

What you are looking at: the client wrote a known 4096-byte pattern straight into the server’s registered buffer, between two separate virtual machines rather than two processes in one guest, and the server read it back intact with its CPU uninvolved in the transfer. The pod IPs and the rkey differ from run to run. No latency figure appears, and none should: rxe answers every verbs call on an ordinary vCPU inside the guest kernel, on top of a nested hypervisor, so any time here would describe the emulation, not RDMA hardware.

Step 4: Read the proof

cat results/kubevirt-roce-proof.txt
crc_openshift_version=4.22.14
openshift_virtualization_version=4.22.16
vm_a_ip=10.217.0.59
vm_b_ip=10.217.0.77
=== rdma link state (both VMs) ===
roce-a: link rxe0/1 state ACTIVE physical_state LINK_UP netdev enp1s0
roce-b: link rxe0/1 state ACTIVE physical_state LINK_UP netdev enp1s0
=== C++ RDMA_WRITE result (server on roce-b) ===
server: listening on 10.217.0.77:7471
server: established, buffer exposed with rkey 0x364
server: done signal received, verifying buffer contents
RDMA WRITE verified: 4096 bytes matched

What you are looking at: both VMs report an rxe device in the ACTIVE state over their pod-network interface, and the server confirms the write landed. This is a correctness record for the platform, not a benchmark.

Teardown

./demo.sh down stop

down deletes the two VMs; adding stop also stops the CRC cluster, which frees the memory it was holding (around 32 GB). Stop it when you are done: a running CRC instance holds that RAM whether or not the demo is using it.

The production path: SR-IOV Virtual Functions, not run here

A real RDMA NIC changes the shape of the problem entirely, because the pod network is no longer in the picture at all. Instead of a VM’s interface attaching to a bridge, a slice of the physical NIC itself, a Virtual Function, gets handed straight to the guest kernel’s own driver. None of what follows runs on the single CRC node this appendix’s demo uses; it needs a physical RDMA-capable NIC and a cluster built around it, and is described here the way the cross-host RDMA appendix described its own SR-IOV passthrough path: named, illustrated, and left unbuilt.

Three operators carry the platform side of this:

  • The SR-IOV Network Operator discovers which NICs on which nodes support SR-IOV, carves each one into Virtual Functions, binds the functions meant for RDMA to vfio-pci, and creates the NetworkAttachmentDefinition objects a VM’s interface will reference.
  • Node Feature Discovery labels each node with what its hardware actually offers, network-sriov.capable, rdma.capable, so the SR-IOV operator and a scheduler both know which nodes are candidates before anything gets scheduled onto them.
  • The Node Tuning Operator, through a PerformanceProfile, reserves HugePages, isolates a set of CPUs, and sets intel_iommu=on iommu=pt on the worker’s kernel command line, the IOMMU configuration a passthrough device needs to be remapped safely into a guest’s address space.

A fourth operator, the NVIDIA Network Operator, matters specifically for a Mellanox-class NIC: it layers DOCA/OFED driver management on top of the same SR-IOV foundation for that vendor’s hardware.

The policy that tells the SR-IOV Network Operator which Virtual Functions to hand to virtual machines, rather than to ordinary pods, sets deviceType: vfio-pci and isRdma: true:

# Illustration only: not applied to any cluster in this lab.
apiVersion: sriovnetwork.openshift.io/v1
kind: SriovNetworkNodePolicy
metadata:
  name: rdma-vf-policy
  namespace: openshift-sriov-network-operator
spec:
  resourceName: rdma_vf
  deviceType: vfio-pci
  isRdma: true
  nicSelector:
    vendor: "15b3"
  numVfs: 8
  nodeSelector:
    feature.node.kubernetes.io/rdma.capable: "true"

isRdma: true is what marks this as the VM path rather than the container RDMA CNI path: the whole Virtual Function, register set and all, goes to the guest kernel’s own mlx5_core or irdma driver, the same way a bare-metal SR-IOV Virtual Function reached a KVM guest in the cross-host RDMA appendix. An SriovNetwork object then exposes that resource as something a VM’s interface can request, attached with a bare sriov: {} binding, never masquerade or bridge: those bindings put a software path between the VM and the NIC, which is exactly what passing the Virtual Function through exists to avoid.

Carving and attaching the Virtual Function is only half the fabric work. The SR-IOV Network Operator creates the VF and tags its VLAN; it does not make the Ethernet fabric lossless. That half still needs the same PFC and ETS configuration the cross-host RDMA appendix named at the physical switch and NIC level, reached here through either an NVIDIA NicClusterPolicy setting trust mode, PFC, and ETS on a Mellanox card, or a MachineConfig running a systemd oneshot unit that calls lldptool, dcbtool, or devlink on an Intel E810. Priority has a guest-side half too: the application inside the VM still has to mark its own queue pairs with a Service Level or DSCP value, exactly as it would on bare metal, because the platform carved the VF and tagged the link; it never decides which of the guest’s own flows gets that priority.

Trade-offs and caveats

Red Hat supports RoCEv2 for RDMA on OpenShift; InfiniBand is generally not supported through the standard SR-IOV Network Operator path, which narrows the realistic fabric choice to the same RoCEv2-over-Ethernet transport the cross-host RDMA appendix already favored for every deployment outside a dedicated HPC cluster.

A VM holding a vfio-pci SR-IOV device cannot live-migrate on its own; the passthrough binds that VM to the physical NIC on its current node, and migrating it needs a virtio-plus-SR-IOV bond so the VM can fail over onto the paravirtual leg while the passthrough leg is torn down and rebuilt elsewhere. Single-node OpenShift Local sidesteps the question entirely rather than answering it: with one node, there is no live migration, no HA, and no node eviction to give up, the same limit this lab’s bridge-networked VMs already live under for an unrelated reason.

What you learned

  • Bridge binding on a KubeVirt VM’s pod-network interface gives it a distinct, directly reachable pod IP; masquerade puts every VM behind the same NAT address and makes VM-to-VM RDMA impossible before any verbs call runs.
  • A soft-RoCE rxe device over that bridge-bound interface lets the same C++ one-sided RDMA program from the cross-host appendix move data between two KubeVirt VMs on single-node OpenShift Local, proving the verbs flow works on the platform and proving nothing about latency, the same caveat the cross-host RDMA appendix’s own software RoCE lab carried.
  • Production RDMA on OpenShift Virtualization needs the SR-IOV Network Operator, Node Feature Discovery, and a PerformanceProfile from the Node Tuning Operator working together, none of it run in this lab.
  • isRdma: true on an SriovNetworkNodePolicy is what sends a whole Virtual Function to a VM’s own guest kernel driver instead of through a container RDMA CNI, keeping the same one-sided property the cross-host RDMA appendix described for a bare KVM guest.
  • A VM with a passthrough SR-IOV device cannot live-migrate without a virtio-plus-SR-IOV bond, and single-node OpenShift Local has no live migration to lose regardless.

For deeper coverage

  • OpenShift Virtualization / KubeVirt documentation (kubevirt.io): the HyperConverged resource and VM networking bindings the runnable path deploys.
  • OpenShift SR-IOV Network Operator documentation: the SriovNetworkNodePolicy and SriovNetwork objects named in the production path.
  • Node Feature Discovery documentation: the node labeling the production path relies on to target RDMA-capable workers.
  • Node Tuning Operator / PerformanceProfile documentation: the HugePages, CPU isolation, and IOMMU kernel arguments a passthrough Virtual Function needs on its worker node.

Full citations, with links, are in the bibliography.