libxl: Allow local access for block devices with hotplug scripts
authorGeorge Dunlap <george.dunlap@eu.citrix.com>
Thu, 24 Mar 2016 17:18:34 +0000 (17:18 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Mon, 4 Apr 2016 16:49:09 +0000 (17:49 +0100)
commit982e4ef9ec7dd86e5a3bd114190c28d487839d97
tree8bcf6b2a80a41413de2fd0c202c4367d6d6895b0
parentba09d5fcaa7d02645e9e78a66d3f1da8cef49008
libxl: Allow local access for block devices with hotplug scripts

pygrub and qemuu need to be able to access a VM's disks locally in
order to be able to pull out the kernel and provide emulated disk
access, respectively.  This can be done either by accessing the local
disk directly, or by plugging the target disk into dom0 to allow
access.

Unfortunately, while the plugging machinery works for pygrub, it does
not yet work for qemuu; this means that at the moment, disks with
hotplug scripts or disks with non-dom0 backends cannot be provided as
emulated devices to HVM domains.

Fortunately, disks using hotplug scripts created in dom0 do create a
block device as part of set-up, which can be accessed locally; and if
they use block-common.sh:write_dev, this path will be written to
physical-device-path.

Modify libxl__device_disk_setdefault() to be able to fish this path
out of xenstore and pass it to the caller.

Unfortunately, at the time pygrub runs, the devices have not yet been
set up.  Rather than try to stash the domid somewhere to pass, we just
pass INVALID_DOMID.

This allows qemuu to emulate block devices created with custom hotplug
scripts.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Tested-by: George Dunlap <george.dunlap@citrix.com>
tools/libxl/libxl.c
tools/libxl/libxl_dm.c
tools/libxl/libxl_internal.h