Skip to content

Commit

Permalink
Add a new field for ControllerPublish'd state
Browse files Browse the repository at this point in the history
  • Loading branch information
gnufied committed May 6, 2020
1 parent 639e97d commit bf51384
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions mock/service/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func (s *service) ControllerPublishVolume(
s.vols[i] = v

if volInfo, ok := MockVolumes[req.VolumeId]; ok {
volInfo.ISPublished = true
volInfo.ISControllerPublished = true
MockVolumes[req.VolumeId] = volInfo
}

Expand Down Expand Up @@ -628,7 +628,7 @@ func (s *service) ControllerExpandVolume(
return nil, status.Error(codes.NotFound, req.VolumeId)
}

if s.config.DisableOnlineExpansion && MockVolumes[v.GetVolumeId()].ISPublished {
if s.config.DisableOnlineExpansion && MockVolumes[v.GetVolumeId()].ISControllerPublished {
return nil, status.Error(codes.Aborted, "volume is published and online volume expansion is not supported")
}

Expand Down
15 changes: 8 additions & 7 deletions mock/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,14 @@ type service struct {
}

type Volume struct {
VolumeCSI csi.Volume
NodeID string
ISStaged bool
ISPublished bool
ISEphemeral bool
StageTargetPath string
TargetPath string
VolumeCSI csi.Volume
NodeID string
ISStaged bool
ISPublished bool
ISEphemeral bool
ISControllerPublished bool
StageTargetPath string
TargetPath string
}

var MockVolumes map[string]Volume
Expand Down

0 comments on commit bf51384

Please sign in to comment.