Skip to content

Commit 4168542

Browse files
committed
Update GetMultiWriter() to reflect support for multi-writer in v1 disks
1 parent 35d3d55 commit 4168542

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

pkg/gce-cloud-provider/compute/cloud-disk.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ func (d *CloudDisk) GetKMSKeyName() string {
215215

216216
func (d *CloudDisk) GetMultiWriter() bool {
217217
switch {
218-
case d.disk != nil:
219-
return false
218+
case d.disk != nil && d.disk.AccessMode == "READ_WRITE_MANY":
219+
return true
220220
case d.betaDisk != nil:
221221
return d.betaDisk.MultiWriter
222222
default:

pkg/gce-cloud-provider/compute/gce-compute.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -553,9 +553,6 @@ func convertV1DiskToBetaDisk(v1Disk *computev1.Disk) *computebeta.Disk {
553553
AccessMode: v1Disk.AccessMode,
554554
}
555555

556-
// Hyperdisk doesn't currently support multiWriter (https://cloud.google.com/compute/docs/disks/hyperdisks#limitations),
557-
// but if multiWriter + hyperdisk is supported in the future, we want the PDCSI driver to support this feature without
558-
// any additional code change.
559556
if v1Disk.ProvisionedIops > 0 {
560557
betaDisk.ProvisionedIops = v1Disk.ProvisionedIops
561558
}
@@ -619,9 +616,6 @@ func convertBetaDiskToV1Disk(betaDisk *computebeta.Disk) *computev1.Disk {
619616
AccessMode: betaDisk.AccessMode,
620617
}
621618

622-
// Hyperdisk doesn't currently support multiWriter (https://cloud.google.com/compute/docs/disks/hyperdisks#limitations),
623-
// but if multiWriter + hyperdisk is supported in the future, we want the PDCSI driver to support this feature without
624-
// any additional code change.
625619
if betaDisk.ProvisionedIops > 0 {
626620
v1Disk.ProvisionedIops = betaDisk.ProvisionedIops
627621
}
@@ -651,6 +645,7 @@ func (cloud *CloudProvider) insertRegionalDisk(
651645
gceAPIVersion = GCEAPIVersionV1
652646
)
653647

648+
// Use beta API for non-hyperdisk types in multi-writer mode.
654649
if multiWriter && !strings.Contains(params.DiskType, "hyperdisk") {
655650
gceAPIVersion = GCEAPIVersionBeta
656651
}
@@ -778,6 +773,8 @@ func (cloud *CloudProvider) insertZonalDisk(
778773
opName string
779774
gceAPIVersion = GCEAPIVersionV1
780775
)
776+
777+
// Use beta API for non-hyperdisk types in multi-writer mode.
781778
if multiWriter && !strings.Contains(params.DiskType, "hyperdisk") {
782779
gceAPIVersion = GCEAPIVersionBeta
783780
}

0 commit comments

Comments
 (0)