WaitForNetIP and docker-backed vcsim VM #3020
-
Howdy! This question may just be me overlooking something, so I apologize if I am :) The tl;dr is that I'm experimenting with backing a VM with a docker container to integrate with another existing product and ran into a small speedbump with the call to
(I think I'm over simplifying it, and I could be misunderstanding here) The first thing to address was that the MAC reported by
The MAC reported from the VM is VMware MAC, while the one from the guest.net property is from Docker. However, if I create a VM where the MACs match, it still continues to hang. I believe the spot I'm struggling with right now is this block in virtual_machine.go if mac == "" || nic.IpConfig == nil {
continue
} where I figured it wouldn't hurt to drop a message here and see if this scenario is a supported one, or if this field isn't populated from vcsim. If the latter, would this be something that would be a good PR? I'm still reading through the code so haven't seen why this is the case, but happy to follow through. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hey @BrianMMcClain ! Thanks for the details and sorry for the delay. The patch below should fix, I'll update the tests and open a PR soon (need to resolve another issue first). diff --git a/simulator/container.go b/simulator/container.go
index 08f8f7ed..650c1997 100644
--- a/simulator/container.go
+++ b/simulator/container.go
@@ -114,6 +114,18 @@ func (c *container) inspect(vm *VirtualMachine) error {
net := &vm.Guest.Net[0]
net.IpAddress = []string{s.IPAddress}
net.MacAddress = s.MacAddress
+ net.IpConfig = &types.NetIpConfigInfo{
+ IpAddress: []types.NetIpConfigInfoIpAddress{
+ {IpAddress: s.IPAddress},
+ },
+ }
+ }
+
+ for _, d := range vm.Config.Hardware.Device {
+ if eth, ok := d.(types.BaseVirtualEthernetCard); ok {
+ eth.GetVirtualEthernetCard().MacAddress = s.MacAddress
+ break
+ }
}
} |
Beta Was this translation helpful? Give feedback.
Hey @BrianMMcClain ! Thanks for the details and sorry for the delay. The patch below should fix, I'll update the tests and open a PR soon (need to resolve another issue first).