mirror of https://github.com/docker/docs.git
Add flag --virtualbox-nictype to set nictype1
Signed-off-by: Stefan Scherer <scherer_stefan@icloud.com>
This commit is contained in:
parent
d87383e8f3
commit
f0ac1c00ea
|
@ -53,6 +53,7 @@ type Driver struct {
|
|||
CPU int
|
||||
Memory int
|
||||
DiskSize int
|
||||
NatNicType string
|
||||
Boot2DockerURL string
|
||||
Boot2DockerImportVM string
|
||||
HostDNSResolver bool
|
||||
|
@ -78,6 +79,7 @@ func NewDriver(hostName, storePath string) *Driver {
|
|||
Memory: defaultMemory,
|
||||
CPU: defaultCPU,
|
||||
DiskSize: defaultDiskSize,
|
||||
NatNicType: defaultHostOnlyNictype,
|
||||
HostOnlyCIDR: defaultHostOnlyCIDR,
|
||||
HostOnlyNicType: defaultHostOnlyNictype,
|
||||
HostOnlyPromiscMode: defaultHostOnlyPromiscMode,
|
||||
|
@ -129,6 +131,12 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
|
|||
Usage: "Use the host DNS resolver",
|
||||
EnvVar: "VIRTUALBOX_HOST_DNS_RESOLVER",
|
||||
},
|
||||
mcnflag.StringFlag{
|
||||
Name: "virtualbox-nat-nictype",
|
||||
Usage: "Specify the Network Adapter Type",
|
||||
Value: defaultHostOnlyNictype,
|
||||
EnvVar: "VIRTUALBOX_NAT_NICTYPE",
|
||||
},
|
||||
mcnflag.StringFlag{
|
||||
Name: "virtualbox-hostonly-cidr",
|
||||
Usage: "Specify the Host Only CIDR",
|
||||
|
@ -205,6 +213,7 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
|
|||
d.SSHUser = "docker"
|
||||
d.Boot2DockerImportVM = flags.String("virtualbox-import-boot2docker-vm")
|
||||
d.HostDNSResolver = flags.Bool("virtualbox-host-dns-resolver")
|
||||
d.NatNicType = flags.String("virtualbox-nat-nictype")
|
||||
d.HostOnlyCIDR = flags.String("virtualbox-hostonly-cidr")
|
||||
d.HostOnlyNicType = flags.String("virtualbox-hostonly-nictype")
|
||||
d.HostOnlyPromiscMode = flags.String("virtualbox-hostonly-nicpromisc")
|
||||
|
@ -377,7 +386,7 @@ func (d *Driver) CreateVM() error {
|
|||
|
||||
if err := d.vbm("modifyvm", d.MachineName,
|
||||
"--nic1", "nat",
|
||||
"--nictype1", "82540EM",
|
||||
"--nictype1", d.NatNicType,
|
||||
"--cableconnected1", "on"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -391,6 +391,37 @@ func TestCreateVM(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestCreateVMWithSpecificNatNicType(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")
|
||||
driver.NatNicType = "Am79C973"
|
||||
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},
|
||||
{modifyVMcommand, "", nil},
|
||||
{"vbm modifyvm default --nic1 nat --nictype1 Am79C973 --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},
|
||||
{"vbm storageattach default --storagectl SATA --port 1 --device 0 --type hdd --medium path/machines/default/disk.vmdk", "", nil},
|
||||
{"vbm guestproperty set default /VirtualBox/GuestAdd/SharedFolders/MountPrefix /", "", nil},
|
||||
{"vbm guestproperty set default /VirtualBox/GuestAdd/SharedFolders/MountDir /", "", nil},
|
||||
{"vbm sharedfolder add default --name " + shareName + " --hostpath " + shareDir + " --automount", "", nil},
|
||||
{"vbm setextradata default VBoxInternal2/SharedFoldersEnableSymlinksCreate/" + shareName + " 1", "", nil},
|
||||
})
|
||||
|
||||
err := driver.CreateVM()
|
||||
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestStart(t *testing.T) {
|
||||
driver := NewDriver("default", "path")
|
||||
mockCalls(t, driver, []Call{
|
||||
|
|
Loading…
Reference in New Issue