mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 11:00:25 +00:00
cephfs: ignore quota when SubVolumeInfo() returns Infinite
There is a type-check on BytesQuota after calling SubVolumeInfo() to see if the value is supported. In case no quota is configured, the value Infinite is returned. This can not be converted to an int64, so the original code returned an error. It seems that attaching/mounting sometimes fails with the following error: FailedMount: MountVolume.MountDevice failed for volume "pvc-0e8fdd18-873b-4420-bd27-fa6c02a49496" : rpc error: code = Internal desc = subvolume csi-vol-0d68d71a-1f5f-11eb-96d2-0242ac110012 has unsupported quota: infinite By ignoring the quota of Infinite, and not setting a quota in the Subvolume object, this problem should not happen again. Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
8a41cd03a5
commit
565038fdfd
@ -104,17 +104,21 @@ func (vo *volumeOptions) getSubVolumeInfo(ctx context.Context, volID volumeID) (
|
||||
return nil, err
|
||||
}
|
||||
|
||||
bc, ok := info.BytesQuota.(fsAdmin.ByteCount)
|
||||
if !ok {
|
||||
// info.BytesQuota == Infinite
|
||||
return nil, fmt.Errorf("subvolume %s has unsupported quota: %v", string(volID), info.BytesQuota)
|
||||
}
|
||||
|
||||
subvol := Subvolume{
|
||||
BytesQuota: int64(bc),
|
||||
// only set BytesQuota when it is of type ByteCount
|
||||
Path: info.Path,
|
||||
Features: make([]string, len(info.Features)),
|
||||
}
|
||||
bc, ok := info.BytesQuota.(fsAdmin.ByteCount)
|
||||
if !ok {
|
||||
// we ignore info.BytesQuota == Infinite and just continue
|
||||
// without returning quota information
|
||||
if info.BytesQuota != fsAdmin.Infinite {
|
||||
return nil, fmt.Errorf("subvolume %s has unsupported quota: %v", string(volID), info.BytesQuota)
|
||||
}
|
||||
} else {
|
||||
subvol.BytesQuota = int64(bc)
|
||||
}
|
||||
for i, feature := range info.Features {
|
||||
subvol.Features[i] = string(feature)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user