Bug 2222978
| Summary: | VM Cloning does not verify if the target VM already exists | ||
|---|---|---|---|
| Product: | Container Native Virtualization (CNV) | Reporter: | Denys Shchedrivyi <dshchedr> |
| Component: | Virtualization | Assignee: | Itamar Holder <iholder> |
| Status: | NEW --- | QA Contact: | Kedar Bidarkar <kbidarka> |
| Severity: | high | Docs Contact: | |
| Priority: | high | ||
| Version: | 4.14.0 | ||
| Target Milestone: | --- | ||
| Target Release: | 4.15.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: | 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
Denys Shchedrivyi
2023-07-14 17:05:34 UTC
I'm just not convinced this is a bug. Here's my rationale. If you created two VMs with the same name, wouldn't the same thing happen? a VM clone job is not an atomic operation. Deciding whether or not to create a job isn't going to solve this. We'll still get into the same situation sometimes. Picture these events in rapid succession: 1) VM clone is created. Check for name passes. clone can proceed. 2) VM with conflicting name is created. 3) clone job gets stuck. ---------- Because k8s is eventually consistent and declarative, this situation seems ok. If you delete the VM that has the problematic name, would the clone then succeed? What do you think Denys? > Because k8s is eventually consistent and declarative, this situation seems ok. If you delete the VM that has the problematic name, would the clone then succeed?
Yes, when the VM with target name deleted - the new VM automatically created:
$ oc get vm --watch
NAME AGE STATUS READY
vm-fedora 75s Running True
vm-fedora2 70s Running True
vm-fedora2 93s Terminating True
vm-fedora2 93s Terminating False
vm-fedora2 0s
vm-fedora2 0s Stopped False
I would agree - it probably can be considered as not_a_bug, however may be we have some options for improvements. Couple comments:
1) the VirtualMachineClone status is a bit confusing - it says `RestoreInProgress`, however no any real restoring in process.
May be we can add some event message in vmclone object says that the VM with target name already exists?
2) allow vmclone with same source/target names seems weird, it will not be completed, but will keep the snapshot while vmclone job exists
3) not sure how harmful it is, but if the vmclone job stuck (or failed) - it keeps the source vmsnapshot even if all VMs deleted:
$ oc get vm
No resources found in test-clone namespace.
$ oc get vmclone
NAME PHASE SOURCEVIRTUALMACHINE TARGETVIRTUALMACHINE
clone-to-existing-vm Failed vm-fedora-pvc vm-fedora2
$ oc get vmsnapshot
NAME SOURCEKIND SOURCENAME PHASE READYTOUSE CREATIONTIME ERROR
clone-clone-to-existing-vm-snapshot-vm-fedora-pvc-s57kb VirtualMachine vm-fedora-pvc Succeeded true 7m13s
|