From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Bader Subject: Re: [libvirt] Setting devid for emulated NICs (Xen 4.3.1 / libvirt 1.2.0) using libxl driver Date: Wed, 18 Dec 2013 15:59:14 +0100 Message-ID: <52B1B842.4090306__17767.9091845222$1387378856$gmane$org@canonical.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> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6440296731135570941==" Return-path: In-Reply-To: <1387373284.28680.18.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, Xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --===============6440296731135570941== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="gmXriiMmNJhPQOKvg5Wv8xd2l45J8RNu9" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --gmXriiMmNJhPQOKvg5Wv8xd2l45J8RNu9 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 18.12.2013 14:28, Ian Campbell wrote: > On Wed, 2013-12-18 at 14:12 +0100, Stefan Bader wrote: >> On 18.12.2013 13:27, Ian Campbell wrote: >>> On Tue, 2013-12-17 at 18:32 +0100, Stefan Bader wrote: >>>>> >>>>> Might this libxl fix be relevant: >>>>> commit 5420f26507fc5c9853eb1076401a8658d72669da >>>>> Author: Jim Fehlig >>>>> Date: Fri Jan 11 12:22:26 2013 +0000 >>>>> =20 >>>>> libxl: Set vfb and vkb devid if not done so by the call= er >>>>> =20 >>>>> Other devices set a sensible devid if the caller has no= t done so. >>>>> Do the same for vfb and vkb. While at it, factor out t= he common code >>>>> used to determine a sensible devid, so it can be used b= y other >>>>> libxl__device_*_add functions. >>>>> =20 >>>>> Signed-off-by: Jim Fehlig >>>>> Acked-by: Ian Campbell >>>>> Committed-by: Ian Campbell >>>>> =20 >>>>> and a follow up in dfeccbeaa. Although the comment implies that nic= 's >>>>> were already correctly assigning a devid if the caller specified -1= , so >>>>> I don't know why it doesn't work for you :-( >>>> >>>> Ok, yes, the commit above indeed changes libxl__device_nic_add to ca= ll >>>> libxl__device_nextid for the devid... Just how is this actually call= ed. >>>> Maybe not sufficient but "git grep libxl__device_nic_add" in the xen= code only >>>> shows the definition and a declaration in libxl_internal.h to me... >>> >>> I have a feeling a macro might be involved... >>> >>> Here we go, look for DEFINE_DEVICE_REMOVE in libxl.c. We should reall= y >>> add the eventual function names in comments to provide grep fodder...= =2E >> >> Oh duh, yeah. So in DEFINE_DEVICE_ADD a libxl_device_nic_add is create= d which >> calls to libxl__device_nic_add. When I look for the single _ version I= find a >> call from xl_cmdimpl.c and its public declaration in libxl.h. >> So I guess the bug is that libvirt in the libxl driver never seems to = do so >=20 > The macro creates libxl__add_nics which adds the nics from the > libxl_domain_config->nics array. I don't think libvirt needs to call > libxl_device_nic_add manually unless it is hotplugging a new nic at > runtime. >=20 Hm, so I think this is the path: libxl_domain_create_new -> do_domain_create -> initiate_domain_create -> libxl__bootloader_run (HVM domain, skipping bootloader) <- domcreate_bootloader_done -> domcreate_rebuild_done <- domcreate_launch_dm -> libxl__spawn_local_dm <- domcreate_devmodel_started In libxl__spawn_local_dm, there is the following loop: for (i =3D 0; i < d_config->num_nics; i++) { /* We have to init the nic here, because we still haven't * called libxl_device_nic_add at this point, but qemu needs * the nic information to be complete. */ ret =3D libxl__device_nic_setdefault(gc, &d_config->nics[i], domi= d); if (ret) goto error_out; } So I think when starting the dm, the devid just is not set as setdefault = does not seem to do so. I would be done in the later domcreate_devmodel_starte= d callback but that is too late for the generated qemu arguments. -Stefan --gmXriiMmNJhPQOKvg5Wv8xd2l45J8RNu9 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBCgAGBQJSsbhCAAoJEOhnXe7L7s6joSkQAM4XCJVytif04U7uY0njqaSS 7KfBfH5ZNiF/3WnoySe9o2fFQq1xVOilybvoTLUiNEfToC6SbowcMmr8dzcMvYTx /h8ofgeIP5iqgoN8a0FZvjzhfwxaYrK6I4xaL0z8lDlAEUxY0vze1cQxFhufgS/F XQHr5g8mPydyFgIejzMMHosFmpN8Bv3KJz2OAHOb+bHHX9uf7+I0OYh0njDrP++n WB5ZAXX0NWnSZ6NW229Np5CqqMU85KfYOJb/9fa4HMQok6tcYrngIK/fq5HDWZRz BmJOCxBG1xQ0zXTOZZQLCUo9e6AwzSouM6NHK5D0C5kjTTCpocaR9tfoM+mRXwKn +YzkPy9SU9eclmtLsBMksgKOgLRztvwE/a1B8t+EqjCjdnUXGbWtKdoYMSvLuIZX KWfpMVTS61cWf+XJ0fRkYy50gB9Tg0eYw0JXd/Ed29pNBUkn+u2OWCDlrwmN3h9H joP2xprnbTM8OML4wLKuMfnlY2+P244K4ZYTZGjZG1nz1elseHshtXkzt+LHu/gG PsUBJuMFAxIVwZoqVfe0bJXZXWu6105n3W+llenu/4VvF/TviK6045oVmwVACO70 Jyx/7ollKMf/3q8smKBmyeWroXrTSr/VT3HJAhdn2V/37gf4Iv4rpGvWwXukWu+i I+h/X6ehGSqk7niklnl+ =In86 -----END PGP SIGNATURE----- --gmXriiMmNJhPQOKvg5Wv8xd2l45J8RNu9-- --===============6440296731135570941== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============6440296731135570941==--