Simplify version check for port count argument

Might be personal preference, but I think this reads more clearly
This commit is contained in:
Ed Maxwell-Lyte 2019-01-09 08:45:01 +00:00
parent 758a56f91b
commit 346f5d9bba
1 changed files with 5 additions and 4 deletions

View File

@ -25,11 +25,12 @@ func (d *VBox42Driver) CreateSATAController(vmName string, name string, portcoun
}
portCountArg := "--portcount"
if strings.HasPrefix(version, "0.") || strings.HasPrefix(version, "1.") || strings.HasPrefix(version, "2.") ||
strings.HasPrefix(version, "3.") || strings.HasPrefix(version, "4.0") || strings.HasPrefix(version, "4.1") ||
strings.HasPrefix(version, "4.2") {
for _, prefix := range [7]string{"0.", "1.", "2.", "3.", "4.0", "4.1", "4.2"} {
if strings.HasPrefix(version, prefix) {
portCountArg = "--sataportcount"
}
}
command := []string{
"storagectl", vmName,