All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Only call stat() when adding a disk if we expect a device to exist.
@ 2013-04-23  9:59 David Scott
  2013-04-23 14:08 ` Roger Pau Monné
  0 siblings, 1 reply; 9+ messages in thread
From: David Scott @ 2013-04-23  9:59 UTC (permalink / raw)
  To: Ian.Campbell; +Cc: xen-devel, David Scott, roger.pau

We consider calling stat() a helpful error check in the following
circumstances only:
 1. the disk backend type must be PHYsical
 2. the disk backend domain must be the same as the running libxl
    code (ie LIBXL_TOOLSTACK_DOMID)
 3. there must not be a hotplug script because this would imply that
    the device won't be created until after the hotplug script has
    run.

With this fix, it is possible to use qemu's built-in block drivers
such as ceph/rbd, with a xl config disk spec like this:

disk=[ 'backendtype=qdisk,format=raw,vdev=hda,access=rw,target=rbd:rbd/ubuntu1204.img' ]

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---
 tools/libxl/libxl_device.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index eeea9d9..eb60fd5 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -236,7 +236,9 @@ int libxl__device_disk_set_backend(libxl__gc *gc, libxl_device_disk *disk) {
             return ERROR_INVAL;
         }
         memset(&a.stab, 0, sizeof(a.stab));
-    } else if (!disk->script) {
+    } else if (disk->backend == LIBXL_DISK_BACKEND_PHY &&
+               disk->backend_domid == LIBXL_TOOLSTACK_DOMID &&
+               !disk->script) {
         if (stat(disk->pdev_path, &a.stab)) {
             LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Disk vdev=%s "
                              "failed to stat: %s",
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-04-26 14:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-23  9:59 [PATCH v2] Only call stat() when adding a disk if we expect a device to exist David Scott
2013-04-23 14:08 ` Roger Pau Monné
2013-04-24 11:56   ` Ian Campbell
2013-04-26 10:55     ` Ian Campbell
2013-04-26 11:07       ` David Scott
2013-04-26 11:17         ` Ian Campbell
2013-04-26 12:17           ` David Scott
2013-04-26 13:11             ` Ian Campbell
2013-04-26 14:16               ` Ian Campbell

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.