Bug 1882739

Summary: Restore Snapshot page should not allow to select a Storage Class with a different RBD pool than parent volume's
Product: [Red Hat Storage] Red Hat OpenShift Container Storage Reporter: Neha Berry <nberry>
Component: documentationAssignee: Kusuma <kbg>
Status: CLOSED CURRENTRELEASE QA Contact: akarsha <akrai>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.6CC: aos-bugs, asriram, bkunal, etamir, hchiramm, kbg, mrajanna, muagarwa, nthomas, ocs-bugs, ygalanti
Target Milestone: ---Keywords: Documentation
Target Release: OCS 4.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1901954 (view as bug list) Environment:
Last Closed: 2021-07-05 11:10:55 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:
Bug Depends On:    
Bug Blocks: 1901954    

Description Neha Berry 2020-09-25 13:59:46 UTC
Description of problem:
----------------------------
IN UI, While restoring a snapshot to a PVC, the dialog page allows you to select StorageClass from the drop-down. Few issues around here:

1. There is no message in the dialog box to ensure/instruct user to select an SC 

  --- a) which is same as the one Parent Volume was created with
  --- b) A different SC but attached to the same pool as the one Parent Volume was created with 

2. There is no enforcement for #1 as well and user is allowed to select any SC from the list(even if it is not the correct one)

Observations due to above
================
1.while restoring SC, in case a user selects a different SC than parent Volume SC(with different pool) , the PVC stays in Pending state 

2. If we select a different SC, yet the attached poolName is same as the parent volume's SC, the snapshot Restore succeeds and PVC is in BOUND state.


Ask: We need to handle this in UI so that user is not able to select an SC for Restore, whose poolName is different than its Parent Volume


>>UI Events

failed to provision volume with StorageClass "sc-rbd2": rpc error: code = Unknown desc = failed to create rbd clone: RBD image not found

>>$ oc describe pvc -n test-pvcs rbd-pvc1-snapshot-restore2

Events:
  Type     Reason                Age                    From                                                                                                                Message
  ----     ------                ----                   ----                                                                                                                -------
  Normal   Provisioning          3m51s (x10 over 8m6s)  openshift-storage.rbd.csi.ceph.com_csi-rbdplugin-provisioner-794cdd474c-cmwqr_6ab56332-b009-4f51-b680-5dbac2418367  External provisioner is provisioning volume for claim "test-pvcs/rbd-pvc1-snapshot-restore2"
  Warning  ProvisioningFailed    3m51s (x10 over 8m6s)  openshift-storage.rbd.csi.ceph.com_csi-rbdplugin-provisioner-794cdd474c-cmwqr_6ab56332-b009-4f51-b680-5dbac2418367  failed to provision volume with StorageClass "sc-rbd2": rpc error: code = Unknown desc = failed to create rbd clone: RBD image not found
  Normal   ExternalProvisioning  2m14s (x26 over 8m6s)  persistentvolume-controller                                                                                         waiting for a volume to be created, either by external provisioner "openshift-storage.rbd.csi.ceph.com" or manually created by system administrator




Version-Release number of selected component (if applicable):
-------------------------------------------------------------
OCP = 4.6.0-0.nightly-2020-09-25-070943
OCS = ocs-operator.v4.6.0-569.ci

How reproducible:
===================
Always


Steps to Reproduce:
-----------------------
1. Create an RBD PVC using default SC = ocs-storagecluster-ceph-rbd. Write some IO after mounting to a pod.
2. Create 1-2 custom SCs from UI:
e.g. : SC = rbd-default-pool , pool :ocs-storagecluster-cephblockpool
       SC = sc-rbd2; pool =  new pool, e.g. sc-pool-2


3. Create Snapshot of the PVC : Persistent Volume Claims->PVC->Actions->Create Snapshot

4. Once snapshot is created, click on the VOlume Snapshot-> 3 dots-> Restore to a new PVC

5. In the new dialog page, Name= rbd-pvc-snap-restore1; select a new SC (e.g. sc-rbd2) and click on Create

6. Check the Restored Snapshot's PVC status. It is in pending state.

7. Restore the snapshot again, say Name= rbd-pvc-snap-restore2, this time selecting rbd-default-pool(different SC but same pool):  PVC gets BOUND

8. Restore the snapshot, say Name = rbd-pvc-snap-restore3; SC = ocs-storagecluster-ceph-rbd(same as parent) : PVC gets BOUND

Actual results:
----------------------

The PVC is in pending state as the pool Name is different and it is unable to find the rbd image name 

Expected results:
--------------------
User should not be allowed to select an SC which has a diffeent pool than the parent colume during Snapshot restore flow.


Additional info:
---------------------
$ for i in $(oc get sc|awk '{print$1}'); do echo $i; echo +++++++++++++; oc get sc $i -o yaml|egrep 'name:|pool:'|grep -v noobaa|grep -v thin; echo "";  done

Comment 5 Humble Chirammal 2020-09-29 07:35:49 UTC
>
@Neha, we have fixed the create button issue with this bug -> https://bugzilla.redhat.com/show_bug.cgi?id=1870339, so user wont be able to restore the snapshot if they haven't selected any storage class.
I have following questions regarding this bug:-
1. We already filter the storage classes that have same provisioner, does it has to be parent's storage Class itself, or all same provisioner based storage classes are supported in downstream?

"The Pool" inside the SC is the key here.

>
2. We can filter on the bases of pool name used for parent pvc, but this filtering wont be possible if user deletes the parent pvc and then tries to restore the snapshot. This is because we will loose the information about storageClass name of parent, and hence the pool name. 

So, either we can add filter that works if parent pvc exist and doesnt work if no parent pvc is there. Or should we document this behavior of restore instead?
>

Are we supporting multiple SC with same POOL in OCS 4.6?

Comment 6 Kanika Murarka 2020-09-29 07:41:22 UTC
> 
> Are we supporting multiple SC with same POOL in OCS 4.6?

Yes, we are supporting multiple SC with same POOL, fixed with this BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1878075

Comment 7 Humble Chirammal 2020-09-29 09:45:05 UTC
(In reply to Kanika Murarka from comment #6)
> > 
> > Are we supporting multiple SC with same POOL in OCS 4.6?
> 
> Yes, we are supporting multiple SC with same POOL, fixed with this BZ:
> https://bugzilla.redhat.com/show_bug.cgi?id=1878075

OK.. If thats the case, we can not assume 'SC' while restoring. The pool can be derived, but I dont think its something UI can do or right thing to do. Otherwise the POOL has to be part of snapshotclass or we have to record it explictly in the snapshot object for consumers to make use of it.

Comment 8 Kanika Murarka 2020-09-29 10:10:40 UTC
> OK.. If thats the case, we can not assume 'SC' while restoring. The pool can
> be derived, but I dont think its something UI can do or right thing to do.
> Otherwise the POOL has to be part of snapshotclass or we have to record it
> explictly in the snapshot object for consumers to make use of it.

+1, If will be useful if we can get pool information stored in snapshot object

Comment 17 Eran Tamir 2020-09-30 11:10:01 UTC
Since we already filter the storage class for the specific provider, we need to stop here. 
The reason is that this is a UI used for all providers, not just OCS. Pool is not a general terminology and irrelevant for other providers. 
The only thing we can do is to mention it in our documentation - @anjana

Comment 18 Kanika Murarka 2020-09-30 13:35:09 UTC
Thanks Eran, Moving the BZ to documentation component.

Comment 22 akarsha 2020-11-12 10:11:45 UTC
In doc [1] after step select storage class name, on note have added: You must select a storage class which is attached to the same pool as that of the parent PVC.

Looks good, so moving the bz to verified state.

[1]: https://access.redhat.com/documentation/en-us/red_hat_openshift_container_storage/4.6/html-single/managing_and_allocating_storage_resources/index?lb_target=preview#restoring-volume-snapshots_rhocs

Comment 26 Humble Chirammal 2021-05-05 06:44:31 UTC
Considering this is getting addressed in code, can we close this bugzilla?

Comment 28 Mudit Agarwal 2021-05-05 07:10:02 UTC
(In reply to Humble Chirammal from comment #26)
> Considering this is getting addressed in code, can we close this bugzilla?

Once we have the fix in code (hopefully 4.8) we need to change the documentation.

Comment 29 Red Hat Bugzilla 2023-09-15 00:48:51 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 500 days