Skip to content

Commit 5777b91

Browse files
authored
Merge pull request kubernetes#90792 from jsafrane/cinder-resize-event
Send a nicer event when resizing attached Cinder volume
2 parents 694a9c2 + fadc670 commit 5777b91

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

staging/src/k8s.io/legacy-cloud-providers/openstack/openstack_volumes.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,12 @@ func (os *OpenStack) ExpandVolume(volumeID string, oldSize resource.Quantity, ne
419419
}
420420
if volume.Status != volumeAvailableStatus {
421421
// cinder volume can not be expanded if its status is not available
422-
return oldSize, fmt.Errorf("volume in %s status can not be expanded, it must be available and not attached to a node", volume.Status)
422+
if volume.Status == volumeInUseStatus {
423+
// Send a nice event when the volume is used
424+
return oldSize, fmt.Errorf("PVC used by a Pod can not be expanded, please ensure the PVC is not used by any Pod and is fully detached from a node")
425+
}
426+
// Send not so nice event when the volume is in any other state (deleted, error)
427+
return oldSize, fmt.Errorf("volume in state %q can not be expanded, it must be \"available\"", volume.Status)
423428
}
424429

425430
// Cinder works with gigabytes, convert to GiB with rounding up

0 commit comments

Comments
 (0)