All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: David Scott <dave.scott@eu.citrix.com>
Cc: Ian Campbell <Ian.Campbell@citrix.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
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	[thread overview]
Message-ID: <517695F1.4000206@citrix.com> (raw)
In-Reply-To: <1366711166-28296-1-git-send-email-dave.scott@eu.citrix.com>

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=[ '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>

Acked-by: Roger Pau Monné <roger.pau@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",
> 

  reply	other threads:[~2013-04-23 14:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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é [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=517695F1.4000206@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=dave.scott@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.