Skip to content

Commit b6b9974

Browse files
committed
Add more logs, specially for windows users
Signed-off-by: David Gageot <david@gageot.net>
1 parent e42734f commit b6b9974

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

drivers/virtualbox/network.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88
"strings"
99
"time"
1010

11+
"runtime"
12+
1113
"github.com/docker/machine/libmachine/log"
1214
)
1315

@@ -49,6 +51,10 @@ func (n *hostOnlyNetwork) Save(vbox VBoxManager) error {
4951
// SaveIPv4 changes the ipv4 configuration of the host-only network.
5052
func (n *hostOnlyNetwork) SaveIPv4(vbox VBoxManager) error {
5153
if n.IPv4.IP != nil && n.IPv4.Mask != nil {
54+
if runtime.GOOS == "windows" {
55+
log.Warn("Windows might ask for the permission to configure a network adapter. Sometimes, such confirmation window is minimized in the taskbar.")
56+
}
57+
5258
if err := vbox.vbm("hostonlyif", "ipconfig", n.Name, "--ip", n.IPv4.IP.String(), "--netmask", net.IP(n.IPv4.Mask).String()); err != nil {
5359
return err
5460
}
@@ -59,6 +65,10 @@ func (n *hostOnlyNetwork) SaveIPv4(vbox VBoxManager) error {
5965

6066
// createHostonlyAdapter creates a new host-only network.
6167
func createHostonlyAdapter(vbox VBoxManager) (*hostOnlyNetwork, error) {
68+
if runtime.GOOS == "windows" {
69+
log.Warn("Windows might ask for the permission to create a network adapter. Sometimes, such confirmation window is minimized in the taskbar.")
70+
}
71+
6272
out, err := vbox.vbmOut("hostonlyif", "create")
6373
if err != nil {
6474
return nil, err
@@ -226,6 +236,8 @@ func removeOrphanDHCPServers(vbox VBoxManager) error {
226236
return nil
227237
}
228238

239+
log.Debug("Removing orphan DHCP servers...")
240+
229241
nets, err := listHostOnlyAdapters(vbox)
230242
if err != nil {
231243
return err
@@ -277,6 +289,10 @@ func addHostOnlyDHCPServer(ifname string, d dhcpServer, vbox VBoxManager) error
277289
args = append(args, "--disable")
278290
}
279291

292+
if runtime.GOOS == "windows" {
293+
log.Warn("Windows might ask for the permission to configure a dhcp server. Sometimes, such confirmation window is minimized in the taskbar.")
294+
}
295+
280296
return vbox.vbm(args...)
281297
}
282298

drivers/virtualbox/virtualbox.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,8 @@ func (d *Driver) Start() error {
478478

479479
var hostOnlyAdapter *hostOnlyNetwork
480480
if s == state.Stopped {
481-
// check network to re-create if needed
481+
log.Infof("Check network to re-create if needed...")
482+
482483
if hostOnlyAdapter, err = d.setupHostOnlyNetwork(d.MachineName); err != nil {
483484
return fmt.Errorf("Error setting up host only network on machine start: %s", err)
484485
}
@@ -715,7 +716,6 @@ func (d *Driver) setupHostOnlyNetwork(machineName string) (*hostOnlyNetwork, err
715716
return nil, err
716717
}
717718

718-
log.Debug("Removing orphan DHCP servers...")
719719
if err := removeOrphanDHCPServers(d.VBoxManager); err != nil {
720720
return nil, err
721721
}

0 commit comments

Comments
 (0)