libxl: Share logic for finding path between qemuu and pygrub
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:00 +0000 (17:49 +0100)
commitba09d5fcaa7d02645e9e78a66d3f1da8cef49008
tree05f4e2709bc51e0c6f0fa29e9899294328db6653
parent3fec17d4bb56567d139d7806392f4d8702d3f6a7
libxl: Share logic for finding path between qemuu and pygrub

qemu can also access disks which will be provided with a qdisk backend
directly; add a flag to libxl__device_disk_find_local_path to indicate
whether to check for qdisk direct access.

Call libxl__device_disk_find_local_path() for most paths.  If we can't
find a local path, print an error and skip the disk, rather than using
a bogus path.

Now if there is no local access to the disk (i.e., because the disk
has a non-local backend, or relies on a custom hotplug script), libxl
will now print a warning and not provide the emulated disk, rather
than providing bogus parameters to qemu which cause it to error out.
(Such disks will still be available via the PV backend.)

I left the libxl__blktap_devpath in the qemuu-specific code rather
than sharing it with the pyrgub code because:

1) When the pygrub path runs the guest disks have not yet been set up

2) libxl__blktap_devpath() will give you the existing devpath if it
already exists, but will set one up for you if you don't.  So on the
pygrub path, this would end up setting up a new tap device.

3) There is no tap-specific teardown code on the pygrub path, and I
don't want to add any (particularly since I'm hoping to remove tapdisk
altogether soon).

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