Description of problem: PVC is deleted along with VM even with "Delete Disks" unchecked, this is a regression from OCP 4.7. Version-Release number of selected component (if applicable): OCP 4.8 How reproducible: 100% Steps to Reproduce: 1. Create a VM with PVC created 2. Delete the VM and uncheck "Delete Disks" on the delete modal. 3. Actual results: PVC is deleted along with the VM Expected results: PVC is not deleted if the checkbox "Delete Disks" is unchecked. Additional info:
@Kobi, There is a customer request for it, we may need to backport the fix to 4.8.z and 4.9.z, can we do that?
(In reply to Guohua Ouyang from comment #1) > @Kobi, There is a customer request for it, we may need to backport the fix > to 4.8.z and 4.9.z, can we do that? Will be taken care of ASAP, thank you for opening the bug
Hi all, it looks like the 'DataVolume' is owned by the VM and deleted automatically when the VM is deleted, is this the expected behavior? Should we remove the option for not deleting the PVCs when deleting the VM, since the backend already take care of it?
> it looks like the 'DataVolume' is owned by the VM and deleted automatically when the VM is deleted, > is this the expected behavior? If the DV is defined in the VM's DVTemplate, then yes. BUT If an independently existing PVC (owned by ie. a user) is attached to a VM, then this (previously existing PVC) must not be removed when the VM is getting deleted (because it is not owned by the VM). > Should we remove the option for not deleting the PVCs when deleting the VM, since the backend already take care of it? @
(kbd issue, reposting) > it looks like the 'DataVolume' is owned by the VM and deleted automatically when the VM is deleted, > is this the expected behavior? If the DV is defined in the VM's DVTemplate, then yes. BUT If an independently existing PVC (owned by ie. a user) is attached to a VM, then this (previously existing PVC) must not be removed when the VM is getting deleted (because it is not owned by the VM). > Should we remove the option for not deleting the PVCs when deleting the VM, since the backend already take care of it? We have VM owned (DVs based on VM DVTemplates) and VM un-owned resources (i.e. PVCs). For VM owned resources it makes sense to have a way to opt-out of the automatic deletion. But Adam needs to tell if this is posisble in a safe manner. For VM un-owned resources this problem does not apply, because they are anyhow not deleted when the VM is getting deleted.
Aviv hi, So ... my suggestion for the fix is: The delete model will have to look at all PVC and DVs ``` [x] delete independent disks (false by default) Disks: Owned 2 (will be deleted automatically) Independent 1 (will be deleted / will persist) <- string depending on the check box, ** Default to false ** @fdeutsch Does that makes sense to you ?
> Does that makes sense to you ? The idea yes, but I would avoid to introduce the new term "independent" (I merely used to describe it in this forum). Instead I would use the already known or more common term "owned" and "not owned".
p.s. I think this feature was created before we moved to use dataVolumes and is not needed anymore since deletion of owned PVC is done by the backend. @fdeutsch maybe we don't need this functionality at all anymore because it's done by the backend ?
We should maintain the functionality to opt-out of DV (and thus impl PVC) removal. We must also maintain the message to state what happens to own and not-owned disks. But I agree that we might not need the functionality to delete un-owned disks (PVCs and DVs alike)
> We have VM owned (DVs based on VM DVTemplates) and VM un-owned resources (i.e. PVCs). > For VM owned resources it makes sense to have a way to opt-out of the automatic deletion. But Adam needs to tell if this is posisble in a safe manner. Adam hi, We used to have an implicit way to delete PVCs we created manually only for the VM, but now we are using DVs that are auto-created and also auto-deleted. Is there a safe way to not delete the DV owned by the VM when deleting a VM?
Aviv hi, so depending on Adma's answer we can do: a. we can opt out of deleting owned DV: ``` [x] delete all owned disks (default to true) owned disks : 1 will be deleted / will persist un-owned disks : 2 will persist ``` b. or, if we can't opt out of deleting the owned DVs: ``` owned disks : 1 will be deleted un-owned disks : 2 will persist ``` Fabian, based on my above suggestions, did I understand correctly?
Yes.
Aviv hi, please fix using option b. (https://bugzilla.redhat.com/show_bug.cgi?id=2018428#c11) ``` owned disks : 1 will be deleted un-owned disks : 2 will persist ``` So we will have a fix. p.s. When Adam answer https://bugzilla.redhat.com/show_bug.cgi?id=2018428#c10 , we will update the fix accordingly.
You can always delete the owner reference on the DV and it will not get deleted.
I think the best behavior is as follows: - Delete disks checked (default): Owned disks will be deleted. Provide an optional check box for each unowned disk so that it can also be deleted - Delete disks unchecked: Do not remove any disks (remove ownerreferences on owned DVs/PVCs to ensure they are preserved) In both cases, the user should be shown (in the modal) what will or will not be deleted.
Adam, I think we tried to remove the owner, and it got populated back immediately (operator auto healing ?) Aviv, can you check if something is re-owning the DVs, or it was just us not removing the owner curreclty ?
As a workaround the following can be done to preserve the DataVolume and PVC for a VM disk when deleting the VM: Edit the VM: remove the entire dataVolumeTemplates section from the VM spec Edit the DV: remove the ownerReference from the DV Delete the VM The DataVolume will be left intact.
Test on the master branch: Good: 1. if the VM owned the disk, delete with disk with "Delete Disks" checked, disk is deleted along with the VM. 2. if the VM owned the disk, delete with disk with "Delete Disks" unchecked, disk is not deleted along with the VM. Bad: 3. if the disk is not owned by the VM(attach existing PVC), the delete modal cannot load normally.
Created attachment 1839493 [details] it keeps loading in the delete modal
should be fixed by: https://github.com/openshift/console/pull/10382 moving to modified
> Created attachment 1839493 [details] > it keeps loading in the delete modal Guohua, can you check for the "keeps loading the modal" on an un-fixed version, looks like an unrelated bug we need to fix
(In reply to Guohua Ouyang from comment #22) > Bad: > 3. if the disk is not owned by the VM(attach existing PVC), the delete modal > cannot load normally. Hi Guohua, I can see the problem you are refering to, but this should be opened in a separate BZ. I've opened this BZ [1] to follow up on the issue you mention. I will send a fix for this today. thank you for noticing
(In reply to Yaacov Zamir from comment #25) > > Created attachment 1839493 [details] > > it keeps loading in the delete modal > > Guohua, can you check for the "keeps loading the modal" on an un-fixed > version, looks like an unrelated bug we need to fix Yes, it exists in un-fixed version. So move the bug to verified
Aviv opened: https://bugzilla.redhat.com/show_bug.cgi?id=2019717
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Moderate: OpenShift Container Platform 4.10.3 security update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2022:0056