diff --git a/README.md b/README.md index a2ff0e3..3a4d962 100644 --- a/README.md +++ b/README.md @@ -43,9 +43,9 @@ Environment: `MCP_REGION`. * `ddcloud-networkdomain` - The name of the target CloudControl network domain. * `ddcloud-datacenter` - The name of the CloudControl datacenter (e.g. NA1, AU9) in which the network domain is located. * `ddcloud-vlan` - The name of the target CloudControl VLAN. -* `ddcloud-memorygb` - The amount of RAM in GB for the target machine. (Default 4GB) -* `ddcloud-cpucount` - The amount of CPUs for the target machine. (Default: 2) -* `ddcloud-corespersocket` - The amount of cores per socket for the target machine. (Default: 2) +* `ddcloud-memorygb` - The amount of RAM in GB for the target machine. (Default: taken from image) +* `ddcloud-cpucount` - The amount of CPUs for the target machine. (Default: taken from image) +* `ddcloud-corespersocket` - The amount of cores per socket for the target machine. (Default: taken from image) * `ddcloud-image-name` - The name of the image used to create the target machine. Additionally, the OS must be a Linux distribution supported by docker-machine (Ubuntu 12.04 and above are supported, but RedHat 6 and 7 are not supported due to iptables configuration issues). * `ddcloud-ssh-user` - The SSH username to use. diff --git a/client.go b/client.go index f72cc85..c2aa9ec 100644 --- a/client.go +++ b/client.go @@ -336,9 +336,15 @@ func (driver *Driver) buildDeploymentConfiguration() (deploymentConfiguration co image.ApplyTo(&deploymentConfiguration) // Customise memory and / or CPU (if required). - deploymentConfiguration.MemoryGB = driver.MemoryGB - deploymentConfiguration.CPU.Count = driver.CPUCount - deploymentConfiguration.CPU.CoresPerSocket = driver.CoresPerSocket + if driver.MemoryGB != -1 { + deploymentConfiguration.MemoryGB = driver.MemoryGB + } + if driver.CPUCount != -1 { + deploymentConfiguration.CPU.Count = driver.CPUCount + } + if driver.CoresPerSocket != -1 { + deploymentConfiguration.CPU.CoresPerSocket = driver.CoresPerSocket + } return } diff --git a/driver.go b/driver.go index 8088d40..8f492ef 100644 --- a/driver.go +++ b/driver.go @@ -210,18 +210,18 @@ func (driver *Driver) GetCreateFlags() []mcnflag.Flag { }, mcnflag.IntFlag{ Name: "ddcloud-memorygb", - Usage: "The amount of RAM in GB for the target machine. Default: 4", - Value: 4, + Usage: "The amount of RAM in GB for the target machine. Default: -1 (Image default)", + Value: -1, }, mcnflag.IntFlag{ Name: "ddcloud-cpucount", - Usage: "The amount of CPUs for the target machine. Default: 2", - Value: 2, + Usage: "The amount of CPUs for the target machine. Default: -1 (Image default)", + Value: -1, }, mcnflag.IntFlag{ Name: "ddcloud-corespersocket", - Usage: "The amount of cores per socket for the target machine. Default: 2", - Value: 2, + Usage: "The amount of cores per socket for the target machine. Default: -1 (Image default)", + Value: -1, }, } }