mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 11:00:25 +00:00
cephfs: fix logic to call ceph fs resize
clusterAdditionalInfo map is holding a localClusterState for checking ceph cluster supports resize and subvolumegroup is created or not, currently we are checking if the key is present in a map and localClusterStatelocalClusterState.resizeSupported is set to false to call ceph fs subvolume resize to check command is supported or not, if a structure is initialized all its members are set to default value. so we will never going to check the ceph fs subvolume resize command is supported in backend or not, we are always using ceph fs subvolume create to resize subvolume. in some ceph version ceph fs subvolume create wont work to resize a subvolume. This commit changes the resizeSupported from bool to *bool for proper handling of this scenario. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
a1c8942e2b
commit
a35a835e9c
@ -121,7 +121,7 @@ func (vo *volumeOptions) getSubVolumeInfo(ctx context.Context, volID volumeID) (
|
|||||||
|
|
||||||
type localClusterState struct {
|
type localClusterState struct {
|
||||||
// set true if cluster supports resize functionality.
|
// set true if cluster supports resize functionality.
|
||||||
resizeSupported bool
|
resizeSupported *bool
|
||||||
// set true once a subvolumegroup is created
|
// set true once a subvolumegroup is created
|
||||||
// for corresponding cluster.
|
// for corresponding cluster.
|
||||||
subVolumeGroupCreated bool
|
subVolumeGroupCreated bool
|
||||||
@ -183,7 +183,10 @@ func (vo *volumeOptions) resizeVolume(ctx context.Context, volID volumeID, bytes
|
|||||||
}
|
}
|
||||||
// resize subvolume when either it's supported, or when corresponding
|
// resize subvolume when either it's supported, or when corresponding
|
||||||
// clusterID key was not present.
|
// clusterID key was not present.
|
||||||
if clusterAdditionalInfo[vo.ClusterID].resizeSupported || !keyPresent {
|
if clusterAdditionalInfo[vo.ClusterID].resizeSupported == nil || *clusterAdditionalInfo[vo.ClusterID].resizeSupported {
|
||||||
|
if clusterAdditionalInfo[vo.ClusterID].resizeSupported == nil {
|
||||||
|
clusterAdditionalInfo[vo.ClusterID].resizeSupported = new(bool)
|
||||||
|
}
|
||||||
fsa, err := vo.conn.GetFSAdmin()
|
fsa, err := vo.conn.GetFSAdmin()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.ErrorLog(ctx, "could not get FSAdmin, can not resize volume %s:", vo.FsName, err)
|
util.ErrorLog(ctx, "could not get FSAdmin, can not resize volume %s:", vo.FsName, err)
|
||||||
@ -192,7 +195,7 @@ func (vo *volumeOptions) resizeVolume(ctx context.Context, volID volumeID, bytes
|
|||||||
|
|
||||||
_, err = fsa.ResizeSubVolume(vo.FsName, vo.SubvolumeGroup, string(volID), fsAdmin.ByteCount(bytesQuota), true)
|
_, err = fsa.ResizeSubVolume(vo.FsName, vo.SubvolumeGroup, string(volID), fsAdmin.ByteCount(bytesQuota), true)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
clusterAdditionalInfo[vo.ClusterID].resizeSupported = true
|
*clusterAdditionalInfo[vo.ClusterID].resizeSupported = true
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
var invalid fsAdmin.NotImplementedError
|
var invalid fsAdmin.NotImplementedError
|
||||||
@ -202,7 +205,7 @@ func (vo *volumeOptions) resizeVolume(ctx context.Context, volID volumeID, bytes
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clusterAdditionalInfo[vo.ClusterID].resizeSupported = false
|
*clusterAdditionalInfo[vo.ClusterID].resizeSupported = false
|
||||||
return createVolume(ctx, vo, volID, bytesQuota)
|
return createVolume(ctx, vo, volID, bytesQuota)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user