Repository navigation
Open
Description
Inside Start, we already set IPAddress
machine/drivers/hyperv/hyperv.go
Lines 362 to 372 in 4f91040
| func (d *Driver) Start() error { | |
| if err := cmd("Hyper-V\\Start-VM", d.MachineName); err != nil { | |
| return err | |
| } | |
| ip, err := d.waitForIP() | |
| if err != nil { | |
| return err | |
| } | |
| d.IPAddress = ip |
But inside GetIP, we retrieve IP instead of use cached value.
machine/drivers/hyperv/hyperv.go
Lines 433 to 453 in 4f91040
| func (d *Driver) GetIP() (string, error) { | |
| s, err := d.GetState() | |
| if err != nil { | |
| return "", err | |
| } | |
| if s != state.Running { | |
| return "", drivers.ErrHostIsNotRunning | |
| } | |
| stdout, err := cmdOut("((", "Hyper-V\\Get-VM", d.MachineName, ").networkadapters[0]).ipaddresses[0]") | |
| if err != nil { | |
| return "", err | |
| } | |
| resp := parseLines(stdout) | |
| if len(resp) < 1 { | |
| return "", fmt.Errorf("IP not found") | |
| } | |
| return resp[0], nil | |
| } |
Metadata
Metadata
Assignees
Labels
No labels
Activity
lingsamuel commentedon Jan 21, 2021
By this simple patch, we could reduce a huge latency (each
cmdOuttakes about 1s).afbjorklund commentedon Feb 9, 2021
I think it got changed along the way: fa8fa69
Before, it would allow running with DHCP (just like in the VirtualBox driver)
Can you open a PR in docker/machine as well, just for showing good will ?
Given implementation, your optimization sounds doable.
lingsamuel commentedon Feb 18, 2021
Opened docker-archive-public#4870