From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jim Fehlig Subject: Re: [libvirt] Setting devid for emulated NICs (Xen 4.3.1 / libvirt 1.2.0) using libxl driver Date: Mon, 23 Dec 2013 23:22:42 -0700 Message-ID: <52B92832.1030705__48010.4082650088$1387866402$gmane$org@suse.com> References: <52B07D09.5060008@canonical.com> <1387299534.1025.19.camel@dagon.hellion.org.uk> <52B08AA9.8010809@canonical.com> <1387369646.27441.129.camel@kazak.uk.xensource.com> <52B19F4E.8010601@canonical.com> <1387373284.28680.18.camel@kazak.uk.xensource.com> <52B1B842.4090306@canonical.com> <52B2415A.3030903@suse.com> <1387448340.9925.30.camel@kazak.uk.xensource.com> <52B3278D.3000607@canonical.com> <52B33D6C.6010608@suse.com> <1387534262.17289.34.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1387534262.17289.34.camel@kazak.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: libvir-list@redhat.com, Stefan Bader , Xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org Ian Campbell wrote: > On Thu, 2013-12-19 at 11:39 -0700, Jim Fehlig wrote: > >> Stefan Bader wrote: >> >>> Oh, just while talking about setdefault. Jim, this is one of the odd things when >>> moving from xm to xl stack from libvirt: libvirt defaults to the netfront NIC >>> when no model is specified and sets the type. The libxl setdefault function sets >>> the model to rtl8139 but leaves the type untouched. >>> >> The xend toolstack always creates both emulated and vif devices unless >> 'type=netfront' is explicitly specified. As you say, the guest gets to >> choose what to do with them. E.g. PXE boot using the emulated device, >> or have the driver for the PV device unplug the emulated one. I don't >> think libxl supports this right? >> > > > On my 4.3.1 setup, I changed the above to > > > > if (hvm) { > > x_nic->nictype = LIBXL_NIC_TYPE_VIF_IOEMU; > > if (l_nic->model) { > > if (VIR_STRDUP(x_nic->model, l_nic->model) < 0) > > return -1; > > if (STREQ(l_nic->model, "netfront")) > > x_nic->nictype = LIBXL_NIC_TYPE_VIF; > > } > > } else { > > x_nic->nictype = LIBXL_NIC_TYPE_VIF; > > } > > > > which is better initialization logic IMO. If the domain is hvm, set > nictype to LIBXL_NIC_TYPE_VIF_IOEMU, unless model 'netfront' is > specified. This behavior is consistent with the legacy xen driver. > The change seems to work fine and resolves the PXE issue Stefan noted - > as long as I initialize devid in libvirt. So we'll need the above fix > in libvirt, as well as a resolution to the nic devid initialization in > libxl that started this thread. > > > > Regards, > > Jim > It should do, in fact I thought it was the default. > > How are you initialising the libxl_device_nic? if (l_nic->model && !STREQ(l_nic->model, "netfront")) { if (VIR_STRDUP(x_nic->model, l_nic->model) < 0) return -1; x_nic->nictype = LIBXL_NIC_TYPE_VIF_IOEMU; } else { x_nic->nictype = LIBXL_NIC_TYPE_VIF; } > Type == VIF_IOEMU (which > is the default for a VIF on an HVM guest) means both emulated and pv. > (there were bugs in the semantics here in very early versions of libxl, > but I thought they were fixed even before 4.2) > On my 4.3.1 setup, I changed the above to if (hvm) { x_nic->nictype = LIBXL_NIC_TYPE_VIF_IOEMU; if (l_nic->model) { if (VIR_STRDUP(x_nic->model, l_nic->model) < 0) return -1; if (STREQ(l_nic->model, "netfront")) x_nic->nictype = LIBXL_NIC_TYPE_VIF; } } else { x_nic->nictype = LIBXL_NIC_TYPE_VIF; } which is better initialization logic IMO. If the domain is hvm, set nictype to LIBXL_NIC_TYPE_VIF_IOEMU, unless model 'netfront' is specified. This behavior is consistent with the legacy xen driver. The change seems to work fine and resolves the PXE issue Stefan noted - as long as I initialize devid in libvirt. So we'll need the above fix in libvirt, as well as a resolution to the nic devid initialization in libxl that started this thread. Regards, Jim