mirror of https://github.com/docker/docs.git
Merge pull request #876 from tombee/virtualbox-env-vars
Added VIRTUALBOX_MEMORY_SIZE and VIRTUALBOX_DISK_SIZE env vars
This commit is contained in:
commit
ee6e6d76e0
|
@ -828,6 +828,18 @@ Options:
|
||||||
|
|
||||||
The VirtualBox driver uses the latest boot2docker image.
|
The VirtualBox driver uses the latest boot2docker image.
|
||||||
|
|
||||||
|
Environment variables:
|
||||||
|
|
||||||
|
Here comes the list of the supported variables with the corresponding options. If both environment
|
||||||
|
variable and CLI option are provided the CLI option takes the precedence.
|
||||||
|
|
||||||
|
| Environment variable | CLI option |
|
||||||
|
|-----------------------------------|-----------------------------------|
|
||||||
|
| `VIRTUALBOX_MEMORY_SIZE` | `--virtualbox-memory` |
|
||||||
|
| `VIRTUALBOX_CPU_COUNT` | `--virtualbox-cpu-count` |
|
||||||
|
| `VIRTUALBOX_DISK_SIZE` | `--virtualbox-disk-size` |
|
||||||
|
| `VIRTUALBOX_BOOT2DOCKER_URL` | `--virtualbox-boot2docker-url` |
|
||||||
|
|
||||||
#### VMware Fusion
|
#### VMware Fusion
|
||||||
Creates machines locally on [VMware Fusion](http://www.vmware.com/products/fusion). Requires VMware Fusion to be installed.
|
Creates machines locally on [VMware Fusion](http://www.vmware.com/products/fusion). Requires VMware Fusion to be installed.
|
||||||
|
|
||||||
|
|
|
@ -65,20 +65,22 @@ func init() {
|
||||||
func GetCreateFlags() []cli.Flag {
|
func GetCreateFlags() []cli.Flag {
|
||||||
return []cli.Flag{
|
return []cli.Flag{
|
||||||
cli.IntFlag{
|
cli.IntFlag{
|
||||||
Name: "virtualbox-memory",
|
EnvVar: "VIRTUALBOX_MEMORY_SIZE",
|
||||||
Usage: "Size of memory for host in MB",
|
Name: "virtualbox-memory",
|
||||||
Value: 1024,
|
Usage: "Size of memory for host in MB",
|
||||||
|
Value: 1024,
|
||||||
},
|
},
|
||||||
cli.IntFlag{
|
cli.IntFlag{
|
||||||
|
EnvVar: "VIRTUALBOX_CPU_COUNT",
|
||||||
Name: "virtualbox-cpu-count",
|
Name: "virtualbox-cpu-count",
|
||||||
Usage: "number of CPUs for the machine (-1 to use the number of CPUs available)",
|
Usage: "number of CPUs for the machine (-1 to use the number of CPUs available)",
|
||||||
EnvVar: "VIRTUALBOX_CPU_COUNT",
|
|
||||||
Value: -1,
|
Value: -1,
|
||||||
},
|
},
|
||||||
cli.IntFlag{
|
cli.IntFlag{
|
||||||
Name: "virtualbox-disk-size",
|
EnvVar: "VIRTUALBOX_DISK_SIZE",
|
||||||
Usage: "Size of disk for host in MB",
|
Name: "virtualbox-disk-size",
|
||||||
Value: 20000,
|
Usage: "Size of disk for host in MB",
|
||||||
|
Value: 20000,
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
EnvVar: "VIRTUALBOX_BOOT2DOCKER_URL",
|
EnvVar: "VIRTUALBOX_BOOT2DOCKER_URL",
|
||||||
|
|
|
@ -260,7 +260,7 @@ findCPUCount() {
|
||||||
|
|
||||||
@test "$DRIVER: check custom machine memory size" {
|
@test "$DRIVER: check custom machine memory size" {
|
||||||
findMemorySize
|
findMemorySize
|
||||||
[[ ${output} == "${CUSTOM_MEMSIZE}" ]]
|
[[ ${output} == "$CUSTOM_MEMSIZE" ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "$DRIVER: check custom machine disksize" {
|
@test "$DRIVER: check custom machine disksize" {
|
||||||
|
@ -270,7 +270,7 @@ findCPUCount() {
|
||||||
|
|
||||||
@test "$DRIVER: check custom machine cpucount" {
|
@test "$DRIVER: check custom machine cpucount" {
|
||||||
findCPUCount
|
findCPUCount
|
||||||
[[ ${output} == "${CUSTOM_CPUCOUNT}" ]]
|
[[ ${output} == "$CUSTOM_CPUCOUNT" ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "$DRIVER: machine should show running after create" {
|
@test "$DRIVER: machine should show running after create" {
|
||||||
|
@ -284,7 +284,41 @@ findCPUCount() {
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "$DRIVER: can create custom machine using disk size, cpu count and memory size via env vars" {
|
||||||
|
VIRTUALBOX_DISK_SIZE=$CUSTOM_DISKSIZE VIRTUALBOX_CPU_COUNT=$CUSTOM_CPUCOUNT VIRTUALBOX_MEMORY_SIZE=$CUSTOM_MEMSIZE run machine create -d $DRIVER $NAME
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "$DRIVER: check machine's memory size was set correctly by env var" {
|
||||||
|
findMemorySize
|
||||||
|
[[ ${output} == "$CUSTOM_MEMSIZE" ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "$DRIVER: check machine's disk size was set correctly by env var" {
|
||||||
|
findDiskSize
|
||||||
|
[[ ${output} == *"$CUSTOM_DISKSIZE"* ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "$DRIVER: check custom machine cpucount" {
|
||||||
|
findCPUCount
|
||||||
|
[[ ${output} == "$CUSTOM_CPUCOUNT" ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@test "$DRIVER: machine should show running after create with env" {
|
||||||
|
run machine ls
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
[[ ${lines[1]} == *"Running"* ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "$DRIVER: remove after custom env create" {
|
||||||
|
run machine rm -f $NAME
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Cleanup of machine store should always be the last 'test'
|
||||||
@test "$DRIVER: cleanup" {
|
@test "$DRIVER: cleanup" {
|
||||||
run rm -rf $MACHINE_STORAGE_PATH
|
run rm -rf $MACHINE_STORAGE_PATH
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue