]> git.ipfire.org Git - thirdparty/libvirt.git/commit
hyperv: Implement virDomainInterfaceAddresses()
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 4 Feb 2026 15:37:32 +0000 (16:37 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 12 Feb 2026 14:55:30 +0000 (15:55 +0100)
commitaa802b8723fbb25a1c62c83e640212c40ccbd27f
tree7b7735ca09272a5213100b131eedda4452014d5e
parenta422ebb178194f974590877894669652d71b7e87
hyperv: Implement virDomainInterfaceAddresses()

The virDomainInterfaceAddresses() API accepts @source argument,
but since this is hyperv, we can't really use _SRC_LEASE (we
didn't spawn any dnsmasq there), not _SRC_ARP. The only source
that's more or less usable is _SRC_AGENT. Okay, there's no QEMU
guest agent running, but hyperv has its own guest agent. In my
testing (with Linux guest) I had to install 'hyperv' package and
then enable 'hv_kvp_daemon.service'. After that,
Msvm_GuestNetworkAdapterConfiguration struct [1] contained guest
IP addresses.

There's one caveat though: the interface name
(virDomainInterface::name). We don't fetch that one even for
hypervDomainGetXMLDesc() case. And there's no <target dev=''/>
either nor device alias (v12.0.0-43-g4009126f17). So just put
InstanceID there for now, which is this long path, with some
UUIDs, e.g.:

   Microsoft:5C58E5F2-946E-490F-B81D-6E2A7328640D\C85554E0-2B3B-487C-A557-D230BFF5F9E6\

But hey, at least it's unique.

1: https://learn.microsoft.com/en-us/windows/win32/hyperv_v2/msvm-guestnetworkadapterconfiguration
Resolves: https://issues.redhat.com/browse/RHEL-145306
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/hyperv/hyperv_driver.c
src/hyperv/hyperv_wmi_generator.input