From c40f9f7a215dd2cbc1bc31b0ace861a0e22b82f4 Mon Sep 17 00:00:00 2001 From: Stefan Scherer Date: Mon, 8 Feb 2016 14:54:37 +0100 Subject: [PATCH] Add option --longmode on to support Windows 32bit hosts Signed-off-by: Stefan Scherer --- drivers/virtualbox/virtualbox.go | 11 +++++++++-- drivers/virtualbox/virtualbox_test.go | 8 +++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/virtualbox/virtualbox.go b/drivers/virtualbox/virtualbox.go index 3f02b95a9e..306833728d 100644 --- a/drivers/virtualbox/virtualbox.go +++ b/drivers/virtualbox/virtualbox.go @@ -342,7 +342,8 @@ func (d *Driver) CreateVM() error { dnsProxy = "on" } - if err := d.vbm("modifyvm", d.MachineName, + var modifyFlags = []string{ + "modifyvm", d.MachineName, "--firmware", "bios", "--bioslogofadein", "off", "--bioslogofadeout", "off", @@ -364,7 +365,13 @@ func (d *Driver) CreateVM() error { "--largepages", "on", "--vtxvpid", "on", "--accelerate3d", "off", - "--boot1", "dvd"); err != nil { + "--boot1", "dvd"} + + if runtime.GOOS == "windows" && runtime.GOARCH == "386" { + modifyFlags = append(modifyFlags, "--longmode", "on") + } + + if err := d.vbm(modifyFlags...); err != nil { return err } diff --git a/drivers/virtualbox/virtualbox_test.go b/drivers/virtualbox/virtualbox_test.go index 55dcf63a4d..f63e4fb735 100644 --- a/drivers/virtualbox/virtualbox_test.go +++ b/drivers/virtualbox/virtualbox_test.go @@ -3,6 +3,7 @@ package virtualbox import ( "errors" "net" + "runtime" "strings" "testing" @@ -320,13 +321,18 @@ func mockCalls(t *testing.T, driver *Driver, expectedCalls []Call) { func TestCreateVM(t *testing.T) { shareName, shareDir := getShareDriveAndName() + modifyVMcommand := "vbm modifyvm default --firmware bios --bioslogofadein off --bioslogofadeout off --bioslogodisplaytime 0 --biosbootmenu disabled --ostype Linux26_64 --cpus 1 --memory 1024 --acpi on --ioapic on --rtcuseutc on --natdnshostresolver1 off --natdnsproxy1 on --cpuhotplug off --pae on --hpet on --hwvirtex on --nestedpaging on --largepages on --vtxvpid on --accelerate3d off --boot1 dvd" + if runtime.GOOS == "windows" && runtime.GOARCH == "386" { + modifyVMcommand += " --longmode on" + } + driver := NewDriver("default", "path") mockCalls(t, driver, []Call{ {"CopyIsoToMachineDir path default http://b2d.org", "", nil}, {"Generate path/machines/default/id_rsa", "", nil}, {"Create 20000 path/machines/default/id_rsa.pub path/machines/default/disk.vmdk", "", nil}, {"vbm createvm --basefolder path/machines/default --name default --register", "", nil}, - {"vbm modifyvm default --firmware bios --bioslogofadein off --bioslogofadeout off --bioslogodisplaytime 0 --biosbootmenu disabled --ostype Linux26_64 --cpus 1 --memory 1024 --acpi on --ioapic on --rtcuseutc on --natdnshostresolver1 off --natdnsproxy1 on --cpuhotplug off --pae on --hpet on --hwvirtex on --nestedpaging on --largepages on --vtxvpid on --accelerate3d off --boot1 dvd", "", nil}, + {modifyVMcommand, "", nil}, {"vbm modifyvm default --nic1 nat --nictype1 82540EM --cableconnected1 on", "", nil}, {"vbm storagectl default --name SATA --add sata --hostiocache on", "", nil}, {"vbm storageattach default --storagectl SATA --port 0 --device 0 --type dvddrive --medium path/machines/default/boot2docker.iso", "", nil},