Skip to content

Commit

Permalink
Update GetMultiWriter() to reflect support for multi-writer in v1 disks
Browse files Browse the repository at this point in the history
  • Loading branch information
karkunpavan committed Nov 14, 2024
1 parent 35d3d55 commit 4168542
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pkg/gce-cloud-provider/compute/cloud-disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ func (d *CloudDisk) GetKMSKeyName() string {

func (d *CloudDisk) GetMultiWriter() bool {
switch {
case d.disk != nil:
return false
case d.disk != nil && d.disk.AccessMode == "READ_WRITE_MANY":
return true
case d.betaDisk != nil:
return d.betaDisk.MultiWriter
default:
Expand Down
9 changes: 3 additions & 6 deletions pkg/gce-cloud-provider/compute/gce-compute.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,9 +553,6 @@ func convertV1DiskToBetaDisk(v1Disk *computev1.Disk) *computebeta.Disk {
AccessMode: v1Disk.AccessMode,
}

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

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

// Use beta API for non-hyperdisk types in multi-writer mode.
if multiWriter && !strings.Contains(params.DiskType, "hyperdisk") {
gceAPIVersion = GCEAPIVersionBeta
}
Expand Down Expand Up @@ -778,6 +773,8 @@ func (cloud *CloudProvider) insertZonalDisk(
opName string
gceAPIVersion = GCEAPIVersionV1
)

// Use beta API for non-hyperdisk types in multi-writer mode.
if multiWriter && !strings.Contains(params.DiskType, "hyperdisk") {
gceAPIVersion = GCEAPIVersionBeta
}
Expand Down

0 comments on commit 4168542

Please sign in to comment.