From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?ISO-8859-1?Q?Roger_Pau_Monn=E9?= Subject: Re: [PATCH v2] Only call stat() when adding a disk if we expect a device to exist. Date: Tue, 23 Apr 2013 16:08:49 +0200 Message-ID: <517695F1.4000206@citrix.com> References: <1366711166-28296-1-git-send-email-dave.scott@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <1366711166-28296-1-git-send-email-dave.scott@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: David Scott Cc: Ian Campbell , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On 23/04/13 11:59, David Scott wrote: > 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=3D[ 'backendtype=3Dqdisk,format=3Draw,vdev=3Dhda,access=3Drw,target= =3Drbd:rbd/ubuntu1204.img' ] > = > Signed-off-by: David Scott > Acked-by: Ian Campbell Acked-by: Roger Pau Monn=E9 > --- > 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, lib= xl_device_disk *disk) { > return ERROR_INVAL; > } > memset(&a.stab, 0, sizeof(a.stab)); > - } else if (!disk->script) { > + } else if (disk->backend =3D=3D LIBXL_DISK_BACKEND_PHY && > + disk->backend_domid =3D=3D LIBXL_TOOLSTACK_DOMID && > + !disk->script) { > if (stat(disk->pdev_path, &a.stab)) { > LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Disk vdev=3D%s " > "failed to stat: %s", > =