[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] libs/light: pass some infos to qemu


  • To: Manuel Bouyer <bouyer@xxxxxxxxxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 18 Jan 2021 09:36:42 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+WMtZFaI/PYvDbVoc+UqhJm8Ozkd5lD/yFCuoT5gb+c=; b=Q5bG7S0RcZMc9p8VWrI+PYtJft69tTfn6m/F4+eyZoacYG3BQdPsc7JWjDe6rKvo4fcXbI1rKy84DclhEr2l/bdR5yb2AdZSH49LvRfbbLoslpc2jgr9fyV4fmO48TYiKZUpUNNuduFiKWM2FtHKqsjGK1+O/Xm6xl6mcAebO9Nu84GSNbxfmp/qLgw9XR7Zx2KS4MbrJWQUCLBD2eXsuXEurb3fTXMZasm/RkVyHhoUZ2T8udbMTayNtMneE1qkJOYlmjvmgTLHFgnt2ms3hO9+v/tI0OPOcZxuvQUeZeIoX+ncVvw3nxeYqdAmecbg0GFDbYcwlStwZAjO8fGi1g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NB1MqlGcbAYxlM97ZP+au67iMsd8Dfsz9SulXf5qI7W60Ny/iGhoY7b7q513p/afV5vuR++zZkFwejNpA+YoCVJVNGHePvZUrNumBdFNsi+JHh6KJIm2w/qI/W6kNsNKhHZ+PiOql9Vhl2M3Ag2IKGkYbX//req7/605MbuYJctp5esdiLKYl6D73p1JzL/YLOYex7kRuBfiH/TVTCuzDNs4mDpT0Rx/02vIl/mgyijxI99AI5EogNx4QfTmLHJTWoTCUaFAu+4VXHo17+YtyBI/T9zUo9JlEM8ffG8I+nYGbJP57mm9RWfnqguyFA4NA/mtcBlTZWefc6znKnsmIw==
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Mon, 18 Jan 2021 08:36:58 +0000
  • Ironport-sdr: g1QNv0xjmMztcCJ5cBsJA9ua//hNz65yGSWf0LD+a/nf3GvOzVEX8H16YjpdjzxutZ1T1LHQy5 DNBfnnnPOa8CTTzprY/0Jcp0JhzA69NNxj22qIk31gkLxdqIiJUlFk95CxW62dJWtKz9+NcgG4 ZAH98UVegKQ9X+DRgfY2Q88zY9EKz9FgYphazdflgi5ifBk7JtsLKSdP8EB6oBrWw2u5woYv31 58PWWVyTFzGIpoxAyr53EL8U12u3TXLNzaBvcsQ4nH5MdZ6ttBAKYPLJHw6WsRMA2NIKmtiWWn sFU=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Sat, Jan 16, 2021 at 12:25:02PM +0100, Manuel Bouyer wrote:
> On Sat, Jan 16, 2021 at 11:16:06AM +0100, Roger Pau Monné wrote:
> > On Tue, Jan 12, 2021 at 07:12:37PM +0100, Manuel Bouyer wrote:
> > > From: Manuel Bouyer <bouyer@xxxxxxxxxx>
> > > 
> > > Pass bridge name to qemu as command line option
> > > When starting qemu, set an environnement variable XEN_DOMAIN_ID,
> > > to be used by qemu helper scripts
> > > 
> > > Signed-off-by: Manuel Bouyer <bouyer@xxxxxxxxxx>
> > > ---
> > >  tools/libs/light/libxl_dm.c | 6 ++++++
> > >  1 file changed, 6 insertions(+)
> > > 
> > > diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
> > > index 3da83259c0..8866c3f5ad 100644
> > > --- a/tools/libs/light/libxl_dm.c
> > > +++ b/tools/libs/light/libxl_dm.c
> > > @@ -761,6 +761,8 @@ static int 
> > > libxl__build_device_model_args_old(libxl__gc *gc,
> > >          int nr_set_cpus = 0;
> > >          char *s;
> > >  
> > > +        flexarray_append_pair(dm_envs, "XEN_DOMAIN_ID", GCSPRINTF("%d", 
> > > domid));
> > > +
> > >          if (b_info->kernel) {
> > >              LOGD(ERROR, domid, "HVM direct kernel boot is not supported 
> > > by "
> > >                   "qemu-xen-traditional");
> > > @@ -1547,8 +1549,10 @@ static int 
> > > libxl__build_device_model_args_new(libxl__gc *gc,
> > >                  flexarray_append(dm_args, "-netdev");
> > >                  flexarray_append(dm_args,
> > >                                   GCSPRINTF("type=tap,id=net%d,ifname=%s,"
> > > +                                    "br=%s,"
> > >                                             "script=%s,downscript=%s",
> > >                                             nics[i].devid, ifname,
> > > +                                    nics[i].bridge,
> > 
> > You have some hard tabs in there.
> 
> Yes. What's the problem ?

This file (and libxenlight) uses only spaces for indentation, it
breaks the coding style.

The line you added above uses spaces and it's fine.

> > 
> > Also looking at the manual the br= option seems to only be available
> > for the bridge networking mode, while here Xen is using tap instead?
> 
> Unless I missed something, the bridge networking mode is using the
> tap interface, to connect qemu to the bridge. And indeed, the qemu-ifup
> script is doing
> exec /sbin/brconfig $2 add $1
> 
> (the script is called with: qemu-ifup <tap if> <bridge if>)
> 
> This is a problem that hit me when I converted NetBSD to qemu-xen:
> qemu-traditional does call the qemu-ifup script with the 2 parameters,
> while qemu-xen calls it only with the tap if. So the qemu-ifup script can't
> know to which bridge the tap interface should be attached to.

OK, so the only functional difference of adding the br parameter is
that it gets passed to the script. I would add that to the commit
message:

"The only functional difference of using the br parameter is that the
bridge name gets passed to the QEMU script."

Note also that there are networking modes that don't use a bridge, so
you could likely end up with nics[i].bridge == NULL?

I also wonder why NetBSD needs to add the tap interface to the bridge
in the QEMU script instead of doing it from the hotplug script called
by libxl, like Linux and FreeBSD do.

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.