Skip to contentSkip to conversation

tools/hv: async name resolution in kvp_daemon

PATCH In review Olaf Hering 1 participant 2 messages Mar 19, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tools/hv: async name resolution in kvp_daemon

The hostname is resolved just once since commit 58125210ab3b ("Tools:
hv: cache FQDN in kvp_daemon to avoid timeouts") to make sure the VM responds within the timeout limits to requests from the host.

If for some reason getaddrinfo fails, the string returned by the "FullyQualifiedDomainName" request contains some error string, which is then used by tools on the host side.

Adjust the code to resolve the current hostname in a separate thread. This thread loops until getaddrinfo returns success. During this time all "FullyQualifiedDomainName" requests will be answered with an empty string.

---
v2:
resend, the thread aims for success.

 tools/hv/Makefile        |  2 ++
 tools/hv/hv_kvp_daemon.c | 69 ++++++++++++++++++++++++++--------------
 2 files changed, 48 insertions(+), 23 deletions(-)
tools/hv/Makefile +2 -0
index b57143d9459c..3b5481015a84 100644
@@ -22,6 +22,8 @@ ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
 
 ALL_SCRIPTS := hv_get_dhcp_info.sh hv_get_dns_info.sh hv_set_ifconfig.sh
 
+$(OUTPUT)hv_kvp_daemon: LDFLAGS += -lpthread
+
 all: $(ALL_PROGRAMS)
 
 export srctree OUTPUT CC LD CFLAGS
tools/hv/hv_kvp_daemon.c +46 -23

104 lines not on this page · raw message

#1 lore raw

Am Fri, 19 Mar 2021 15:41:44 +0100
schrieb Olaf Hering <[email protected]>:

Quoted 1 line

FullyQualifiedDomainName

I think in the past I did asked MSFT what the host side really expects. Maybe this time there will be an answer.

Why would the host expect a FQDN from a VM? Why would it care about DNS layout of the network within the VM?

Basically my copy of hv_kvp_daemon just sends uname -n to the host. This is more correct. This does not waste any network resources. This, up to now, led to no complains.

So, what is the purpose of this API?

Olaf