@@ -25,13 +25,11 @@ import (
2525type fileSystemType int
2626
2727const (
28- // Since ext4 is the default of 0, it isn't being
29- // used anywhere in the code. Therefore, it isn't
30- // added as a const here since it is unused, and
31- // leads to a lint error.
32-
33- // Zfs file system.
34- Zfs fileSystemType = 1
28+ Ext4 fileSystemType = iota
29+ Zfs
30+ Xfs
31+ F2fs
32+ Btrfs
3533
3634 // Extra labels added by roachtest
3735 RoachtestBranch = "roachtest-branch"
@@ -205,6 +203,8 @@ type ClusterSpec struct {
205203 SSDs int
206204 RAID0 bool
207205 VolumeSize int
206+ VolumeType string
207+ VolumeCount int
208208 LocalSSD LocalSSDSetting
209209 Geo bool
210210 Lifetime time.Duration
@@ -224,8 +224,6 @@ type ClusterSpec struct {
224224 GCE struct {
225225 MachineType string
226226 MinCPUPlatform string
227- VolumeType string
228- VolumeCount int // volume count is only supported for GCE. This can be moved up if we start supporting other clouds
229227 Zones string
230228 } `cloud:"gce"`
231229
@@ -242,13 +240,13 @@ type ClusterSpec struct {
242240 // Azure-specific arguments. These values apply only on clusters instantiated on Azure.
243241 Azure struct {
244242 Zones string
243+ // VolumeIOPS is the provisioned IOPS for ultra-disks.
244+ VolumeIOPS int
245245 } `cloud:"azure"`
246246 // IBM-specific arguments. These values apply only on clusters instantiated on IBM.
247247 IBM struct {
248248 MachineType string
249- VolumeType string
250249 VolumeIOPS int
251- VolumeCount int
252250 Zones string
253251 } `cloud:"ibm"`
254252}
@@ -319,16 +317,24 @@ func awsMachineSupportsSSD(machineType string) bool {
319317
320318func getAWSOpts (
321319 machineType string ,
322- volumeSize , ebsThroughput int ,
320+ volumeSize , volumeCount , ebsThroughput int ,
321+ volumeType string ,
323322 ebsIOPS int ,
324323 localSSD bool ,
324+ RAID0 bool ,
325325 useSpotVMs bool ,
326326 bootDiskOnly bool ,
327327) vm.ProviderOpts {
328328 opts := aws .DefaultProviderOpts ()
329329 if volumeSize != 0 {
330330 opts .DefaultEBSVolume .Disk .VolumeSize = volumeSize
331331 }
332+ if volumeType != "" {
333+ opts .DefaultEBSVolume .Disk .VolumeType = volumeType
334+ }
335+ if volumeCount != 0 {
336+ opts .EBSVolumeCount = volumeCount
337+ }
332338 if ebsIOPS != 0 {
333339 opts .DefaultEBSVolume .Disk .IOPs = ebsIOPS
334340 }
@@ -340,6 +346,7 @@ func getAWSOpts(
340346 } else {
341347 opts .MachineType = machineType
342348 }
349+ opts .UseMultipleDisks = ! RAID0
343350 opts .UseSpot = useSpotVMs
344351 opts .BootDiskOnly = bootDiskOnly
345352 return opts
@@ -389,13 +396,31 @@ func getGCEOpts(
389396 return opts
390397}
391398
392- func getAzureOpts (machineType string , volumeSize int , bootDiskOnly bool ) vm.ProviderOpts {
399+ func getAzureOpts (
400+ machineType string ,
401+ volumeSize int ,
402+ volumeType string ,
403+ volumeCount int ,
404+ volumeIOPS int ,
405+ RAID0 bool ,
406+ bootDiskOnly bool ,
407+ ) vm.ProviderOpts {
393408 opts := azure .DefaultProviderOpts ()
394409 opts .MachineType = machineType
395410 if volumeSize != 0 {
396411 opts .NetworkDiskSize = int32 (volumeSize )
397412 }
398413 opts .BootDiskOnly = bootDiskOnly
414+ if volumeType != "" {
415+ opts .NetworkDiskType = volumeType
416+ }
417+ if volumeCount != 0 {
418+ opts .NetworkDiskCount = volumeCount
419+ }
420+ if volumeIOPS != 0 {
421+ opts .UltraDiskIOPS = int64 (volumeIOPS )
422+ }
423+ opts .UseMultipleDisks = ! RAID0
399424 return opts
400425}
401426
@@ -405,7 +430,7 @@ func getIBMOpts(
405430 volumeSize int ,
406431 volumeType string ,
407432 volumeIOPS int ,
408- extraVolumeCount int ,
433+ volumeCount int ,
409434 RAID0 bool ,
410435 bootDiskOnly bool ,
411436) vm.ProviderOpts {
@@ -424,17 +449,10 @@ func getIBMOpts(
424449 }
425450
426451 // We reuse the parameters of the default data volume for extra volumes.
427- opts .AttachedVolumes = make (ibm.IbmVolumeList , 0 )
428- if extraVolumeCount > 0 {
429- for i := 0 ; i < extraVolumeCount ; i ++ {
430- opts .AttachedVolumes = append (opts .AttachedVolumes , & ibm.IbmVolume {
431- VolumeType : opts .DefaultVolume .VolumeType ,
432- VolumeSize : opts .DefaultVolume .VolumeSize ,
433- IOPS : opts .DefaultVolume .IOPS ,
434- })
435- }
436- opts .UseMultipleDisks = ! RAID0
452+ if volumeCount != 0 {
453+ opts .AttachedVolumesCount = volumeCount
437454 }
455+ opts .UseMultipleDisks = ! RAID0
438456 opts .BootDiskOnly = bootDiskOnly
439457
440458 return opts
@@ -594,18 +612,25 @@ func (s *ClusterSpec) RoachprodOpts(
594612 }
595613 }
596614
597- if s .FileSystem == Zfs {
598- if cloud != GCE && cloud != IBM {
599- return vm.CreateOpts {}, nil , nil , "" , errors .Errorf (
600- "node creation with zfs file system not yet supported on %s" , cloud ,
601- )
615+ switch s .FileSystem {
616+ case Ext4 :
617+ // ext4 is the default, do nothing unless we randomly want to use zfs
618+ if s .RandomlyUseZfs {
619+ rng , _ := randutil .NewPseudoRand ()
620+ if rng .Float64 () <= 0.2 {
621+ createVMOpts .SSDOpts .FileSystem = vm .Zfs
622+ }
602623 }
624+ case Zfs :
603625 createVMOpts .SSDOpts .FileSystem = vm .Zfs
604- } else if s .RandomlyUseZfs && (cloud == GCE || cloud == IBM ) {
605- rng , _ := randutil .NewPseudoRand ()
606- if rng .Float64 () <= 0.2 {
607- createVMOpts .SSDOpts .FileSystem = vm .Zfs
608- }
626+ case Xfs :
627+ createVMOpts .SSDOpts .FileSystem = vm .Xfs
628+ case F2fs :
629+ createVMOpts .SSDOpts .FileSystem = vm .F2fs
630+ case Btrfs :
631+ createVMOpts .SSDOpts .FileSystem = vm .Btrfs
632+ default :
633+ return vm.CreateOpts {}, nil , nil , "" , errors .Errorf ("unknown file system type: %v" , s .FileSystem )
609634 }
610635
611636 var workloadMachineType string
@@ -633,30 +658,34 @@ func (s *ClusterSpec) RoachprodOpts(
633658 var workloadProviderOpts vm.ProviderOpts
634659 switch cloud {
635660 case AWS :
636- providerOpts = getAWSOpts (machineType , s .VolumeSize , s .AWS .VolumeThroughput , s .AWS .VolumeIOPS ,
637- createVMOpts .SSDOpts .UseLocalSSD , s .UseSpotVMs , false )
638- workloadProviderOpts = getAWSOpts (workloadMachineType , s .VolumeSize , s .AWS .VolumeThroughput , s .AWS .VolumeIOPS ,
639- createVMOpts .SSDOpts .UseLocalSSD , s .UseSpotVMs , ! s .WorkloadRequiresDisk )
661+ providerOpts = getAWSOpts (machineType , s .VolumeSize , s .VolumeCount , s . AWS .VolumeThroughput , s . VolumeType , s .AWS .VolumeIOPS ,
662+ createVMOpts .SSDOpts .UseLocalSSD , s .RAID0 , s . UseSpotVMs , false )
663+ workloadProviderOpts = getAWSOpts (workloadMachineType , s .VolumeSize , s .VolumeCount , s . AWS .VolumeThroughput , s . VolumeType , s .AWS .VolumeIOPS ,
664+ createVMOpts .SSDOpts .UseLocalSSD , s .RAID0 , s . UseSpotVMs , ! s .WorkloadRequiresDisk )
640665 case GCE :
641666 providerOpts = getGCEOpts (machineType , s .VolumeSize , ssdCount ,
642667 createVMOpts .SSDOpts .UseLocalSSD , s .RAID0 , s .TerminateOnMigration ,
643- s .GCE .MinCPUPlatform , vm .ParseArch (createVMOpts .Arch ), s .GCE . VolumeType ,
644- s .GCE . VolumeCount , s .UseSpotVMs , false ,
668+ s .GCE .MinCPUPlatform , vm .ParseArch (createVMOpts .Arch ), s .VolumeType ,
669+ s .VolumeCount , s .UseSpotVMs , false ,
645670 )
646671 workloadProviderOpts = getGCEOpts (workloadMachineType , s .VolumeSize , ssdCount ,
647672 createVMOpts .SSDOpts .UseLocalSSD , s .RAID0 , s .TerminateOnMigration ,
648- s .GCE .MinCPUPlatform , vm .ParseArch (createVMOpts .Arch ), s .GCE . VolumeType ,
649- s .GCE . VolumeCount , s .UseSpotVMs , ! s .WorkloadRequiresDisk ,
673+ s .GCE .MinCPUPlatform , vm .ParseArch (createVMOpts .Arch ), s .VolumeType ,
674+ s .VolumeCount , s .UseSpotVMs , ! s .WorkloadRequiresDisk ,
650675 )
651676 case Azure :
652- providerOpts = getAzureOpts (machineType , s .VolumeSize , false )
653- workloadProviderOpts = getAzureOpts (workloadMachineType , s .VolumeSize , true )
677+ providerOpts = getAzureOpts (machineType ,
678+ s .VolumeSize , s .VolumeType , s .VolumeCount , s .Azure .VolumeIOPS , s .RAID0 , false ,
679+ )
680+ workloadProviderOpts = getAzureOpts (workloadMachineType ,
681+ s .VolumeSize , s .VolumeType , s .VolumeCount , s .Azure .VolumeIOPS , s .RAID0 , true ,
682+ )
654683 case IBM :
655- providerOpts = getIBMOpts (machineType , s .TerminateOnMigration , s . VolumeSize ,
656- s .IBM .VolumeType , s .IBM .VolumeIOPS , s . IBM .VolumeCount , s .RAID0 , false ,
684+ providerOpts = getIBMOpts (machineType , s .TerminateOnMigration ,
685+ s .VolumeSize , s .VolumeType , s .IBM .VolumeIOPS , s .VolumeCount , s .RAID0 , false ,
657686 )
658- workloadProviderOpts = getIBMOpts (workloadMachineType , s .TerminateOnMigration , s . VolumeSize ,
659- s .IBM .VolumeType , s .IBM .VolumeIOPS , s . IBM .VolumeCount , s .RAID0 , true ,
687+ workloadProviderOpts = getIBMOpts (workloadMachineType , s .TerminateOnMigration ,
688+ s .VolumeSize , s .VolumeType , s .IBM .VolumeIOPS , s .VolumeCount , s .RAID0 , true ,
660689 )
661690 }
662691
0 commit comments