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.
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.
-
Target power state off. MTV 2.10 lets you set the power state of a migrated VM to
on,offorautoin the migration plan;autokeeps the source VM’s power state, per the MTV 2.10 release notes. Useoff. 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. -
A clone strategy other than
copy. CDI picks a clone strategy per StorageClass from its StorageProfile:csi-clone,snapshotorcopy, according to the upstream CDI StorageProfile documentation.copystreams every block through pods and is the slowest method. With no strategy set, CDI usessnapshotwhen it can and falls back tocopy. 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}' -
Permission to clone across namespaces. Whoever creates the clone needs permission to create
datavolumes/sourcein 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/v1kind: Rolemetadata:name: clone-sourcenamespace: wave1rules:- apiGroups: ["cdi.kubevirt.io"]resources: ["datavolumes/source"]verbs: ["create"] -
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
ipBlockselectors work when the network has nosubnets. 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.
-
Migrate with power state off. Run the MTV plan into the migration namespace (
wave1in the examples). For a rehearsal run, power the source VM back on in vSphere once the plan finishes. -
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/v1kind: NetworkAttachmentDefinitionmetadata:name: wave1-test-netnamespace: wave1-testspec:config: |-{"cniVersion": "0.3.1","name": "wave1-test-net","type": "ovn-k8s-cni-overlay","topology": "layer2","netAttachDefName": "wave1-test/wave1-test-net"}Leave out
subnetswhen 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/v1kind: NetworkPolicymetadata:name: default-deny-allnamespace: wave1-testspec:podSelector: {}policyTypes:- Ingress- EgressThat 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
podSelectorinfromortoselects 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/v1kind: NetworkPolicymetadata:name: allow-same-namespacenamespace: wave1-testspec:podSelector: {}policyTypes:- Ingress- Egressingress:- from:- podSelector: {}egress:- to:- podSelector: {}Cluster DNS runs outside the test namespace, so the client addresses the VM by IP.
-
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/v1beta1kind: DataVolumemetadata:name: app01-disk0-testnamespace: wave1-testspec:source:pvc:namespace: wave1name: <imported-pvc-of-disk0>storage: {} -
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 inwave1already 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
macAddressfrom 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. - 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):
-
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
AgentConnectedcondition on the VirtualMachineInstance (KubeVirt guest agent guide). -
Pass or fail. Delete the test namespace either way. Deleting it removes the test VM, the DataVolumes and their PVCs, and with a
Deletereclaim 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 inwave1and 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.
| Step | Precondition | Verification | Rollback |
|---|---|---|---|
| 1. Migrate | Plan power state off; storage map set | Plan succeeded; imported VM stopped | Source VM still in vSphere: power it on |
| 2. Test network | Unique layer2 network name, or default-deny plus same-namespace policy on the pod network | No 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 PVCs | Imported VM stopped; permission in wave1; clone strategy not copy | Every DataVolume Succeeded, one per imported disk | Delete the DataVolumes; imported PVCs unchanged |
| 4. Start test VM | Disks point at clones; interfaces at the test network; MAC kept with KubeMacPool off for the namespace, or dropped | VirtualMachineInstance running in wave1-test | Stop and delete the test VM |
| 5. Check | Written pass criteria for this VM | Guest agent connected; disks present; smoke tests pass | Fresh clone from the imported PVCs, retest |
| 6. Pass or fail | Results recorded | Test namespace gone | Fail: 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.