[libvirt] [PATCH 3/4] parallels: Switch on DHCP for newly created network adapters

Laine Stump laine at laine.org
Wed Jun 17 13:38:54 UTC 2015


On 06/17/2015 08:35 AM, Mikhail Feoktistov wrote:
> Let network adapter use DHCP server to get network configuration.
> To do this we use PrlVmDevNet_SetConfigureWithDhcp to enable it and
> PrlVmDevNet_SetAutoApply to makes necessary settings within guest OS
> In linux case it creates network startup scripts
> /etc/sysconfig/network-scripts/ifcfg-ethN and fills it with necessary
> parameters.

(sorry for getting a bit off-topic)

The semantics of this are different for qemu - attaching a network
device only presents the hardware to the virtual machine; it doesn't
attempt to make any configuration changes in the guest OS. I *think*
that the xen and lxc drivers do configure the guest though (at least
they pay attention to the <ip> element in the <interface>). So this
isn't any criticism of your implementation, I'm just wondering whether
or not this will make a difference to any management apps using libvirt.

(actually this also brings to mind an idle thought I've had for awhile -
while it's possible to configure an IP address for a qemu guest from the
libvirt configuration in some cases (when the guest interface is
connected to a libvirt virtual network, you can add a static IP entry to
the network's dhcp config), it might be nice to recognize the <ip>
element in the <interface>, and use it to dynamically add a static IP
entry to the dnsmasq instance for the attached network. Does anyone have
an opinion on whether that would be useful/ugly/confusing?)

> ---
>  src/vz/vz_sdk.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
> index 98f7a57..090a3ad 100644
> --- a/src/vz/vz_sdk.c
> +++ b/src/vz/vz_sdk.c
> @@ -2815,6 +2815,12 @@ static int prlsdkAddNet(PRL_HANDLE sdkdom,
>      pret = PrlVmDevNet_SetMacAddress(sdknet, macstr);
>      prlsdkCheckRetGoto(pret, cleanup);
>  
> +    pret = PrlVmDevNet_SetConfigureWithDhcp(sdknet, true);
> +    prlsdkCheckRetGoto(pret, cleanup);
> +
> +    pret = PrlVmDevNet_SetAutoApply(sdknet, true);
> +    prlsdkCheckRetGoto(pret, cleanup);
> +
>      if (isCt) {
>          if (net->model)
>               VIR_WARN("Setting network adapter for containers is not "




More information about the libvir-list mailing list