Add automatic assignments of vCPUs based on host CPUs.

Fixes #535

Signed-off-by: Fabio Rapposelli <fabio@vmware.com>
This commit is contained in:
Fabio Rapposelli
2015-02-27 17:37:54 +01:00
parent 193e2b1613
commit 9410b5b208
2 changed files with 10 additions and 0 deletions

View File

@@ -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
}

View File

@@ -60,4 +60,5 @@ virtualHW.productCompatibility = "hosted"
virtualHW.version = "10"
msg.autoanswer = "TRUE"
uuid.action = "create"
numvcpus = "{{.CPUs}}"
`