Add automatic assignments of vCPUs based on host CPUs.
Fixes #535 Signed-off-by: Fabio Rapposelli <fabio@vmware.com>
This commit is contained in:
@@ -15,6 +15,7 @@ import (
|
||||
"path"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strings"
|
||||
"text/template"
|
||||
"time"
|
||||
@@ -40,6 +41,7 @@ type Driver struct {
|
||||
IPAddress string
|
||||
Memory int
|
||||
DiskSize int
|
||||
CPUs int
|
||||
ISO string
|
||||
Boot2DockerURL string
|
||||
CaCertPath string
|
||||
@@ -105,6 +107,13 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
|
||||
d.SwarmHost = flags.String("swarm-host")
|
||||
d.SwarmDiscovery = flags.String("swarm-discovery")
|
||||
|
||||
// We support a maximum of 16 cpu to be consistent with Virtual Hardware 10
|
||||
// specs.
|
||||
d.CPUs = int(runtime.NumCPU())
|
||||
if d.CPUs > 16 {
|
||||
d.CPUs = 16
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -60,4 +60,5 @@ virtualHW.productCompatibility = "hosted"
|
||||
virtualHW.version = "10"
|
||||
msg.autoanswer = "TRUE"
|
||||
uuid.action = "create"
|
||||
numvcpus = "{{.CPUs}}"
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user