Skip to main content

Michael Schmidt Michael Schmidt

How to Test Migrated VMs Before Cutover on OpenShift Virtualization

Oct 26, 2026  |  13 min read

How to Test Migrated VMs Before Cutover on OpenShift Virtualization

To test migrated VMs before cutover, migrate each VM with its target power state set to off, clone its imported disks into a separate test namespace with its own isolated network, and boot the clone there. You pass or fail the VM on the clone. The source VM stays in vSphere, powered off, as the fallback until the VM passes.

The guide is for the migration lead moving VMware® vSphere VMs to Red Hat® OpenShift® Virtualization with the Migration Toolkit for Virtualization (MTV) 2.10, one wave at a time. It covers the storage and network steps of the test: power state, the cross-namespace clone, the isolated network, the pass/fail decision and the rollback. Writing the application checks themselves is yours. Storage map choices are covered in the MTV storage decisions post.

Cutover here means the moment users and dependent systems start using the migrated VM. MTV also has a “cutover stage” in warm migration. The two are different events, and in a warm migration the test sits between them.

How to test migrated VMs before cutover: where each copy lives

During the test, one VM exists as three copies, and only the third one boots. The source VM stays in vSphere and the imported VM stays on OpenShift Virtualization, and the test boots neither. Each imported disk ends up as a DataVolume and its PersistentVolumeClaim (PVC) next to the migrated VM, in the plan’s target namespace (the migration namespace here). The third copy is made of clones of those PVCs, in their own namespace.

vSphere
Source VM
The fallback
Migration namespace
Imported VM
Power state off
Imported PVCs
Clone source
Test namespace
Test VM
Booted and checked
Cloned PVCs
Deleted after the test
Isolated network
No route to production
Changed by the testNot changed by the test
Figure 1: the three copies of one VM during a pre-cutover test

The first boot and every test write go into the clone, so the imported disks stay exactly as MTV delivered them. If a test corrupts something, you delete the clone and take a fresh one without importing again.

MTV preserves VM MAC addresses during migration, according to the MTV 2.10 planning guide, and a guest with a static IP comes up with its old address too. The test copy therefore starts with the source VM’s MAC and IP addresses. It needs a network that neither production nor the source network can see.

Rehearsal run or gated cutover: when the test happens

A rehearsal run tests the copy while the source VM is back in service, and a gated cutover keeps the source off until the copy passes. Choose a rehearsal run when the VM cannot stay down for the length of the test, or when it is the first VM of a new type (an OS, an application stack) in your waves. Choose a gated cutover when the outage window covers the copy plus the test, and the VM type already passed a rehearsal.

Both start the same way, because MTV only has a complete copy after the source VM was shut down. The MTV 2.10 planning guide describes the two migration types like this:

  • Cold migration: the source VMs are shut down while the data is copied.
  • Warm migration: most data is copied in the precopy stage while the source VM runs. The VM is shut down in the cutover stage, and the remaining data is copied then. Data in RAM is not migrated.

Rehearsal run. Migrate, then power the source VM back on in vSphere right away and test the clone on OpenShift at your own pace. The OpenShift copy is a point in time that falls behind the running source. After the test, delete the imported VM and its PVCs, and migrate again for the real cutover.

Gated cutover. Migrate, keep the source VM off, test the clone, and start the imported VM only if the test passes. If it fails, you power the source back on.

Never run the source VM and the migrated VM on the same network at the same time: both carry the same MAC and IP addresses.

Four things to set up before the first wave

The power state belongs in every migration plan. The other three are set up once: the clone strategy per StorageClass, the permission per migration namespace, and the type of test network.

  1. Target power state off. MTV 2.10 lets you set the power state of a migrated VM to on, off or auto in the migration plan; auto keeps the source VM’s power state, per the MTV 2.10 release notes. Use off. The Containerized Data Importer (CDI) does not clone a PVC that a pod has mounted and waits until it is free, according to the upstream CDI DataVolume documentation. A running VM keeps its disks mounted.

  2. A clone strategy other than copy. CDI picks a clone strategy per StorageClass from its StorageProfile: csi-clone, snapshot or copy, according to the upstream CDI StorageProfile documentation. copy streams every block through pods and is the slowest method. With no strategy set, CDI uses snapshot when it can and falls back to copy. The snapshot path needs a VolumeSnapshotClass for the StorageClass, and both PVCs in the same StorageClass. Check what your cluster will use (example command):

    Terminal window
    oc get storageprofile <storage-class> -o jsonpath='{.status.cloneStrategy}'
  3. Permission to clone across namespaces. Whoever creates the clone needs permission to create datavolumes/source in the migration namespace (upstream CDI CSI cloning prerequisites). An example Role, bound to the test operator in the migration namespace:

    apiVersion: rbac.authorization.k8s.io/v1
    kind: Role
    metadata:
    name: clone-source
    namespace: wave1
    rules:
    - apiGroups: ["cdi.kubevirt.io"]
    resources: ["datavolumes/source"]
    verbs: ["create"]
  4. An isolated network for the test namespace. A namespace alone isolates nothing: by default every VM in a namespace is reachable from other VMs and network endpoints, as the KubeVirt NetworkPolicy guide puts it. The fix depends on how the VM is attached:

    • Pod network: apply a default-deny NetworkPolicy for ingress and egress in the test namespace, plus a policy that lets the test client reach the VM.
    • Secondary network (for example a VM mapped to a VLAN): NetworkPolicy is not supported on OVN-Kubernetes secondary networks, per the OpenShift 4.20 multiple networks documentation. That leaves two options. Choose a separate layer2 secondary network when you want the simplest isolation, with no policy to get right: layer2 networks only carry packets between pods inside the cluster, while a localnet network connects to the physical network. Choose a MultiNetworkPolicy on the original secondary network when the test VM must keep its original attachment. The page says the MultiNetworkPolicy API is compatible with OVN-Kubernetes secondary networks, and that only ipBlock selectors work when the network has no subnets. A policy filters traffic, but the interface still sits on the physical network, so a copy that keeps the source MAC is safer on the layer2 network. The steps in the next section use the layer2 network.

The KubeVirt VirtualMachineClone API is not an option for this layout: its source and target must reside in the same namespace. The test namespace exists to hold its own network, so the procedure clones each PVC with a CDI DataVolume instead.

OpenShift Virtualization migration testing, step by step

Six steps per VM end in a recorded pass or fail, and in a gated cutover a pass is the signal to start the imported VM. The YAML is example configuration: replace the names, and take the PVC names from the volumes list of the migrated VirtualMachine.

  1. Migrate with power state off. Run the MTV plan into the migration namespace (wave1 in the examples). For a rehearsal run, power the source VM back on in vSphere once the plan finishes.

  2. Create the test namespace and its network. For a secondary network, create a layer2 NetworkAttachmentDefinition. Give the network its own name: OVN-Kubernetes network names are not namespaced, so a definition in another namespace with the same name and settings can join the same network.

    apiVersion: k8s.cni.cncf.io/v1
    kind: NetworkAttachmentDefinition
    metadata:
    name: wave1-test-net
    namespace: wave1-test
    spec:
    config: |-
    {
    "cniVersion": "0.3.1",
    "name": "wave1-test-net",
    "type": "ovn-k8s-cni-overlay",
    "topology": "layer2",
    "netAttachDefName": "wave1-test/wave1-test-net"
    }

    Leave out subnets when the guest keeps a static IP; without it, addresses are assigned by you, not by OVN-Kubernetes. For a VM on the pod network, apply the default-deny policy from the Kubernetes NetworkPolicy documentation instead, with the namespace added:

    apiVersion: networking.k8s.io/v1
    kind: NetworkPolicy
    metadata:
    name: default-deny-all
    namespace: wave1-test
    spec:
    podSelector: {}
    policyTypes:
    - Ingress
    - Egress

    That policy also blocks the smoke-test client in step 5. Add a second policy that allows traffic inside the test namespace only. Policies are additive, and a podSelector in from or to selects pods in the policy’s own namespace, per the same Kubernetes page. Example, based on the allow-same-namespace policy in the KubeVirt NetworkPolicy guide, with egress added:

    apiVersion: networking.k8s.io/v1
    kind: NetworkPolicy
    metadata:
    name: allow-same-namespace
    namespace: wave1-test
    spec:
    podSelector: {}
    policyTypes:
    - Ingress
    - Egress
    ingress:
    - from:
    - podSelector: {}
    egress:
    - to:
    - podSelector: {}

    Cluster DNS runs outside the test namespace, so the client addresses the VM by IP.

  3. Clone every imported PVC. One DataVolume per disk, with the imported PVC as its source. With a PVC source, CDI can take the size from the source, so storage: {} is enough.

    apiVersion: cdi.kubevirt.io/v1beta1
    kind: DataVolume
    metadata:
    name: app01-disk0-test
    namespace: wave1-test
    spec:
    source:
    pvc:
    namespace: wave1
    name: <imported-pvc-of-disk0>
    storage: {}
  4. Define and start the test VM. Export the migrated VirtualMachine, change its namespace and name, and point each disk at its clone and each secondary interface at wave1-test-net. Decide on the MAC address before you create it. KubeMacPool is enabled by default and allocates MAC addresses so that each network interface gets a unique one (OKD 4.20 MAC address pool documentation). The imported VM in wave1 already holds the address the copy inherits.

    • Keep the MAC: choose this when the guest’s network configuration depends on it. Take the test namespace out of KubeMacPool first, with the label from the same page (example command): oc label namespace wave1-test mutatevirtualmachines.kubemacpool.io=ignore.
    • Drop the MAC: choose this when nothing in the guest depends on it. Remove macAddress from the test VM’s interfaces and KubeMacPool assigns a new one. The guest then sees a new MAC on its network card, which can change how it names or configures the interface.

    Then start the VM with virtctl start.

  5. Check the copy. Boot, every disk present, the guest agent connected, the application started, and your smoke tests passed from a client inside the test network. KubeVirt reports a connected guest agent as the AgentConnected condition on the VirtualMachineInstance (KubeVirt guest agent guide).

  6. Pass or fail. Delete the test namespace either way. Deleting it removes the test VM, the DataVolumes and their PVCs, and with a Delete reclaim policy the cloned volumes too. On a pass in a gated cutover, start the imported VM and move traffic to it. On a fail, fix the cause and power the source back on if it is off. Then delete the imported VM and its PVCs in wave1 and migrate the VM again. The MTV 2.10 planning guide says VM names must be unique in the OpenShift Virtualization environment, so the old imported VM has to go first.

StepPreconditionVerificationRollback
1. MigratePlan power state off; storage map setPlan succeeded; imported VM stoppedSource VM still in vSphere: power it on
2. Test networkUnique layer2 network name, or default-deny plus same-namespace policy on the pod networkNo route from the test namespace to production or vSphere networks (example check: a connection from a test client to a known production address fails)Delete the network definition or policies
3. Clone PVCsImported VM stopped; permission in wave1; clone strategy not copyEvery DataVolume Succeeded, one per imported diskDelete the DataVolumes; imported PVCs unchanged
4. Start test VMDisks point at clones; interfaces at the test network; MAC kept with KubeMacPool off for the namespace, or droppedVirtualMachineInstance running in wave1-testStop and delete the test VM
5. CheckWritten pass criteria for this VMGuest agent connected; disks present; smoke tests passFresh clone from the imported PVCs, retest
6. Pass or failResults recordedTest namespace goneFail: source VM back on, imported VM and PVCs deleted, migrate again

Keep the source VM in vCenter after a pass, powered off, until the migrated VM has run in production for as long as your rollback policy requires. Snapshot the migrated disks before go-live if you want a rollback point on OpenShift as well; the KubeVirt storage guide and the VolumeSnapshotClass post cover that part.

What the test copy costs on simplyblock storage

A test clone on simplyblock 26.3 shares the imported disk’s data and may need additional capacity for the changes made after cloning, per the 26.3 snapshots and clones page. Size a wave’s test headroom by what the tests write, not by the full size of the disks under test. The clone is writable and independent: changes to it do not affect the imported PVC.

The storage side of each copy is also instant, with no second import from vSphere and no block-by-block copy. A PVC clone on simplyblock refers back to the same data, because simplyblock is a full copy-on-write storage engine. Both CDI paths that avoid copy end there. csi-clone uses the CSI clone, a PVC with another PVC as its dataSource. snapshot creates a VolumeSnapshot and restores a PVC from it, and simplyblock creates that PVC as a copy-on-write clone too. For the snapshot path, the 26.3 docs name the example class simplyblock-csi-snapshotclass.

A failed check therefore costs a delete and a new clone, not a new import. You can test the same VM after each fix, or run a rehearsal for every VM type in the wave. Simplyblock does not supply the isolation. The test network is an OpenShift object you build and verify yourself, as in step 2.

The OpenShift Virtualization storage page covers simplyblock for VMs on OpenShift, and the VMware migration overview lists the rest of the migration path. Testing failover from replicated data at a second site is a different test, covered in disaster recovery testing after the vSphere exit.

You may also like:

Replacing vSAN Storage When Moving to OpenShift or Kubernetes
Replacing vSAN Storage When Moving to OpenShift or Kubernetes

Most VMware migration guides focus on the compute layer — but vSAN is the storage layer, and it does not migrate. Here is what platform teams need to plan when replacing vSAN as part of an OpenShift or Kubernetes transition.

KVM vs VMware: Architecture, Cost Model, and the Exit Question
KVM vs VMware: Architecture, Cost Model, and the Exit Question

KVM and VMware ESXi solve the same problem with opposite models: an open hypervisor inside the Linux kernel versus a proprietary integrated suite. How they differ in architecture, operations, and cost, and what a migration involves.

KubeVirt vs VMware – When to Use Each Tool
KubeVirt vs VMware – When to Use Each Tool

KubeVirt vs VMware helps you see how each handles VMs, workloads, and hybrid environments in modern infrastructure setups.