mirror of https://github.com/docker/docs.git
Adds virtualbox-cpu-count - fixes #819
Signed-off-by: Paul Biggar <paul.biggar@gmail.com>
This commit is contained in:
parent
5f573a81d4
commit
dde614dbb0
|
@ -823,6 +823,7 @@ Options:
|
|||
- `--virtualbox-boot2docker-url`: The URL of the boot2docker image. Defaults to the latest available version.
|
||||
- `--virtualbox-disk-size`: Size of disk for the host in MB. Default: `20000`
|
||||
- `--virtualbox-memory`: Size of memory for the host in MB. Default: `1024`
|
||||
- `--virtualbox-cpu-count`: Number of CPUs to use to create the VM. Defaults to number of available CPUs.
|
||||
|
||||
The VirtualBox driver uses the latest boot2docker image.
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ const (
|
|||
)
|
||||
|
||||
type Driver struct {
|
||||
CPU int
|
||||
MachineName string
|
||||
SSHUser string
|
||||
SSHPort int
|
||||
|
@ -46,6 +47,7 @@ type Driver struct {
|
|||
}
|
||||
|
||||
type CreateFlags struct {
|
||||
CPU *int
|
||||
Memory *int
|
||||
DiskSize *int
|
||||
Boot2DockerURL *string
|
||||
|
@ -67,6 +69,12 @@ func GetCreateFlags() []cli.Flag {
|
|||
Usage: "Size of memory for host in MB",
|
||||
Value: 1024,
|
||||
},
|
||||
cli.IntFlag{
|
||||
Name: "virtualbox-cpu-count",
|
||||
Usage: "number of CPUs for the machine (-1 to use the number of CPUs available)",
|
||||
EnvVar: "VIRTUALBOX_CPU_COUNT",
|
||||
Value: -1,
|
||||
},
|
||||
cli.IntFlag{
|
||||
Name: "virtualbox-disk-size",
|
||||
Usage: "Size of disk for host in MB",
|
||||
|
@ -137,6 +145,7 @@ func (d *Driver) GetURL() (string, error) {
|
|||
}
|
||||
|
||||
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
|
||||
d.CPU = flags.Int("virtualbox-cpu-count")
|
||||
d.Memory = flags.Int("virtualbox-memory")
|
||||
d.DiskSize = flags.Int("virtualbox-disk-size")
|
||||
d.Boot2DockerURL = flags.String("virtualbox-boot2docker-url")
|
||||
|
@ -225,7 +234,10 @@ func (d *Driver) Create() error {
|
|||
return err
|
||||
}
|
||||
|
||||
cpus := uint(runtime.NumCPU())
|
||||
cpus := d.CPU
|
||||
if cpus < 1 {
|
||||
cpus = int(runtime.NumCPU())
|
||||
}
|
||||
if cpus > 32 {
|
||||
cpus = 32
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue