Skip to content

Commit

Permalink
Ubuntu 16 fix (#820)
Browse files Browse the repository at this point in the history
  • Loading branch information
koln67 authored Oct 3, 2023
1 parent 9a76183 commit c60d094
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
11 changes: 10 additions & 1 deletion imagetest/test_suites/storageperf/iops_read_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,19 @@ func RunFIOReadLinux(mode string) ([]byte, error) {
if err != nil {
return []byte{}, err
}
// ubuntu 16.04 has a different option name due to an old fio version
image, err := utils.GetMetadata("image")
if err != nil {
return []byte{}, fmt.Errorf("couldn't get image from metadata")
}
if strings.Contains(image, "ubuntu-pro-1604") {
readOptions = strings.Replace(readOptions, "iodepth_batch_complete_max", "iodepth_batch_complete", 1)
}

fioReadOptionsLinuxSlice := strings.Fields(readOptions + " --filename=" + symlinkRealPath + " --ioengine=libaio")
readIOPSJson, err := exec.Command("fio", fioReadOptionsLinuxSlice...).CombinedOutput()
if err != nil {
return []byte{}, fmt.Errorf("fio command failed with error: %v", err)
return []byte{}, fmt.Errorf("fio command failed with error: %v %v", readIOPSJson, err)
}
return readIOPSJson, nil
}
Expand Down
11 changes: 10 additions & 1 deletion imagetest/test_suites/storageperf/iops_write_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,19 @@ func RunFIOWriteLinux(mode string) ([]byte, error) {
if err != nil {
return []byte{}, err
}
// ubuntu 16.04 has a different option name due to an old fio version
image, err := utils.GetMetadata("image")
if err != nil {
return []byte{}, fmt.Errorf("couldn't get image from metadata")
}
if strings.Contains(image, "ubuntu-pro-1604") {
writeOptions = strings.Replace(writeOptions, "iodepth_batch_complete_max", "iodepth_batch_complete", 1)
}

fioWriteOptionsLinuxSlice := strings.Fields(writeOptions + " --filename=" + symlinkRealPath + " --ioengine=libaio")
writeIOPSJson, err := exec.Command("fio", fioWriteOptionsLinuxSlice...).CombinedOutput()
if err != nil {
return []byte{}, fmt.Errorf("fio command failed with error: %v", err)
return []byte{}, fmt.Errorf("fio command failed with error: %v %v", writeIOPSJson, err)
}
return writeIOPSJson, nil
}
Expand Down
16 changes: 15 additions & 1 deletion imagetest/test_suites/storageperf/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ func TestSetup(t *imagetest.TestWorkflow) error {
if diskTypeParam, foundKey := paramMap["diskType"]; foundKey {
diskType = diskTypeParam
}
if strings.HasPrefix(machineType, "c3d") && (strings.Contains(t.Image, "windows-2012") || strings.Contains(t.Image, "windows-2016")) {
if skipMachineTypeImage(machineType, t.Image) {
continue
}

bootDisk := compute.Disk{Name: vmName + machineType + diskType, Type: imagetest.PdBalanced, SizeGb: bootdiskSizeGB}
mountDisk := compute.Disk{Name: mountDiskName + machineType + diskType, Type: diskType, SizeGb: mountdiskSizeGB}
bootDisk.Zone = paramMap["zone"]
Expand Down Expand Up @@ -98,3 +99,16 @@ func TestSetup(t *imagetest.TestWorkflow) error {
}
return nil
}

// Due to compatability issues or other one off errors, some combinations of machine types and images must be skipped. This function returns true for those combinations.
func skipMachineTypeImage(machineType, image string) bool {
if strings.HasPrefix(machineType, "c3d") && (strings.Contains(image, "windows-2012") || strings.Contains(image, "windows-2016")) {
return true
}

if strings.Contains(image, "ubuntu-pro-1604") && strings.HasPrefix(machineType, "c3-") {
return true
}

return false
}

0 comments on commit c60d094

Please sign in to comment.