On 30. 3. 2020 15:26, john doe wrote:
On 3/30/2020 1:20 PM, Andrea Bolognani wrote:
> On Mon, 2020-03-30 at 12:04 +0200, Michal Prívozník wrote:
>> On 27. 3. 2020 20:49, john doe wrote:
>>> If my understanding is correct, using 'try06' or 'debian'
should do the
>>> same thing?
>>
>> Yes, that is the idea. However, these plugins were not introduced at the
>> same time. I think that especially Debian has delayed libvirt_guest
>> plugin. You can check if both plugins exist:
>>
>> ls /usr/lib64/libnss_libvirt*
>>
>> /usr/lib64/libnss_libvirt_guest.so.2
>> /usr/lib64/libnss_libvirt.so.2
>
> Note that paths are different in Debian-based distros, so the correct
> ones in this case are actually
>
> /lib/x86_64-linux-gnu/libnss_libvirt.so.2
> /lib/x86_64-linux-gnu/libnss_libvirt_guest.so.2
>
I have upgraded that Buster host to Bullseye, so I have now a 6... version.
I have also the above two modules.
I'm still not able to use 'libvirt_guest' though:
--- Guest output (try06):
root@try06:~# cat /etc/hostname
try06
--- Host output (host):
root@host:# grep hosts: /etc/ns*
hosts: libvirt_guest
root@host:# virsh net-dhcp-leases default
Expiry Time MAC address Protocol IP address
Hostname Client ID or DUID
---------------------------------------------------------------------------------------------------------
2020-03-30 16:03:41 52:54:00:d4:e6:f0 ipv4 192.168.122.137/24
- -
root@host:# getent hosts try06; echo $?
2
What am I missing?
Hold on. 'libvirt_guest' NSS plugin is supposed to translate libvirt
names to IP addresses. For instance:
virsh start myDomain; ssh myDomain
The 'libvirt' NSS plugin is supposed to translate hostnames as sent by
guests to IP addresses. These two can be viewed as the following:
libvirt_guest: virsh domifaddr --source lease $dom
libvirt: virsh net-dhcp-leases $net | grep $hostname
And this is where it gets interesting. In your previous e-mails,
net-dhcp-leases (aka 'libvirt' plugin) worked because the guest did send
hostname when doing DHCP. Now it doesn't (see '-' under 'Hostname' in
the output). Therefore, the 'libvirt' NSS plugin won't work.
And 'libvirt_guest' translates names of guests as seen by libvirt, i.e.
names you pass to virsh commands. These are unrelated to '/etc/hostname'
within guest. But hopefully, you haven't renamed your guest since then
and it is still named 'try06', that is virsh list --all produces 'try06'
in the list. If this is all true, can you share the output of:
strace $(which getent) hosts try06
Michal