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

[Xen-devel] [RFC] libxl hotplug / unplug emulated devices



Hi all

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.

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.

I think the ability to plug in emulated devices is nice to have -- how
important this is is up for debate.  As far as I can tell, at
least for nic, plugging in an emulated nic never worked in libxl. I
can't speak for xend. I also don't see many complains, so this is
probably not that important after all. On the other hand, it might be a
prerequisite for HVM usb passthrough?

The other angle is that we only support plugging in pv devices. Then
the rest of this email is moot. I will fix the network attach command
and we call it a day. :-)

To plug in emulated devices, calling out to QEMU is probably the easy
part. Also currently libxl__device_XXX_add always populates xenstore
entries, which we might not need or want. This is not too hard to
change, either.

The harder bit is to decide what should libxl do when disk and nic are
involved. That is, device that has the ability to use either emulated
path and pv path (which I think there are only disk and nic at the
moment).

Guest has ability to unplug emulated devices and switch to pv
devices. But the switch can only happen when the guest is booting. So
it would be ok to provide both emulated and pv disk / nic during guest
start up but not hotplug.

What if the user indeed wants to hotplug an emulated disk?

1. Add an extra field in diskspec to indicate intention (pv, emulated,
   both), defaults to "pv" when hotplug, "both" when creating domain.
   
2. Strictly follow the disk spec when doing hotplug, if it is emulated
   device identifier (hda, sda etc), add only emulated device, if it
   is pv identifier (xvdx etc), add only pv device. Refuse to proceed
   if nothing is specified. Note this might subtly change the device
   the guest sees, but there is no danger of data corruption.

3. Query QEMU if unplug has happened and combine this with option 1 to
   make libxl "smarter". For example, if unplug has happened, the
   intention flag defaults to pv, otherwise it defaults to both. This
   requires modifying QEMU.

Follow the same principle for nic.

Do we expect more devices to be able to switch from emulation path to
pv path?

I can take a stab at this if we make a decision on what to do.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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