On Wed, Sep 7, 2016 at 11:41 AM, Daniel P. Berrange <berrange(a)redhat.com> wrote:
On Wed, Sep 07, 2016 at 11:18:58AM +0200, Amador Pahim wrote:
> The <drive>DomainInterfaceAddresses, when using the source type
> LEASE, does not need the domain to be running. It only checks the
> dhcp lease file and gets the address information from a valid lease,
> if any.
>
> This patch removes the virDomainObjIsActive(vm) check from the LEASE
> query type on both qemu and lxc drivers, keeping it only for query
> type AGENT on qemu driver (since lxc does not support AGENT type).
I don't think we should do this. IMHO it only makes sense to ask for
the IP address when the guest is actually running. The fact that we
might still happen to have an old IP address stored in the lease
file is merely a happy accident and not something we should guarantee
by exposing ability to get it in the API.
The fact that the guest is running does not mean the lease information is
accurate. Guest IP can be manually changed. IP can be allocated by
someone else between the true virDomainObjIsActive(vm) and the actual
DHCPACK. We don't guarantee the information in any case, unless you
change the query type to AGENT. One can parse the lease file by itself
(and check if the lease is not expired), it's cheaper than create(), query
the lease addresses, destroy(). This patch tries to avoid both.
--
Pahim