Skip to content
This repository has been archived by the owner on Feb 27, 2018. It is now read-only.

Fixes #209: CLI option for number of CPUs when creating a new boot2docker VM #341

Merged
merged 1 commit into from
Feb 24, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ DiskSize = 20000
# VM memory size in MB
Memory = 2048

# Number of CPUs
CPUs = 1

# host port forwarding to port 22 in the VM
SSHPort = 2022

Expand Down
1 change: 1 addition & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ func config() (*flag.FlagSet, error) {
flags.StringVar(&B2D.SSHKey, "sshkey", filepath.Join(sshdir, "id_boot2docker"), "path to SSH key to use.")
flags.UintVarP(&B2D.DiskSize, "disksize", "s", 20000, "boot2docker disk image size (in MB).")
flags.UintVarP(&B2D.Memory, "memory", "m", 2048, "virtual machine memory size (in MB).")
flags.UintVarP(&B2D.CPUs, "cpus", "c", uint(runtime.NumCPU()), "number of CPUs for boot2docker.")
flags.Uint16Var(&B2D.SSHPort, "sshport", 2022, "host SSH port (forward to port 22 in VM).")
flags.Uint16Var(&B2D.DockerPort, "dockerport", 0, "host Docker port (forward to port 2376 in VM). (deprecated - use with care)")
flags.IPVar(&B2D.HostIP, "hostip", net.ParseIP("192.168.59.3"), "VirtualBox host-only network IP address.")
Expand Down
1 change: 1 addition & 0 deletions driver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type MachineConfig struct {
ISO string // boot2docker ISO image path
DiskSize uint // VM disk image size (MB)
Memory uint // VM memory size (MB)
CPUs uint // Number of CPUs

// NAT network: port forwarding
SSHPort uint16 // host SSH port (forward to port 22 in VM)
Expand Down
6 changes: 5 additions & 1 deletion virtualbox/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,11 @@ func CreateMachine(mc *driver.MachineConfig) (*Machine, error) {
// Configure VM for Boot2docker
SetExtra(mc.VM, "VBoxInternal/CPUM/EnableHVP", "1")
m.OSType = "Linux26_64"
m.CPUs = uint(runtime.NumCPU())
if mc.CPUs > 0 {
m.CPUs = mc.CPUs
} else {
m.CPUs = uint(runtime.NumCPU())
}
if m.CPUs > 32 {
m.CPUs = 32
}
Expand Down