From: Ian Campbell Subject: Re: [PATCH 07/14] libxl: disks: Make LIBXL_DISK_BACKEND_UNKNOWN work Date: Fri, 13 May 2011 11:38:34 +0100 Message-ID: <1305283114.31488.82.camel@zakaz.uk.xensource.com> References: <1305211004-31687-1-git-send-email-ian.jackson@eu.citrix.com> <1305211004-31687-2-git-send-email-ian.jackson@eu.citrix.com> <1305211004-31687-3-git-send-email-ian.jackson@eu.citrix.com> <1305211004-31687-4-git-send-email-ian.jackson@eu.citrix.com> <1305211004-31687-5-git-send-email-ian.jackson@eu.citrix.com> <1305211004-31687-6-git-send-email-ian.jackson@eu.citrix.com> <1305211004-31687-7-git-send-email-ian.jackson@eu.citrix.com> <1305211004-31687-8-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1305211004-31687-8-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Jackson Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On Thu, 2011-05-12 at 15:36 +0100, Ian Jackson wrote: > libxl callers should not be required to specify the backend if they > don't want to. So LIBXL_DISK_BACKEND_UNKNOWN should instruct libxl to > choose the backend for itself. I guess the selection of LIBXL_DISK_BACKEND_TAP was chosen to give the greatest coverage as a stop gap measure until more smarts arrive? (It'll fall back to QDISK as necessary too, which is nice). > > More thorough fixes for the disk handling will follow. > > Signed-off-by: Ian Jackson Acked-by: Ian Campbell > --- > tools/libxl/libxl.c | 15 +++++++++++++++ > 1 files changed, 15 insertions(+), 0 deletions(-) > > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c > index fe012cb..73fc3e9 100644 > --- a/tools/libxl/libxl.c > +++ b/tools/libxl/libxl.c > @@ -989,6 +989,21 @@ int libxl_device_disk_add(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *dis > device.domid = domid; > device.kind = DEVICE_VBD; > > + > + /* > + * Fixing the incoming backend type to try to decide on which > + * backend to use. Unfortunately at the moment this code is > + * utterly broken, but it more or less works. > + */ > + > + /* > + * Backend type UNKNOWN should mean "caller does not want to specify", > + * not "break pointlessely". (Callers should not be required to > + * specify the backend if they don't want to.) > + */ > + if (disk->backend == LIBXL_DISK_BACKEND_UNKNOWN) > + disk->backend = LIBXL_DISK_BACKEND_TAP; > + > /* If blktap is not available then fallback to qdisk */ > if (disk->backend == LIBXL_DISK_BACKEND_TAP && !libxl__blktap_enabled(&gc)) > disk->backend = LIBXL_DISK_BACKEND_QDISK;