forked from rook/rook
Block deletion of CephFilesystems when there are any raw Ceph subvolumegroups present that have subvolumes in them. Empty subvolumegroups will not block deletion. One important subvolume group is "csi" which is the default location where CSI subvolumes are kept. If this group is empty, it means that there are no PVCs created based on the CephFilesystem in question. This also holds true if there are external consumers of the filesystem in external cluster mode. Similarly, if there are any subvolumegroups (for example "_nogroup", which includes subvolumes in the filesystem root) that contain manually-created subvolumes, Rook will also see this and block deletion. This comes into play currently with manually-created NFS exports. A work-in progress aims to create a Ceph-CSI NFS export provisioner which will likely create subvolumes in the "csi" group as well. This implementation will catch this case also. Rook still checks for CephFilesystemSubVolumeGroups explicitly in addition to the check added here. This is to ensure that even empty groups will block deletion if they are created via this CR type. Signed-off-by: Blaine Gardner <blaine.gardner@redhat.com>