nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: kubernetes-sigs/gcp-compute-persistent-disk-csi-driver
Pull request #2012 (2025-03-21 02:35:08)

[release-1.17] Fix units for cache size while calculating chunk size for LVM
This is an automated cherry-pick of #2007

/assign Sneha-at

```release-note
Fix unit calculation bug for cache size setup
```


Patch:
diff --git a/pkg/gce-pd-csi-driver/cache.go b/pkg/gce-pd-csi-driver/cache.go
index 1c5f4d19..0e26953d 100644
--- a/pkg/gce-pd-csi-driver/cache.go
+++ b/pkg/gce-pd-csi-driver/cache.go
@@ -210,7 +210,7 @@ func setupCaching(devicePath string, req *csi.NodeStageVolumeRequest, nodeId str
 			req.GetPublishContext()[common.ContextDataCacheMode],
 			volumeGroupName + "/" + mainLvName,
 			"--chunksize",
-			chunkSize, // default unit is KiB
+			chunkSize,
 			"--force",
 			"-y",
 		}
@@ -563,7 +563,7 @@ func isCachingSetup(mainLvName string) (error, bool) {
 func fetchChunkSizeKiB(cacheSize string) (string, error) {
 	var chunkSize float64
 
-	cacheSizeInt, err := common.ConvertGiStringToInt64(cacheSize)
+	cacheSizeInt, err := strconv.ParseInt(cacheSize, 10, 64)
 	if err != nil {
 		return "0", err
 	}


Test patch:
diff --git a/pkg/gce-pd-csi-driver/cache_test.go b/pkg/gce-pd-csi-driver/cache_test.go
index 918f26b0..4574dde4 100644
--- a/pkg/gce-pd-csi-driver/cache_test.go
+++ b/pkg/gce-pd-csi-driver/cache_test.go
@@ -13,22 +13,22 @@ func TestFetchChunkSizeKiB(t *testing.T) {
 	}{
 		{
 			name:         "chunk size is in the allowed range",
-			cacheSize:    "500Gi",
+			cacheSize:    "500",
 			expChunkSize: "512KiB", //range defined in fetchChunkSizeKiB
 		},
 		{
 			name:         "chunk size is set to the range ceil",
-			cacheSize:    "30000000Gi",
+			cacheSize:    "30000000",
 			expChunkSize: "1048576KiB", //range defined in fetchChunkSizeKiB - max 1GiB
 		},
 		{
 			name:         "chunk size is set to the allowed range floor",
-			cacheSize:    "10Gi",
+			cacheSize:    "100",
 			expChunkSize: "160KiB", //range defined in fetchChunkSizeKiB - min 160 KiB
 		},
 		{
 			name:         "cacheSize set to KiB also sets the chunk size to range floor",
-			cacheSize:    "100Ki",
+			cacheSize:    "1",
 			expChunkSize: "160KiB", //range defined in fetchChunkSizeKiB - min 160 KiB
 		},
 		{
diff --git a/test/remote/client-wrappers.go b/test/remote/client-wrappers.go
index 83c6db3a..9994f9ea 100644
--- a/test/remote/client-wrappers.go
+++ b/test/remote/client-wrappers.go
@@ -56,7 +56,7 @@ const (
 	// Keys in the volume context.
 	contextForceAttach = "force-attach"
 
-	defaultLocalSsdCacheSize = "200Gi"
+	defaultLocalSsdCacheSize = "200"
 	defaultDataCacheMode     = common.DataCacheModeWriteThrough
 )
Repository: kubernetes-sigs/gcp-compute-persistent-disk-csi-driver
Pull request #2020 (2025-03-26 02:48:36)

[release-1.17] Add pageToken response check to ListSnapshots gRPC API
This is an automated cherry-pick of #2004

/assign pwschuurman

```release-note
Fix infinite loop in ListSnapshots that can cause memory usage to grow unbounded
```


Patch:
diff --git a/pkg/gce-cloud-provider/compute/gce-compute.go b/pkg/gce-cloud-provider/compute/gce-compute.go
index 63402cd2..c03ceeac 100644
--- a/pkg/gce-cloud-provider/compute/gce-compute.go
+++ b/pkg/gce-cloud-provider/compute/gce-compute.go
@@ -315,6 +315,7 @@ func (cloud *CloudProvider) ListSnapshots(ctx context.Context, filter string) ([
 			return nil, "", err
 		}
 		items = append(items, snapshotList.Items...)
+		nextPageToken = snapshotList.NextPageToken
 	}
 	return items, "", nil
 }
@@ -1310,6 +1311,7 @@ func (cloud *CloudProvider) ListImages(ctx context.Context, filter string) ([]*c
 			return nil, "", err
 		}
 		items = append(items, imageList.Items...)
+		nextPageToken = imageList.NextPageToken
 	}
 	return items, "", nil
 }


Test patch:
diff --git a/test/e2e/tests/single_zone_e2e_test.go b/test/e2e/tests/single_zone_e2e_test.go
index e3749d8f..f50994ea 100644
--- a/test/e2e/tests/single_zone_e2e_test.go
+++ b/test/e2e/tests/single_zone_e2e_test.go
@@ -1065,6 +1065,10 @@ var _ = Describe("GCE PD CSI Driver", func() {
 		})
 		Expect(err).To(BeNil(), "Could not wait for snapshot be ready")
 
+		snapshots, err := client.ListSnapshots()
+		Expect(err).To(BeNil(), "Could not list snapshots")
+		Expect(snapshots).To(ContainElement(snapshotID), "Couldn't find snapshot ID")
+
 		defer func() {
 			// Delete Disk
 			err := client.DeleteVolume(volID)
@@ -1124,6 +1128,10 @@ var _ = Describe("GCE PD CSI Driver", func() {
 		Expect(err).To(BeNil(), "Failed to parse snapshot ID")
 		Expect(snapshotType).To(Equal(common.DiskImageType), "Expected images type in snapshot ID")
 
+		snapshots, err := client.ListSnapshots()
+		Expect(err).To(BeNil(), "Could not list snapshots")
+		Expect(snapshots).To(ContainElement(snapshotID), "Couldn't find snapshot ID")
+
 		defer func() {
 			// Delete Disk
 			err := client.DeleteVolume(volID)
diff --git a/test/remote/client-wrappers.go b/test/remote/client-wrappers.go
index 9994f9ea..9f869623 100644
--- a/test/remote/client-wrappers.go
+++ b/test/remote/client-wrappers.go
@@ -310,6 +310,20 @@ func (c *CsiClient) NodeGetVolumeStats(volumeID, volumePath string) (available,
 	return
 }
 
+func (c *CsiClient) ListSnapshots() ([]string, error) {
+	lsr := &csipb.ListSnapshotsRequest{}
+	resp, err := c.ctrlClient.ListSnapshots(context.Background(), lsr)
+	if err != nil {
+		return nil, err
+	}
+
+	snapshots := []string{}
+	for _, e := range resp.Entries {
+		snapshots = append(snapshots, e.Snapshot.SnapshotId)
+	}
+	return snapshots, nil
+}
+
 func (c *CsiClient) CreateSnapshot(snapshotName, sourceVolumeId string, params map[string]string) (string, error) {
 
 	csr := &csipb.CreateSnapshotRequest{
Repository: kubernetes-sigs/gcp-compute-persistent-disk-csi-driver
Pull request #2060 (2025-04-17 14:58:47)

[release-1.17] Fix hyperdisk attach limits
This is an automated cherry-pick of #2057

/assign sunnylovestiramisu

```release-note
Fixed reporting of attachment limits of hyperdisks + gen4 VMs - reserving 1 attachment for the OS disk.
```


Patch:
diff --git a/pkg/common/constants.go b/pkg/common/constants.go
index d5e5c101..eb64d893 100644
--- a/pkg/common/constants.go
+++ b/pkg/common/constants.go
@@ -63,10 +63,10 @@ var Gen4MachineHyperdiskAttachLimitMap = []struct {
 	max   int64
 	value int64
 }{
-	{max: 4, value: 16},
-	{max: 8, value: 24},
-	{max: 16, value: 32},
-	{max: 32, value: 48},
-	{max: 64, value: 64},
-	{max: 1024, value: 128},
+	{max: 4, value: 15},
+	{max: 8, value: 23},
+	{max: 16, value: 31},
+	{max: 32, value: 49},
+	{max: 64, value: 63},
+	{max: 1024, value: 127},
 }
diff --git a/pkg/gce-pd-csi-driver/node.go b/pkg/gce-pd-csi-driver/node.go
index f45d159b..92c83bc2 100644
--- a/pkg/gce-pd-csi-driver/node.go
+++ b/pkg/gce-pd-csi-driver/node.go
@@ -99,9 +99,9 @@ const (
 	volumeLimitSmall int64 = 15
 	volumeLimitBig   int64 = 127
 	// doc https://cloud.google.com/compute/docs/memory-optimized-machines#x4_disks
-	x4HyperdiskLimit int64 = 40
+	x4HyperdiskLimit int64 = 39
 	// doc https://cloud.google.com/compute/docs/accelerator-optimized-machines#a4-disks
-	a4HyperdiskLimit     int64 = 128
+	a4HyperdiskLimit     int64 = 127
 	defaultLinuxFsType         = "ext4"
 	defaultWindowsFsType       = "ntfs"
 	fsTypeExt3                 = "ext3"


Test patch:
diff --git a/pkg/gce-pd-csi-driver/node_test.go b/pkg/gce-pd-csi-driver/node_test.go
index 57c3e82b..8f177d47 100644
--- a/pkg/gce-pd-csi-driver/node_test.go
+++ b/pkg/gce-pd-csi-driver/node_test.go
@@ -259,27 +259,27 @@ func TestNodeGetVolumeLimits(t *testing.T) {
 		{
 			name:           "c4-standard-192",
 			machineType:    "c4-standard-192",
-			expVolumeLimit: 128,
+			expVolumeLimit: 127,
 		},
 		{
 			name:           "c4-standard-48",
 			machineType:    "c4-standard-48",
-			expVolumeLimit: 64,
+			expVolumeLimit: 63,
 		},
 		{
 			name:           "c4a-standard-4",
 			machineType:    "c4a-standard-4",
-			expVolumeLimit: 16,
+			expVolumeLimit: 15,
 		},
 		{
 			name:           "n4-standard-16",
 			machineType:    "n4-standard-16",
-			expVolumeLimit: 32,
+			expVolumeLimit: 31,
 		},
 		{
 			name:           "n4-highcpu-4",
 			machineType:    "n4-highcpu-4",
-			expVolumeLimit: 16,
+			expVolumeLimit: 15,
 		},
 		{
 			name:           "invalid gen4 machine type",