Skip to content

Commit

Permalink
cmd/roachtest: fix --zones flag to work on AWS
Browse files Browse the repository at this point in the history
Previously the `--zones` flag only worked on GCE and Azure and was
silently ignored on AWS. Noticed in passing while trying to run a
roachtest on a different AWS zone.

Release note: None
  • Loading branch information
petermattis committed Jul 3, 2020
1 parent b6e7102 commit 6c96546
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions pkg/cmd/roachtest/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -853,21 +853,32 @@ func (s *clusterSpec) args() []string {
machineTypeArg := machineTypeFlag(machineType) + "=" + machineType
args = append(args, machineTypeArg)
}
if s.Zones != "" {
switch cloud {
case gce:
if s.Geo {
args = append(args, "--gce-zones="+s.Zones)
} else {
args = append(args, "--gce-zones="+firstZone(s.Zones))

if !local {
zones := s.Zones
if zones == "" {
zones = zonesF
}
if zones != "" {
if !s.Geo {
zones = firstZone(zones)
}
case azure:
args = append(args, "--azure-locations="+s.Zones)
default:
fmt.Fprintf(os.Stderr, "specifying zones is not yet supported on %s", cloud)
os.Exit(1)
var arg string
switch cloud {
case aws:
arg = "--aws-zones=" + zones
case gce:
arg = "--gce-zones=" + zones
case azure:
arg = "--azure-locations=" + zones
default:
fmt.Fprintf(os.Stderr, "specifying zones is not yet supported on %s", cloud)
os.Exit(1)
}
args = append(args, arg)
}
}

if s.Geo {
args = append(args, "--geo")
}
Expand Down Expand Up @@ -1175,13 +1186,6 @@ func (f *clusterFactory) newCluster(

sargs := []string{roachprod, "create", c.name, "-n", fmt.Sprint(c.spec.NodeCount)}
sargs = append(sargs, cfg.spec.args()...)
if !local && zonesF != "" && cfg.spec.Zones == "" {
if cfg.spec.Geo {
sargs = append(sargs, "--gce-zones="+zonesF)
} else {
sargs = append(sargs, "--gce-zones="+firstZone(zonesF))
}
}
if !cfg.useIOBarrier {
sargs = append(sargs, "--local-ssd-no-ext4-barrier")
}
Expand Down

0 comments on commit 6c96546

Please sign in to comment.