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-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-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-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.
|
The VirtualBox driver uses the latest boot2docker image.
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Driver struct {
|
type Driver struct {
|
||||||
|
CPU int
|
||||||
MachineName string
|
MachineName string
|
||||||
SSHUser string
|
SSHUser string
|
||||||
SSHPort int
|
SSHPort int
|
||||||
|
@ -46,6 +47,7 @@ type Driver struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreateFlags struct {
|
type CreateFlags struct {
|
||||||
|
CPU *int
|
||||||
Memory *int
|
Memory *int
|
||||||
DiskSize *int
|
DiskSize *int
|
||||||
Boot2DockerURL *string
|
Boot2DockerURL *string
|
||||||
|
@ -67,6 +69,12 @@ func GetCreateFlags() []cli.Flag {
|
||||||
Usage: "Size of memory for host in MB",
|
Usage: "Size of memory for host in MB",
|
||||||
Value: 1024,
|
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{
|
cli.IntFlag{
|
||||||
Name: "virtualbox-disk-size",
|
Name: "virtualbox-disk-size",
|
||||||
Usage: "Size of disk for host in MB",
|
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 {
|
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
|
||||||
|
d.CPU = flags.Int("virtualbox-cpu-count")
|
||||||
d.Memory = flags.Int("virtualbox-memory")
|
d.Memory = flags.Int("virtualbox-memory")
|
||||||
d.DiskSize = flags.Int("virtualbox-disk-size")
|
d.DiskSize = flags.Int("virtualbox-disk-size")
|
||||||
d.Boot2DockerURL = flags.String("virtualbox-boot2docker-url")
|
d.Boot2DockerURL = flags.String("virtualbox-boot2docker-url")
|
||||||
|
@ -225,7 +234,10 @@ func (d *Driver) Create() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
cpus := uint(runtime.NumCPU())
|
cpus := d.CPU
|
||||||
|
if cpus < 1 {
|
||||||
|
cpus = int(runtime.NumCPU())
|
||||||
|
}
|
||||||
if cpus > 32 {
|
if cpus > 32 {
|
||||||
cpus = 32
|
cpus = 32
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue