mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-09 16:00:22 +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>
(cherry picked from commit a35a835e9c
)
This commit is contained in:
parent
75e06f9581
commit
e8267de3c9
@ -121,7 +121,7 @@ func getSubVolumeInfo(ctx context.Context, volOptions *volumeOptions, cr *util.C
|
||||
|
||||
type localClusterState struct {
|
||||
// set true if cluster supports resize functionality.
|
||||
resizeSupported bool
|
||||
resizeSupported *bool
|
||||
// set true once a subvolumegroup is created
|
||||
// for corresponding cluster.
|
||||
subVolumeGroupCreated bool
|
||||
@ -201,7 +201,10 @@ func resizeVolume(ctx context.Context, volOptions *volumeOptions, cr *util.Crede
|
||||
}
|
||||
// resize subvolume when either it's supported, or when corresponding
|
||||
// clusterID key was not present.
|
||||
if clusterAdditionalInfo[volOptions.ClusterID].resizeSupported || !keyPresent {
|
||||
if clusterAdditionalInfo[volOptions.ClusterID].resizeSupported == nil || *clusterAdditionalInfo[volOptions.ClusterID].resizeSupported {
|
||||
if clusterAdditionalInfo[volOptions.ClusterID].resizeSupported == nil {
|
||||
clusterAdditionalInfo[volOptions.ClusterID].resizeSupported = new(bool)
|
||||
}
|
||||
args := []string{
|
||||
"fs",
|
||||
"subvolume",
|
||||
@ -223,7 +226,7 @@ func resizeVolume(ctx context.Context, volOptions *volumeOptions, cr *util.Crede
|
||||
args[:]...)
|
||||
|
||||
if err == nil {
|
||||
clusterAdditionalInfo[volOptions.ClusterID].resizeSupported = true
|
||||
*clusterAdditionalInfo[volOptions.ClusterID].resizeSupported = true
|
||||
return nil
|
||||
}
|
||||
// Incase the error is other than invalid command return error to the caller.
|
||||
@ -232,7 +235,7 @@ func resizeVolume(ctx context.Context, volOptions *volumeOptions, cr *util.Crede
|
||||
return err
|
||||
}
|
||||
}
|
||||
clusterAdditionalInfo[volOptions.ClusterID].resizeSupported = false
|
||||
*clusterAdditionalInfo[volOptions.ClusterID].resizeSupported = false
|
||||
return createVolume(ctx, volOptions, cr, volID, bytesQuota)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user