Bug 1788109

Summary: VM created from VM Template with identical name fails to boot due to DV name collision
Product: OpenShift Container Platform Reporter: Radim Hrazdil <rhrazdil>
Component: Console Kubevirt PluginAssignee: Tomas Jelinek <tjelinek>
Status: CLOSED CURRENTRELEASE QA Contact: Nelly Credi <ncredi>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.4CC: aos-bugs, yzamir
Target Milestone: ---   
Target Release: 4.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-17 11:27:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Radim Hrazdil 2020-01-06 13:05:05 UTC
Description of problem:
When a user creates a VM template with a datavolume and then creates a VM from this template with the same name, the VM's DV fails to be created due to name collision.

The error message is the following:
Error creating DataVolume unique2-rootdisk: admission webhook "datavolume-validate.cdi.kubevirt.io" denied the request: Destination PVC already exists

Version-Release number of selected component (if applicable):
OCP 4.4
not reproducible on 4.3

How reproducible:
100%

Steps to Reproduce:
1. Create a VM Template from URL called 'x'
2. Create a VM using template 'x', name it 'x' as well
3. Start the VM

Actual results:
VM ends up in VM Error state

Expected results:
Should be able to boot

Additional info:

Comment 1 Tomas Jelinek 2020-01-13 12:11:47 UTC
since it is not reproducible on 4.3, targeting 4.4

Comment 2 Yaacov Zamir 2020-02-23 08:29:46 UTC
Can't reproduce on current master :-(

I created a template named "fedora-01" using a container "'kubevirt/fedora-cloud-container-disk-demo:latest'"
the devices part looks like:
```
              disks:
                - name: rootdisk
                  bootOrder: 1
                  disk:
                    bus: virtio
              inputs:
                - bus: virtio
                  name: tablet
                  type: tablet
              interfaces:
                - name: nic0
                  model: virtio
                  masquerade: {}
```

Then I created a VM called "fedora-01" using that template, It runs.

Radim, what am I missing, to I need to do something with the datavolumes ?

Comment 3 Radim Hrazdil 2020-02-24 13:00:24 UTC
Yaacov,

with a container, there is no issue.
The issue was when I selected template from URL source, called the vm template 'x', and then created a VM from this VM template called 'x' as well.

However, I tried to reproduce it on current 4.4 environment and the issue is no longer present. The datavolume of the created VM is now called x-rootdisk-clone, which doesn't clash with the VM Template diks.
Moving to verified.
4.4.0-0.nightly-2020-02-22-102956