Skip to content

Commit 2ac5a8c

Browse files
authored
Merge pull request #331 from pohly/resource-exhausted-fix
resource exhausted fix
2 parents 9886a4f + f41ca87 commit 2ac5a8c

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

pkg/hostpath/controllerserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func (hp *hostPath) CreateVolume(ctx context.Context, req *csi.CreateVolumeReque
139139
kind := req.GetParameters()[storageKind]
140140
vol, err := hp.createVolume(volumeID, req.GetName(), capacity, requestedAccessType, false /* ephemeral */, kind)
141141
if err != nil {
142-
return nil, fmt.Errorf("failed to create volume %v: %w", volumeID, err)
142+
return nil, err
143143
}
144144
glog.V(4).Infof("created volume %s at path %s", vol.VolID, vol.VolPath)
145145

pkg/hostpath/hostpath.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,12 @@ func (hp *hostPath) createVolume(volID, name string, cap int64, volAccessType st
157157
}
158158
if kind == "" {
159159
// Still nothing?!
160-
return nil, status.Errorf(codes.OutOfRange, "requested capacity %d of arbitrary storage exceeds all remaining capacity", cap)
160+
return nil, status.Errorf(codes.ResourceExhausted, "requested capacity %d of arbitrary storage exceeds all remaining capacity", cap)
161161
}
162162
used := hp.sumVolumeSizes(kind)
163163
available := hp.config.Capacity[kind]
164164
if used+cap > available.Value() {
165-
166-
return nil, status.Errorf(codes.OutOfRange, "requested capacity %d exceeds remaining capacity for %q, %s out of %s already used",
165+
return nil, status.Errorf(codes.ResourceExhausted, "requested capacity %d exceeds remaining capacity for %q, %s out of %s already used",
167166
cap, kind, resource.NewQuantity(used, resource.BinarySI).String(), available.String())
168167
}
169168
} else if kind != "" {

0 commit comments

Comments
 (0)