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

[2248091] Creating virtual machine may incorrectly use already existing PVC in the namespace

XMLWordPrintable

    • High

      Description of problem:

      The namespace was already having a PVC named mytestvm:

      oc get pvc mytestvm
      NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
      mytestvm Bound pvc-9049ae50-3cfc-4b4a-9504-e65eb5dca2e1 10Gi RWO ocs-external-storagecluster-ceph-rbd 13m

      Then created a new VM "mytestvm" from the OpenShift Console (Virtual machines => Create => From template => select a template => Quick create virtual machine). The VM was created with the above PVC:

       

      oc get pod virt-launcher-mytestvm-slzxl -o json |jq '.spec.volumes[7]'
      {
      "name": "rootdisk",
      "persistentVolumeClaim":
      { "claimName": "mytestvm" }
      }
      

       

      By default, the generated PVC name is the same as the VM name. However, there is no validation that the PVC already exists and is being used.

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

      OpenShift Virtualization 4.13.5

      How reproducible:

      100%

      Steps to Reproduce:

      1. Create a PVC.
      2. Create a VM with the same name as of above PVC.
      3. The PVC in [1] was attached to the new VM as rootdisk.

      Actual results:

      Creating a virtual machine may incorrectly use already existing PVC in the namespace

      Expected results:

      I think it should generate a new name for the PVC if there is already an existing PVC with the same name.

      Additional info:

            upalatuc@redhat.com Ugo Palatucci
            rhn-support-nashok Nijin Ashok
            Leon Kladnitsky Leon Kladnitsky
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: