From: Wei Liu <wei.liu2@citrix.com>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Anthony PERARD <anthony.perard@citrix.com>,
Xen-devel <xen-devel@lists.xenproject.org>,
Wei Liu <wei.liu2@citrix.com>,
George Dunlap <george.dunlap@eu.citrix.com>
Subject: Re: [RFC] libxl hotplug / unplug emulated devices
Date: Mon, 23 May 2016 11:45:31 +0100 [thread overview]
Message-ID: <20160523104531.GL31272@citrix.com> (raw)
In-Reply-To: <20160520174504.GF31272@citrix.com>
On Fri, May 20, 2016 at 06:45:04PM +0100, Wei Liu wrote:
> On Fri, May 20, 2016 at 05:38:44PM +0100, Ian Jackson wrote:
> > Wei Liu writes ("[RFC] libxl hotplug / unplug emulated devices"):
> > > Recently I got a report on xen-users@ about xl network-attach not
> > > working for HVM guest.
> > >
> > > I try to use
> > > xl network-attach jessie-hvm 'bridge=xenbr0'
> > > and vif-bridge script complains that it can't add vifXX-emu to bridge.
> > >
> > > The underlying issue is that the vif spec provided defaults to
> > > emulated nic, but libxl only populates a pv nic but doesn't call out
> > > via QMP to QEMU to populate one. Note that this issue not only affects
> > > nic device but essentially all device types.
> >
> > Is it really sensible to offer emulated nic hotplug ? That'd be
> > presented to the guest as pci hotplug, I guess ?
> >
> > > I also experimented with block device:
> > > xl block-attach jessie-hvm 'phy:/dev/DATA/disk,hdb,w'
> > > and it succeed, only pv disk is populated though.
> >
> > That's what I would have expected.
> >
> > Maybe the fix should be that xl network-attach should default hotplug
> > nics to pv only.
> >
>
> Here is a patch to do this. :-)
>
> ---8<---
> From 0a0a0ac76f825983bb13d70e46a59cabb05ed77b Mon Sep 17 00:00:00 2001
> From: Wei Liu <wei.liu2@citrix.com>
> Date: Fri, 20 May 2016 18:16:05 +0100
> Subject: [PATCH for-4.7] libxl: nic type defaults to vif in hotplug for hvm guest
>
> We don't support plugging in emulated nic to a HVM guest.
>
> The "update_json" flag is only set when doing hotplug, so use that as an
> indicator in libxl__device_nic_add. The new hotplug flag to _setdefault
> function should be false in all other locations.
>
> This then requires saving nic type in JSON file, because we don't want
> the receiving end to recalculate the nic type.
>
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
> tools/libxl/libxl.c | 6 +++---
> tools/libxl/libxl_create.c | 3 ++-
> tools/libxl/libxl_dm.c | 3 ++-
> tools/libxl/libxl_internal.h | 3 ++-
> 4 files changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> index c39d745..62e9294 100644
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -3319,7 +3319,7 @@ out:
> /******************************************************************************/
>
> int libxl__device_nic_setdefault(libxl__gc *gc, libxl_device_nic *nic,
> - uint32_t domid)
> + uint32_t domid, bool hotplug)
> {
> int rc;
>
> @@ -3358,7 +3358,7 @@ int libxl__device_nic_setdefault(libxl__gc *gc, libxl_device_nic *nic,
> case LIBXL_DOMAIN_TYPE_HVM:
> if (!nic->nictype) {
> if (libxl__device_model_version_running(gc, domid) ==
> - LIBXL_DEVICE_MODEL_VERSION_NONE)
> + LIBXL_DEVICE_MODEL_VERSION_NONE || hotplug)
> nic->nictype = LIBXL_NIC_TYPE_VIF;
@@ -3357,8 +3357,9 @@ int libxl__device_nic_setdefault(libxl__gc *gc, libxl_device_nic *nic,
switch (libxl__domain_type(gc, domid)) {
case LIBXL_DOMAIN_TYPE_HVM:
if (!nic->nictype) {
- if (libxl__device_model_version_running(gc, domid) ==
- LIBXL_DEVICE_MODEL_VERSION_NONE)
+ if (hotplug ||
+ (libxl__device_model_version_running(gc, domid) ==
+ LIBXL_DEVICE_MODEL_VERSION_NONE))
nic->nictype = LIBXL_NIC_TYPE_VIF;
I changed the snippet to above and will push this patch soon.
Wei.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
prev parent reply other threads:[~2016-05-23 10:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-20 16:34 [RFC] libxl hotplug / unplug emulated devices Wei Liu
2016-05-20 16:38 ` Ian Jackson
2016-05-20 16:42 ` Wei Liu
2016-05-20 16:45 ` Andrew Cooper
2016-05-20 16:49 ` Wei Liu
2016-05-20 17:45 ` Wei Liu
2016-05-20 17:58 ` Ian Jackson
2016-05-20 18:04 ` Wei Liu
2016-05-20 18:05 ` Ian Jackson
2016-05-20 18:05 ` Wei Liu
2016-05-23 9:32 ` George Dunlap
2016-05-23 10:28 ` Wei Liu
2016-05-23 10:45 ` Wei Liu [this message]
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=20160523104531.GL31272@citrix.com \
--to=wei.liu2@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=anthony.perard@citrix.com \
--cc=george.dunlap@eu.citrix.com \
--cc=xen-devel@lists.xenproject.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).