All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <Ian.Campbell@citrix.com>
To: Stefan Bader <stefan.bader@canonical.com>
Cc: libvir-list@redhat.com, Jim Fehlig <jfehlig@suse.com>,
	Xen-devel@lists.xen.org
Subject: Re: [libvirt] Setting devid for emulated NICs (Xen 4.3.1 / libvirt 1.2.0) using libxl driver
Date: Thu, 19 Dec 2013 17:57:19 +0000	[thread overview]
Message-ID: <1387475839.17289.20.camel__16705.8756961071$1387475958$gmane$org@kazak.uk.xensource.com> (raw)
In-Reply-To: <52B3278D.3000607@canonical.com>

On Thu, 2013-12-19 at 18:06 +0100, Stefan Bader wrote:
> > How about we:
> >       * move the init to setdefault to catch the single NIC added via
> >         hotplug case
> 
> Init of devid?

Yes, sorry for not being clear.

>  Hm, would that work as I am not sure there is a simple way of
> differentiating between a NIC config for a single hotplug and one that is part
> of a create-time array...

The create time array would be initialised with devid's != -1 as part of
the steps outlined in the following bullets, so setdefault woudln't
touch it again.

> 
> >       * we add somewhere early in the domain create path a call to a
> >         function which assigns devids to an entire array of devices (and
> >         do it for all the different device types). Perhaps in
> >         initiate_domain_create() after the calls to
> >         libxl__domain_create_info_setdefault and
> >         libxl__domain_build_info_setdefault but before the loop calling
> >         libxl__device_disk_setdefault for the disks.
> >       * perhaps that same function should call setdefault too, after
> >         having assigned the device, rather than it being done later in
> >         an adhoc way?
> > 
> > Does that sound at all plausible?
> 
> I wonder, well this won't help for any other device types (maybe not really
> needed), what about just adding the following to the existing loop in
> domcreate_launch_dm (just a brain dump, not even tried to compile):
> 
>     for (i = 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 = libxl__device_nic_setdefault(gc, &d_config->nics[i], domid);
>         if (ret)
>             goto error_out;
> +	if (d_config->nics[i].devid < 0)
> +		d_config->nics[i].devid = i;
>     }
> 
> Of course this a gain won't work well if the caller had assigned some devids but
> not other.

Indeed.

> Ok, maybe do the loop twice, first round sets default and picks the
> highest pre-assigned devid and second round makes sure any still unassigned ones
> are set to ++that.

That would potentially leave holes, I don't know if that matters. 

> 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.

This sounds like a bug in libxl to me -- it should do something
consistent I think.

>  So setting no model in the
> xml config creates a domain with no emulated NIC (this does not matter after
> Linux is up because the emulated devices get unplugged). Just that PXE boot will
> not work. This gets odd because with the old xen (xm) driver, no model meant
> rtl8139.
> 
> Sigh, and to hijack this thread even further I noticed a quite unexpected
> behaviour when starting a domain trhough libvirt and then try to use "xl list
> -l" to get config details. "xl list" shows all running domains but "xl list -l"
> produces something like "you have to specify a domain name". I found the origin
> of this to be libxl_userdata_retrieve which takes a userdate_userid as an
> argument. Libvirt uses "libvirt-xml" for that, while xl uses "xl". This might be
> intentional and the bug is just that we need a better check for not finding the
> userdata and then skipping those domains. On the other hand ... its after all in
> both cases a domain created and started through libxl...

I think this was discussed a few weeks ago on the list, and there were
one or two separate bugs and short comings. I'm not sure which subset
were actually fixed.

One issue is that xl stored the guest config and then retrieves it for
use in xl list -l, but libvirt != xl and therefore has no config file to
save.

The solution is probably for the list stuff to be based on dynamically
gathering the domain info, instead of reparsing the config.

Ian.,

  parent reply	other threads:[~2013-12-19 17:57 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-17 16:34 Setting devid for emulated NICs (Xen 4.3.1 / libvirt 1.2.0) using libxl driver Stefan Bader
2013-12-17 16:58 ` Ian Campbell
2013-12-17 17:32   ` Stefan Bader
     [not found]   ` <52B08AA9.8010809@canonical.com>
2013-12-18 12:27     ` Ian Campbell
     [not found]     ` <1387369646.27441.129.camel@kazak.uk.xensource.com>
2013-12-18 13:12       ` [libvirt] " Stefan Bader
     [not found]       ` <52B19F4E.8010601@canonical.com>
2013-12-18 13:28         ` Ian Campbell
     [not found]         ` <1387373284.28680.18.camel@kazak.uk.xensource.com>
2013-12-18 13:57           ` Stefan Bader
2013-12-18 14:59           ` Stefan Bader
     [not found]           ` <52B1B842.4090306@canonical.com>
2013-12-19  0:44             ` Jim Fehlig
2013-12-19 10:19               ` Ian Campbell
     [not found]               ` <1387448340.9925.30.camel@kazak.uk.xensource.com>
2013-12-19 17:06                 ` Stefan Bader
     [not found]                 ` <52B3278D.3000607@canonical.com>
2013-12-19 17:57                   ` Ian Campbell [this message]
2013-12-19 18:39                   ` Jim Fehlig
     [not found]                   ` <52B33D6C.6010608@suse.com>
2013-12-20 10:11                     ` Ian Campbell
     [not found]                     ` <1387534262.17289.34.camel@kazak.uk.xensource.com>
2013-12-20 10:29                       ` Stefan Bader
2013-12-20 10:36                         ` Ian Campbell
2013-12-20 11:04                           ` Stefan Bader
2013-12-20 11:22                             ` Ian Campbell
2014-01-06 21:31                               ` Jim Fehlig
2013-12-24  6:22                       ` Jim Fehlig
     [not found]                       ` <52B92832.1030705@suse.com>
2014-01-06 21:26                         ` Jim Fehlig
     [not found]                   ` <1387475839.17289.20.camel@kazak.uk.xensource.com>
2013-12-20 10:16                     ` Stefan Bader
     [not found]                     ` <52B41906.7010506@canonical.com>
2013-12-20 10:37                       ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='1387475839.17289.20.camel__16705.8756961071$1387475958$gmane$org@kazak.uk.xensource.com' \
    --to=ian.campbell@citrix.com \
    --cc=Xen-devel@lists.xen.org \
    --cc=jfehlig@suse.com \
    --cc=libvir-list@redhat.com \
    --cc=stefan.bader@canonical.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.