Skip to content

Commit c8940c4

Browse files
committed
Add a new field for ControllerPublish'd state
1 parent 639e97d commit c8940c4

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

mock/service/controller.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ func (s *service) ControllerPublishVolume(
228228
s.vols[i] = v
229229

230230
if volInfo, ok := MockVolumes[req.VolumeId]; ok {
231-
volInfo.ISPublished = true
231+
volInfo.ISControllerPublished = true
232232
MockVolumes[req.VolumeId] = volInfo
233233
}
234234

@@ -628,8 +628,8 @@ func (s *service) ControllerExpandVolume(
628628
return nil, status.Error(codes.NotFound, req.VolumeId)
629629
}
630630

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

635635
requestBytes := req.CapacityRange.RequiredBytes

mock/service/service.go

+8-7
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,14 @@ type service struct {
109109
}
110110

111111
type Volume struct {
112-
VolumeCSI csi.Volume
113-
NodeID string
114-
ISStaged bool
115-
ISPublished bool
116-
ISEphemeral bool
117-
StageTargetPath string
118-
TargetPath string
112+
VolumeCSI csi.Volume
113+
NodeID string
114+
ISStaged bool
115+
ISPublished bool
116+
ISEphemeral bool
117+
ISControllerPublished bool
118+
StageTargetPath string
119+
TargetPath string
119120
}
120121

121122
var MockVolumes map[string]Volume

0 commit comments

Comments
 (0)