Uploaded image for project: 'OpenShift Virtualization'
  1. OpenShift Virtualization
  2. CNV-68995

[CLOSED LOOP for] PVs are not removed when deleting cloned VMs created from MTV migrated VMs

XMLWordPrintable

    • Icon: Closed Loop Closed Loop
    • Resolution: Unresolved
    • Icon: Critical Critical
    • None
    • None
    • Storage Ecosystem
    • None
    • Future Sustainability
    • False
    • Hide

      None

      Show
      None
    • False
    • None
    • CNV I/U Operators Sprint 278
    • None

      Description of problem:

      The virtual machines migrated using MTV will use PVCs directly:

      # oc get vm nijin-rhel-9-5 -o yaml |yq '.spec.template.spec.volumes'
      - name: vol-0
        persistentVolumeClaim:
          claimName: nijin-rhel-9-5-vm-76972-m5bq6

       

      The owner of these PVCs will be the VM:

      oc get pvc nijin-rhel-9-5-vm-76972-m5bq6  -o yaml |yq '.metadata.ownerReferences'
      - apiVersion: kubevirt.io/v1
        blockOwnerDeletion: true
        controller: false
        kind: VirtualMachine
        name: nijin-rhel-9-5
        uid: c584e538-490b-453e-9ad1-e9d10225fb3e

       

      However, when this VM is cloned, the new PVC doesn't have the  ownerReferences.

      # oc get vm nijin-rhel-9-5-clone-1ze6tx  -o yaml |yq '.spec.template.spec.volumes'
      - name: vol-0
        persistentVolumeClaim:
          claimName: restore-32cb1f00-286b-4d72-828f-2f5cc7c3dbb8-vol-0
      
      
      # oc get pvc restore-32cb1f00-286b-4d72-828f-2f5cc7c3dbb8-vol-0 -o yaml |yq '.metadata.ownerReferences'
      null
      

      Because of this, when the cloned VM is deleted, the PVC remains in the cluster. 

      Version-Release number of selected component (if applicable):

      OpenShift Virtualization  4.18.11

      How reproducible:

      100%

      Steps to Reproduce:

      1. Migrate a VM from VMware to OpenShift Virtualization.
      2. Clone the VM.
      3. Delete the cloned VM. Although UI shows the checkbox to delete the PVC, from the backend PVC is not deleted. 
      

      Actual results:

      PVs are not removed when deleting cloned VMs created from MTV migrated VMs

      Expected results:

      Because the source VM's PVC has an owner reference, cloning the VM should result in the cloned PVC being associated with the cloned VM, and it should be removed automatically when that VM is deleted

      Additional info:

       

              rh-ee-ahafe Ahmad Hafi
              dagur@redhat.com Daniel Gur
              Natalie Gavrielov Natalie Gavrielov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: