[libvirt] [PATCH v4 3/5] qemu: Implement virDomainGetHostnameFlags
Erik Skultety
eskultet at redhat.com
Fri Jan 10 13:05:22 UTC 2020
On Thu, Jan 09, 2020 at 01:45:58PM +0100, Michal Privoznik wrote:
> From: Julio Faracco <jcfaracco at gmail.com>
>
> We have to keep the default - querying the agent if no flag is
> set.
>
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> Signed-off-by: Julio Faracco <jcfaracco at gmail.com>
> ---
...
> +
> +static int
> +qemuDomainGetHostnameLease(virQEMUDriverPtr driver,
> + virDomainObjPtr vm,
> + char **hostname)
...
> +
> + if ((n_leases = virNetworkGetDHCPLeases(network, macaddr,
> + &leases, 0)) < 0)
> + goto endjob;
> +
> + for (j = 0; j < n_leases; j++) {
> + virNetworkDHCPLeasePtr lease = leases[j];
> + if (lease->hostname && !*hostname)
> + *hostname = g_strdup(lease->hostname);
Not a big deal, but why not doing a break once you extract the first hostname?
Reviewed-by: Erik Skultety <eskultet at redhat.com>
More information about the libvir-list
mailing list