Skip to content
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

Enforce offline volume expansion #265

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions mock/service/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ func (s *service) ControllerPublishVolume(
v.VolumeContext[ReadOnlyKey] = roVal
s.vols[i] = v

if volInfo, ok := MockVolumes[req.VolumeId]; ok {
volInfo.ISPublished = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ISPublished is used for NodePublish/Unpublish, not for ControllerPublish. If you need to check for attached volumes before resizing them, add a separate IsControllerPublished flag to volInfo.

Which brings me to question, expanding an attached and unmounted volume is online or offline resize?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is still considered online.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack. the offline check does uses IsPublished check, so I will update that code too.

MockVolumes[req.VolumeId] = volInfo
}

if hookVal, hookMsg := s.execHook("ControllerPublishVolumeEnd"); hookVal != codes.OK {
return nil, status.Errorf(hookVal, hookMsg)
}
Expand Down
1 change: 0 additions & 1 deletion mock/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ type service struct {
}

type Volume struct {
sync.Mutex
VolumeCSI csi.Volume
NodeID string
ISStaged bool
Expand Down