Skip to content

Commit

Permalink
Fix zone mapping for gcepd (#5241)
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepikaDixit authored and Ilya Kislenko committed Mar 21, 2019
1 parent f9cefae commit 8ec2d8f
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 63 deletions.
116 changes: 61 additions & 55 deletions pkg/blockstorage/gcepd/gcepd.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,112 +400,118 @@ func staticRegionToZones(region string) ([]string, error) {
switch region {
case "asia-east1":
return []string{
"asia-east1a",
"asia-east1b",
"asia-east1c",
"asia-east1-a",
"asia-east1-b",
"asia-east1-c",
}, nil
case "asia-east2":
return []string{
"asia-east2a",
"asia-east2b",
"asia-east2c",
"asia-east2-a",
"asia-east2-b",
"asia-east2-c",
}, nil
case "asia-northeast1":
return []string{
"asia-northeast1a",
"asia-northeast1b",
"asia-northeast1c",
"asia-northeast1-a",
"asia-northeast1-b",
"asia-northeast1-c",
}, nil
case "asia-south1":
return []string{
"asia-south1a",
"asia-south1b",
"asia-south1c",
"asia-south1-a",
"asia-south1-b",
"asia-south1-c",
}, nil
case "asia-southeast1":
return []string{
"asia-southeast1a",
"asia-southeast1b",
"asia-southeast1c",
"asia-southeast1-a",
"asia-southeast1-b",
"asia-southeast1-c",
}, nil
case "australia-southeast1":
return []string{
"australia-southeast1a",
"australia-southeast1b",
"australia-southeast1c",
"australia-southeast1-a",
"australia-southeast1-b",
"australia-southeast1-c",
}, nil
case "europe-north1":
return []string{
"europe-north1a",
"europe-north1b",
"europe-north1c",
"europe-north1-a",
"europe-north1-b",
"europe-north1-c",
}, nil
case "europe-west1":
return []string{
"europe-west1b",
"europe-west1c",
"europe-west1d",
"europe-west1-b",
"europe-west1-c",
"europe-west1-d",
}, nil
case "europe-west2":
return []string{
"europe-west2a",
"europe-west2b",
"europe-west2c",
"europe-west2-a",
"europe-west2-b",
"europe-west2-c",
}, nil
case "europe-west3":
return []string{
"europe-west3a",
"europe-west3b",
"europe-west3c",
"europe-west3-a",
"europe-west3-b",
"europe-west3-c",
}, nil
case "europe-west4":
return []string{
"europe-west4a",
"europe-west4b",
"europe-west4c",
"europe-west4-a",
"europe-west4-b",
"europe-west4-c",
}, nil
case "europe-west6":
return []string{
"europe-west6-a",
"europe-west6-b",
"europe-west6-c",
}, nil
case "northamerica-northeast1":
return []string{
"northamerica-northeast1a",
"northamerica-northeast1b",
"northamerica-northeast1c",
"northamerica-northeast1-a",
"northamerica-northeast1-b",
"northamerica-northeast1-c",
}, nil
case "southamerica-east1":
return []string{
"southamerica-east1",
"southamerica-east1b",
"southamerica-east1c",
"southamerica-east1-a",
"southamerica-east1-b",
"southamerica-east1-c",
}, nil
case "us-central1":
return []string{
"us-central1a",
"us-central1b",
"us-central1c",
"us-central1f",
"us-central1-a",
"us-central1-b",
"us-central1-c",
"us-central1-f",
}, nil
case "us-east1":
return []string{
"us-east1b",
"us-east1c",
"us-east1d",
"us-east1-b",
"us-east1-c",
"us-east1-d",
}, nil
case "us-east4":
return []string{
"us-east4a",
"us-east4b",
"us-east4c",
"us-east4-a",
"us-east4-b",
"us-east4-c",
}, nil
case "us-west1":
return []string{
"us-west1a",
"us-west1b",
"us-west1c",
"us-west1-a",
"us-west1-b",
"us-west1-c",
}, nil
case "us-west2":
return []string{
"us-west2a",
"us-west2b",
"us-west2c",
"us-west2-a",
"us-west2-b",
"us-west2-c",
}, nil
}
return nil, errors.New("cannot get availability zones for region")
Expand Down
16 changes: 8 additions & 8 deletions pkg/blockstorage/gcepd/zone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@ func (s ZoneSuite) TestZoneWithUnknownNodeZones(c *C) {
}{
{
region: "us-west2",
in: "us-west2a",
out: "us-west2a",
in: "us-west2-a",
out: "us-west2-a",
},
{
region: "us-west2",
in: "us-east1f",
out: "us-west2a",
in: "us-east1-f",
out: "us-west2-a",
},
{
region: "us-west2",
in: "us-east2b",
out: "us-west2b",
in: "us-east2-b",
out: "us-west2-b",
},
{
region: "us-west2",
in: "us-east1f",
out: "us-west2a",
in: "us-east1-f",
out: "us-west2-a",
},
} {
var t = &gcpTest{}
Expand Down

0 comments on commit 8ec2d8f

Please sign in to comment.