On Wed, Jan 06, 2021 at 11:46:04PM -0700, Alex Long wrote:
> Software in use:
> ESXi / vCenter 7.0U1
> OpenBSD 6.8
I'm not using Packer or OpenBSD on ESXi, but I just installed the latest
snapshot on ESXi/vCenter 7.0U1 to see.
> It seems like the vmt module is populating the legacy guest.ipAddress field
> instead of the newer guest.net.{nic}.ipConfig.ipAddress field. I checked the
> Managed Object Browser on my vCenter to confirm and was able to see the
> difference between the debian VM and OpenBSD VM from earlier. Attached image
> debian-guestinfo.png shows a link in the 'net' field that expands out to what
> is pictured in attached image debian-guestinfo-net.png. Meanwhile. the
> OpenBSD VM shows 'Unset' in the 'net' field (highlighted in attached image
> openbsd-guestinfo.png).
Thanks for the analysis.
I can confirm: vmt(4) sets `GuestInfo.ipAddress' and leaves
`GuestInfo.net' unset.
This matches with how vmt(4) merely provides the first IPv4 address
(on non-loopback interfaces) while Linux/open-vm-tools can potentially
provide multiple IPv4 *and IPv6* addresses (as your screenshots show).
> My guess is that the "info-set guestinfo.ip %s" RPC command used by vmt to
> send IP info to vCenter
> (https://github.com/openbsd/src/blob/master/sys/dev/pv/vmt.c#L819) only
> populates the legacy guest.ipAddress field while vCenter tries to report the
> contents of the newer guest.net.{nic}.ipConfig.ipAddress field through its
> API.
Sounds about right, but I couldn't find proper documentation about ESXi
behaviour in this regard to verify.
> Since all other relevant metadata (hostname, CPU, Memory, etc.) are populated
> correctly and seem to use a different RPC command (SetGuestInfo %d %s)
> compared to IP reporting, I'm hoping this issue can be fixed by modifying the
> IP reporting to use the same SetGuestInfo RPC command as the other metadata
> functions. I noticed that VM_GUEST_INFO_IP_ADDRESS_V2 was already defined as
> a guest info key
> (https://github.com/openbsd/src/blob/master/sys/dev/pv/vmt.c#L122), so I'm
> hoping that you can use that. If not, I think you'll need to delve into the
> sunrpc that open-vm-tools (https://github.com/vmware/open-vm-tools) uses to
> communicate.
A quick look at upstream seems to indicate that they still use
`info-set guestinfo.ip %s', but there's also much more in the
open-vm-tools code I didn't look at (yet):
https://github.com/vmware/open-vm-tools/blob/master/open-vm-tools/services/plugins/guestInfo/guestInfoServer.c#L2327