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

[Xen-changelog] [xen master] libxl: Only call stat() when adding a disk if we expect a device to exist.



commit a8a1f236a2964506a22d1779648d8e1c8668cb1a
Author:     David Scott <dave.scott@xxxxxxxxxxxxx>
AuthorDate: Tue Apr 23 10:59:26 2013 +0100
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Wed Apr 24 12:15:44 2013 +0100

    libxl: Only call stat() when adding a disk if we expect a device to exist.
    
    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@xxxxxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
    Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 tools/libxl/libxl_device.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

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",
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

 


Rackspace

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