Bug 1922264

Summary: Restore snapshot as a new PVC: RWO/RWX access modes are not click-able if parent PVC is deleted
Product: OpenShift Container Platform Reporter: Neha Berry <nberry>
Component: Console Storage PluginAssignee: Vineet <vbadrina>
Status: CLOSED ERRATA QA Contact: Jilju Joy <jijoy>
Severity: high Docs Contact:
Priority: high    
Version: 4.7CC: anbehl, aos-bugs, jijoy, nthomas, ocs-bugs, vbadrina
Target Milestone: ---   
Target Release: 4.8.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: 2021-07-27 22:37:34 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: 1932151    
Attachments:
Description Flags
screencast of the issue none

Description Neha Berry 2021-01-29 14:44:05 UTC
Created attachment 1752063 [details]
screencast of the issue

Description of problem:
==============================
With the fix for Bug 1882057, we now have 3 Access Modes (RWO/RWX/ROX) listed in the Restore as new PVC page.

But these are few of the issues with this page:

>> 1) The Storage Class drop down is mandatory but does not have the red asterisk mark

2) For a special case when the parent PVC(Voluem Mode=Filesystem, Access Mode= RWO) is already deleted, we see two issues:

>> 2a) Even though we have RWO and ROX options to select, RWO option is not click-able and ROX is the only option which can be selected (see attached screencast)

>> 2b) When I proceed with ROX option( only available choice as of now) and click on Restore, the resulting PVC is created with Access Mode=RWO and not ROX.

3) For a special case when parent volume (Voluem Mode=Block, Access Mode= RWO) is already deleted, we see these issues:

>> 3a) Even though we should have RWO/RWX/ROX all available for selection, RWX is greyed out and RWO is not click-able.
>> 3b) When I proceed with ROX option( only available choice as of now) and click on Restore, the resulting PVC is created with Access Mode=RWO and not ROX 

Version-Release number of selected component (if applicable):
==================================================================
OCP  = 4.7.0-0.nightly-2021-01-19-095812
OCS = ocs-operator.v4.7.0-238.ci



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


Steps to Reproduce #2 and #3:
=========================

For a PVC with "Access Mode = RWO, Volume Mode = Filesystem, Storageclass = ocs-storagecluster-ceph-rbd"
----------------------------------------------------------------------------------------------------------
1. In storage -> Persistent Volume Claims page:
Create 2  PVCs

PVC1-  with Access Mode = RWO, Volume Mode = Filesystem, Storageclass = ocs-storagecluster-ceph-rbd
PVC2-  with Access Mode = RWX, Volume Mode = Block, Storageclass = ocs-storagecluster-ceph-rbd

2. Confirm the PVCs are Bound

3. Right CLick on PVC1 and PVC2 -> Create Snapshot. Confirm snapshot is in Ready state.
4. Delete the parent PVCs PVC1 and PVC2 from UI/CLI. Confirm that parent PVCs no longer exist

>> 5. For Restore snapshot of PVC1
-------------------------------

5a). Navigate to Storage-> Volume Snapshots-> select PVC1-snapshot-> right click->restore as new PVC
5b). User is provided with option to select the following:

Storage class = select the rbd SC (this is a mandatory field, hence should have red asterisk beside it)

Access Mode: 
ROX and RWO are not greyed out but I am unable to click on RWO mode. ROX is the only selectable option.


Note: Once Storageclass is selected, as the snapshot's Parent PVC was RWO+ Filesystem, RWX option is greyed out(expected)

6. Proceed with ROX and click on Restore. Check the new PVC details. The Access Mode is taken as RWO even though ROX was selected in UI. 

>> 7. For Restore snapshot of PVC2
-------------------------------
7a). Navigate to Storage-> Volume Snapshots-> select PVC1-snapshot-> right click->restore as new PVC
7b) . User is provided with option to select the following:

Storage class = select the rbd SC (this is a mandatory field, hence should have red asterisk beside it)

Access Mode: 
RWX is greyed out - Not expected (as parent PVC volume mode was Block, user should be allowed to select RWX too)
ROX and RWO are not greyed out but I am unable to click on RWO mode. ROX is the only selectable option.


8. Proceed with ROX and click on Restore. Check the new PVC details. The Access Mode is taken as RWO even though ROX was selected in UI. 

++++++++++++++++++++++++++++++++


Actual results:
=========================
Unable to select RWO for Restore as a new PVC in case the parent PVC is already deleted.

Even if we select ROX, the resulting restored PVC has access mode set to RWO.






Expected results:
=======================

1) Storage class field should have red asterisk as it is a mandatory field

b) IIUC CSI allows any access mode to be selected for a restored PVC. Hence both RWO and ROX should be select-able and resulting PVC should have the selected access mode

Parent PVCs before deletion;
---------------------------
$ oc describe pvc |egrep -i 'Name:|Access Modes|VolumeMode'

>>PVC1
Name:          hulk-rbd-rwx-block
Access Modes:  RWX
VolumeMode:    Block

>>PVC2
Name:          hulk1-rbd-rwo-fs
Access Modes:  RWO
VolumeMode:    Filesystem


VOlumesnapshots
----------------------
$ oc get volumesnapshot
NAME                          READYTOUSE   SOURCEPVC            SOURCESNAPSHOTCONTENT   RESTORESIZE   SNAPSHOTCLASS                            SNAPSHOTCONTENT                                    CREATIONTIME   AGE
hulk-rbd-rwx-block-snapshot   true         hulk-rbd-rwx-block                           5Gi           ocs-storagecluster-rbdplugin-snapclass   snapcontent-44ceb130-2057-4f82-a89e-dbc4afee48b3   13s            14s
hulk1-rbd-rwo-fs-snapshot     true         hulk1-rbd-rwo-fs                             2Gi           ocs-storagecluster-rbdplugin-snapclass   snapcontent-1db185fe-240f-4345-8976-482764f0a6e8   21s            21s



Restored snapshots as PVC (in UI had to select ROX, but Access Mode is set to RWO instead)
----------------------------------------------------------------------------------------------

$ oc describe pvc |egrep -i 'Name:|Access Modes|VolumeMode'
Name:          hulk-rbd-rwx-block-snapshot-restore
Access Modes:  RWO
VolumeMode:    Filesystem
  Name:      hulk-rbd-rwx-block-snapshot
Name:          hulk1-rbd-rwo-fs-snapshot-restore
Access Modes:  RWO
VolumeMode:    Filesystem
  Name:      hulk1-rbd-rwo-fs-snapshot


>> Note: ROX mode is set correctly in restored PVC if the parent PVC was alive

Comment 1 Nishanth Thomas 2021-02-04 09:22:55 UTC
This Bz is of high priority but I don't think this should block the ocp release. Try to fix it before the final freeze of 4,7, else we will push this into a batch update. Un-setting the blocker flag

Comment 3 Neha Berry 2021-02-22 06:06:26 UTC
@jilju could you please help in verifying this BZ in 4.8, so that the backport PRs can be created.

Comment 4 Vineet 2021-02-22 17:09:46 UTC
@jilju for your verification, the following items have been fixed 

1. The storage class will have a required asterisk mark
2. The access mode selectors have been fixed, they should be selectable now with any storage class even if the parent pvc has been deleted
3. The access mode that has been selected will be correct in the restored PVC

Comment 5 Jilju Joy 2021-02-23 10:45:52 UTC
(In reply to Vineet from comment #4)
> @jilju for your verification, the following items have been fixed 
> 
> 1. The storage class will have a required asterisk mark
Yes, verified. Restore button will be enabled only after selecting the storage class.
> 2. The access mode selectors have been fixed, they should be selectable now
> with any storage class even if the parent pvc has been deleted
Access mode can be selected even if parent PVC is deleted. If parent PVC is absent, RWO access mode will be the default selected access mode in "Restore as new PVC" page.
The selection can be changed to another access mode as required. RWX selection is disabled if RBD PVC volume mode is Filesystem. However, the if the parent PVC volume mode is Block , the restored PVC will have Filesystem volume mode if parent PVC is deleted.
> 3. The access mode that has been selected will be correct in the restored PVC
Verified that the new PVC is created with the selected access mode.

Tested in version:
OCP 4.8.0-0.nightly-2021-02-23-013453
OCS 4.7.0-270.ci

Comment 6 Vineet 2021-02-23 11:03:37 UTC
> Access mode can be selected even if parent PVC is deleted. If parent PVC is absent, RWO access mode will be the default selected access mode in "Restore as new PVC" page.
> The selection can be changed to another access mode as required. RWX selection is disabled if RBD PVC volume mode is Filesystem. However, the if the parent PVC volume mode is Block , the restored PVC will have Filesystem 
> volume mode if parent PVC is deleted.

We have some more enhancements for this in the below PR. 
https://github.com/openshift/console/pull/8136

Annotations will be passed to the snapshot with access-mode, storage class and volume of the PVC. Hence on restoring we won't be having any of the above issues even if the parent PVC is deleted

Comment 7 Jilju Joy 2021-02-23 11:09:49 UTC
(In reply to Vineet from comment #6)
> > Access mode can be selected even if parent PVC is deleted. If parent PVC is absent, RWO access mode will be the default selected access mode in "Restore as new PVC" page.
> > The selection can be changed to another access mode as required. RWX selection is disabled if RBD PVC volume mode is Filesystem. However, the if the parent PVC volume mode is Block , the restored PVC will have Filesystem 
> > volume mode if parent PVC is deleted.
> 
> We have some more enhancements for this in the below PR. 
> https://github.com/openshift/console/pull/8136
> 
> Annotations will be passed to the snapshot with access-mode, storage class
> and volume of the PVC. Hence on restoring we won't be having any of the
> above issues even if the parent PVC is deleted

Thanks Vineet. As discussed these enhancements are not being tracked in this bug, I am moving this bug to verified state.

Comment 10 errata-xmlrpc 2021-07-27 22:37:34 UTC
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.8.2 bug fix and 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-2021:2438