-
Notifications
You must be signed in to change notification settings - Fork 554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cleanup: Support matrix update and code cleanup #4262
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -199,15 +199,13 @@ func (s *subVolumeClient) GetSubVolumeInfo(ctx context.Context) (*Subvolume, err | |
type operationState int64 | ||
|
||
const ( | ||
unknown operationState = iota | ||
supported | ||
supported operationState = iota | ||
unsupported | ||
) | ||
|
||
type localClusterState struct { | ||
// set the enum value i.e., unknown, supported, | ||
// set the enum value i.e., supported or | ||
// unsupported as per the state of the cluster. | ||
resizeState operationState | ||
subVolMetadataState operationState | ||
subVolSnapshotMetadataState operationState | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please remove can you also check do we have metadata support in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. metadata & snapshot metadata support are added on pacific from v16.2.11 and on quincy it is from v17.2.1. Should we keep both these checks for some more time in that case, if someone uses versions lower than that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If that is a supported version in ceph we need to keep it as well. ie (< 16.2.11) and (<17.2.1) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As per the docs 16.2.* and 17.2.* are still supported. So we need to keep these checks for some more time. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i believe in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the support for it is present in all the active releases. Removed it now. |
||
} | ||
|
@@ -268,39 +266,21 @@ func (s *subVolumeClient) ExpandVolume(ctx context.Context, bytesQuota int64) er | |
return err | ||
} | ||
|
||
// ResizeVolume will try to use ceph fs subvolume resize command to resize the | ||
// subvolume. If the command is not available as a fallback it will use | ||
// CreateVolume to resize the subvolume. | ||
// ResizeVolume will use the ceph fs subvolume resize command to resize the | ||
// subvolume. | ||
func (s *subVolumeClient) ResizeVolume(ctx context.Context, bytesQuota int64) error { | ||
newLocalClusterState(s.clusterID) | ||
// resize subvolume when either it's supported, or when corresponding | ||
// clusterID key was not present. | ||
if clusterAdditionalInfo[s.clusterID].resizeState == unknown || | ||
clusterAdditionalInfo[s.clusterID].resizeState == supported { | ||
fsa, err := s.conn.GetFSAdmin() | ||
if err != nil { | ||
log.ErrorLog(ctx, "could not get FSAdmin, can not resize volume %s:", s.FsName, err) | ||
|
||
return err | ||
} | ||
_, err = fsa.ResizeSubVolume(s.FsName, s.SubvolumeGroup, s.VolID, fsAdmin.ByteCount(bytesQuota), true) | ||
if err == nil { | ||
clusterAdditionalInfo[s.clusterID].resizeState = supported | ||
|
||
return nil | ||
} | ||
var invalid fsAdmin.NotImplementedError | ||
// In case the error is other than invalid command return error to the caller. | ||
if !errors.As(err, &invalid) { | ||
log.ErrorLog(ctx, "failed to resize subvolume %s in fs %s: %s", s.VolID, s.FsName, err) | ||
fsa, err := s.conn.GetFSAdmin() | ||
if err != nil { | ||
log.ErrorLog(ctx, "could not get FSAdmin, can not resize volume %s:", s.FsName, err) | ||
|
||
return err | ||
} | ||
return err | ||
} | ||
_, err = fsa.ResizeSubVolume(s.FsName, s.SubvolumeGroup, s.VolID, fsAdmin.ByteCount(bytesQuota), true) | ||
if err != nil { | ||
log.ErrorLog(ctx, "failed to resize subvolume %s in fs %s: %s", s.VolID, s.FsName, err) | ||
} | ||
clusterAdditionalInfo[s.clusterID].resizeState = unsupported | ||
s.Size = bytesQuota | ||
|
||
return s.CreateVolume(ctx) | ||
return err | ||
} | ||
|
||
// PurgSubVolume removes the subvolume. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
localClusterState
might need to be removed as well as we don't require it anymore.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the checks are needed, keeping it as it is for the time being.