Hi,
I looked further into the problem of obtaining IP address of the controler
interface from the guest VM. And I'm not sure what's the best solution.
There are the following options:
1) ARP table lookup
I tried this manually, I booted up a VM which was connected to a bridge
together with a physical interface of my laptop connected to RedHat
network. The machine requested an IP, got it, but a record didn't show
up in the ARP table at all.
Am I doing something wrong?
There's also a script that is a part of `arping' which does this
reverse
IP resolution using ARP [1]. But this solution seems pretty bad to me.
They try to ping every possible address on the subnet and then see if
the MAC's match.
[1]
http://pastebin.test.redhat.com/91334
2) Sniffing DHCP replies
This is (if I understand it correctly) the way autotest does it. The
code is here [2] (thanks to jzupka for helping me out!). I think this
might not be suitable for LNST, because the tcpdump needs to be running
during the guest startup. LNST is designed to work with machines that
are already running.
[2]
https://github.com/autotest/autotest/blob/master/client/virt/virt_env_pro...
3) Setup through serial console
I dug into the beaker task that handles these virtual installs [6] and
they have script for obtaining a hostname of the guest [3]. It's a
`expect' script that uses serial console via `virsh console' command.
Works ok, but it assumes that the guest systems' language is English
(which might be true in beaker, but outside of that it's not very
nice).
Also libvirt's python bindings can open a serial console connection
directly in python [4], which could be useful. Here's example of it's
usage from libvirt [5].
[3]
http://pastebin.test.redhat.com/91348
[4]
http://libvirt.org/html/libvirt-libvirt.html#virDomainOpenConsole
[5]
http://pastebin.test.redhat.com/91337
[6]
https://beaker.engineering.redhat.com/tasks/5436
What do you think is the best way to do this?
Maybe there's another way I'm not seeing ...
Thanks,
Radek