Add option --longmode on to support Windows 32bit hosts

Signed-off-by: Stefan Scherer <scherer_stefan@icloud.com>
This commit is contained in:
Stefan Scherer 2016-02-08 14:54:37 +01:00
parent 0c9adcb01e
commit c40f9f7a21
2 changed files with 16 additions and 3 deletions

View File

@ -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
}

View File

@ -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},