A Virtual Machine cloned from Openshift Web console UI reflects status "Not migratable"

Solution In Progress - Updated -

Environment

  • OpenShift Virtualization 4.X

Issue

  • A Virtual Machine is cloned from the Openshift Web console UI, by selecting the VM and selecting Clone on the three vertical dots.
  • Upon completion of the cloning process, in the Openshift Web console UI -> Virtualization -> VirtualMachines, the cloned Virtual Machine shows status Not migratable.
  • The original Virtual Machine PVC was configured with ReadWriteMany and the Virtual Machine cloned PVC is created as a ReadWriteOnce volume
  • OpenShift Virtualization default StorageProfile has accessMode set to ReadWriteOnce

Resolution

Patch the storage profile to support ReadWriteMany access mode:

For volumeMode: Filesystem:

$oc patch storageprofile profilename --type='json' -p='[{"op": "replace", "path": "/spec/claimPropertySets", "value": [{"accessModes": ["ReadWriteMany"], "volumeMode": "Filesystem"}]}]'

For volumeMode: Block:

$oc patch storageprofile profilename --type='json' -p='[{"op": "replace", "path": "/spec/claimPropertySets", "value": [{"accessModes": ["ReadWriteMany"], "volumeMode": "Block"}]}]'

The StorageProfile .spec.claimPropertySets accessMode is what defines whether a PVC is created as ReadWriteMany or ReadWriteOnce when a DataVolume is cloned.

Cloning a ReadWriteMany only results in a ReadWriteMany PVC if the accessMode is set correctly for the destination StorageProfile

Root Cause

The accessMode for the StorageProfile associated with the destination storage class is set to ReadWriteOnce

oc get storageprofile profilename -o yaml

spec:
  claimPropertySets:
  - accessModes:
    - ReadWriteMany
    volumeMode: Filesystem

Diagnostic Steps

  • The original Virtual Machine configuration.
`oc get vm windows-test-vm-22 -o yaml`

  dataVolumeTemplates:
  - metadata:
      creationTimestamp: null
      name: windows-test-vm-22
    spec:
      preallocation: false
      source:
        blank: {}
      storage:
        accessModes:
        - ReadWriteMany
        resources:
          requests:
            storage: 150Gi
        storageClassName: nfs-client
        volumeMode: Block
      - dataVolume:
          name: windows-test-vm-22
  • Cloned Virtual Machine configuration.
`oc get vm test-vm-22-bnyw4 -o yaml`

spec:
  dataVolumeTemplates:
  - apiVersion: cdi.kubevirt.io/v1beta1
    kind: DataVolume
    metadata:
      creationTimestamp: null
      name: test-vm-22-bnyw4
      namespace: test
    spec:
      source:
        pvc:
          name: test-vm-22
          namespace: test
      storage:
        resources:
          requests:
            storage: "161061273600"  
  • The original VM, test-vm-22 shows ACCESS MODES RWX whereas the cloned VM, test-vm-22-bnyw4 show RWO.
$ oc get pvc | egrep 'NAME|windows-test'
NAME                STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS  AGE
test-vm-22          Bound    pvc-b288a967-82bb-4723-a5b2-75b72f9d0b23   150Gi      RWX            nfs-client    6h
test-vm-22-bnyw4    Bound    pvc-6bb03444-59d5-42df-a797-cf1ee3518c6a   150Gi      RWO            nfs-client    2h
  • The cloned PVC Access Mode is derived from the StorageProfile
`oc get storageprofile nfs-client -o yaml`

spec:
  claimPropertySets:
  - accessModes:
    - ReadWriteOnce
    volumeMode: Filesystem

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments