From 5cec01d4d4fb9268da4e934621be1758fc8b11a6 Mon Sep 17 00:00:00 2001 From: Timo Reimann Date: Tue, 7 Apr 2020 22:56:10 +0200 Subject: [PATCH] Return minimum disk size field from snapshot response We incorrectly returned the billable size of the snapshot instead of the minimum size. The latter represents the usable size the volume was created with and serves as a hint to Kubernetes for how big volumes created off of snapshots should be. --- CHANGELOG.md | 2 ++ driver/controller.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90e4b05cf..8a46979ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## unreleased +* Return minimum disk size field from snapshot response + [[GH-298]](https://github.com/digitalocean/csi-digitalocean/pull/298) * Improve debug HTTP server usage [[GH-281]](https://github.com/digitalocean/csi-digitalocean/pull/281) diff --git a/driver/controller.go b/driver/controller.go index daed5a51e..6a879e47d 100644 --- a/driver/controller.go +++ b/driver/controller.go @@ -1108,7 +1108,7 @@ func toCSISnapshot(snap *godo.Snapshot) (*csi.Snapshot, error) { return &csi.Snapshot{ SnapshotId: snap.ID, SourceVolumeId: snap.ResourceID, - SizeBytes: int64(snap.SizeGigaBytes) * giB, + SizeBytes: int64(snap.MinDiskSize) * giB, CreationTime: tstamp, ReadyToUse: true, }, nil