-
Notifications
You must be signed in to change notification settings - Fork 95
Add VirtualBox 5 support #373
Changes from all commits
b983c3e
1354fff
29c9bff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -658,7 +658,7 @@ func (m *Machine) Modify() error { | |
"--cpuhotplug", m.Flag.Get(F_cpuhotplug), | ||
"--pae", m.Flag.Get(F_pae), | ||
"--longmode", m.Flag.Get(F_longmode), | ||
"--synthcpu", m.Flag.Get(F_synthcpu), | ||
//"--synthcpu", m.Flag.Get(F_synthcpu), | ||
"--hpet", m.Flag.Get(F_hpet), | ||
"--hwvirtex", m.Flag.Get(F_hwvirtex), | ||
"--triplefaultreset", m.Flag.Get(F_triplefaultreset), | ||
|
@@ -690,13 +690,13 @@ func (m *Machine) Modify() error { | |
|
||
// AddNATPF adds a NAT port forarding rule to the n-th NIC with the given name. | ||
func (m *Machine) AddNATPF(n int, name string, rule driver.PFRule) error { | ||
return vbm("controlvm", m.Name, fmt.Sprintf("natpf%d", n), | ||
return vbm("modifyvm", m.Name, fmt.Sprintf("--natpf%d", n), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems to make sense as this is what There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason is that "controlvm" only works if the VM is already running: see https://www.virtualbox.org/manual/ch08.html#vboxmanage-controlvm
Is boot2docker-cli supposed to start the VM before performing this? If so, it doesn't do that on VBox 5. Or did those commands work on VBox 4 without starting the VM first? I do not know. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm definitely also surprised by this change -- does it not work as-is after removing the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally, the diff in this PR looks as much like the diff in docker/machine#1496 as we can and actually have VBox 5 "work". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the record, yes, I believed this not to work without this change. That seems consistent with the VirtualBox documentation. After all, this call is being made while the VM is shut down, or is it not? |
||
fmt.Sprintf("%s,%s", name, rule.Format())) | ||
} | ||
|
||
// DelNATPF deletes the NAT port forwarding rule with the given name from the n-th NIC. | ||
func (m *Machine) DelNATPF(n int, name string) error { | ||
return vbm("controlvm", m.Name, fmt.Sprintf("natpf%d", n), "delete", name) | ||
return vbm("modifyvm", m.Name, fmt.Sprintf("--natpf%d", n), "delete", name) | ||
} | ||
|
||
// SetNIC set the n-th NIC. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ package virtualbox | |
import ( | ||
"bytes" | ||
"errors" | ||
"fmt" | ||
"io" | ||
"log" | ||
"os" | ||
|
@@ -99,6 +100,11 @@ func getHostOnlyNetworkInterface(mc *driver.MachineConfig) (string, error) { | |
|
||
for _, n := range nets { | ||
if dhcp, ok := dhcps[n.NetworkName]; ok { | ||
fmt.Printf("IPv4 / DHCP IP: %s == %s\n", dhcp.IPv4.IP, mc.DHCPIP) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the print statements before merging? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, the print statements are essential for how I'm working with this: For some reason, I didn't have any proper host-only networks. (That might be because I upgraded from VBox 4 / 5rc1 on this machine, when host-only networks didn't work yet.) So what I'm doing is rerunning "boot2docker init" with these print statements, making changes to my host-only networks with the VBox GUI until they exactly match the network that boot2docker-cli expects to find. I'm not sure what's really supposed to happen here. I guess boot2docker-cli should automatically create the host-only network it needs? Maybe we just need to fix that for VBox 5. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's probably a bigger issue to tackle. Maybe even an issue with VirtualBox 5, I don't think the creation of host-only networks works anymore. I just reported the same issue for docker-machine: docker/machine#1521 |
||
fmt.Printf("IPv4 netmask: %s == %s\n", dhcp.IPv4.Mask, mc.NetMask) | ||
fmt.Printf("DHCP lower bound: %s == %s\n", dhcp.LowerIP, mc.LowerIP) | ||
fmt.Printf("DHCP upper bound: %s == %s\n", dhcp.UpperIP, mc.UpperIP) | ||
fmt.Printf("DHCP enabled: %s == %s\n", dhcp.Enabled, mc.DHCPEnabled) | ||
if dhcp.IPv4.IP.Equal(mc.DHCPIP) && | ||
dhcp.IPv4.Mask.String() == mc.NetMask.String() && | ||
dhcp.LowerIP.Equal(mc.LowerIP) && | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove before merging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, probably a good idea.