cephfs: ignore BytesQuota field in case it is not set.

This can happen when the subvolume is in snapshot-retained state.
We should not return error for such case as it is a valid situation.

Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
This commit is contained in:
Mudit Agarwal 2021-02-01 13:14:56 +05:30 committed by mergify[bot]
parent 584a43dc2c
commit d480eb4bda

View File

@ -104,9 +104,12 @@ func (vo *volumeOptions) getSubVolumeInfo(ctx context.Context, volID volumeID) (
} }
bc, ok := info.BytesQuota.(fsAdmin.ByteCount) bc, ok := info.BytesQuota.(fsAdmin.ByteCount)
if !ok { if !ok {
// we ignore info.BytesQuota == Infinite and just continue // If info.BytesQuota == Infinite (in case it is not set)
// without returning quota information // or nil (in case the subvolume is in snapshot-retained state),
if info.BytesQuota != fsAdmin.Infinite { // just continue without returning quota information.
// TODO: make use of subvolume "state" attribute once
// https://github.com/ceph/go-ceph/issues/453 is fixed.
if !(info.BytesQuota == fsAdmin.Infinite || info.BytesQuota == nil) {
return nil, fmt.Errorf("subvolume %s has unsupported quota: %v", string(volID), info.BytesQuota) return nil, fmt.Errorf("subvolume %s has unsupported quota: %v", string(volID), info.BytesQuota)
} }
} else { } else {