From: Ian Campbell <ian.campbell@citrix.com>
To: xen-devel@lists.xensource.com
Cc: Ian Campbell <ian.campbell@citrix.com>
Subject: [PATCH 2 of 7] libxl: make fallback from blktap2 to qdisk more explicit
Date: Thu, 07 Apr 2011 10:52:28 +0100 [thread overview]
Message-ID: <76d363a113e5ee6111bc.1302169948@localhost.localdomain> (raw)
In-Reply-To: <patchbomb.1302169946@localhost.localdomain>
# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1302167195 -3600
# Node ID 76d363a113e5ee6111bc9e0eca5a314644ce6295
# Parent 29af1669de3ab2e7d41078eb33a0dfa9b69f09bb
libxl: make fallback from blktap2 to qdisk more explicit.
When blktap2 is not present we fallback to qdisk, instead of falling
through a switch statement instead make this explicit, with a comment,
prior to the switch statement.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
diff -r 29af1669de3a -r 76d363a113e5 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Thu Apr 07 10:06:12 2011 +0100
+++ b/tools/libxl/libxl.c Thu Apr 07 10:06:35 2011 +0100
@@ -979,6 +979,10 @@ int libxl_device_disk_add(libxl_ctx *ctx
device.domid = domid;
device.kind = DEVICE_VBD;
+ /* If blktap is not available then fallback to qdisk */
+ if (disk->backend == DISK_BACKEND_TAP && !libxl__blktap_enabled(&gc))
+ disk->backend = DISK_BACKEND_QDISK;
+
switch (disk->backend) {
case DISK_BACKEND_PHY:
libxl__device_physdisk_major_minor(disk->pdev_path, &major, &minor);
@@ -991,7 +995,7 @@ int libxl_device_disk_add(libxl_ctx *ctx
device.backend_kind = DEVICE_VBD;
break;
case DISK_BACKEND_TAP:
- if (libxl__blktap_enabled(&gc) && disk->format != DISK_FORMAT_EMPTY) {
+ if (disk->format != DISK_FORMAT_EMPTY) {
const char *dev = libxl__blktap_devpath(&gc,
disk->pdev_path, disk->format);
if (!dev) {
@@ -1012,7 +1016,8 @@ int libxl_device_disk_add(libxl_ctx *ctx
break;
}
- case DISK_BACKEND_QDISK:
+ break;
+ case DISK_BACKEND_QDISK:
flexarray_append(back, "params");
flexarray_append(back, libxl__sprintf(&gc, "%s:%s",
libxl__device_disk_string_of_format(disk->format), disk->pdev_path));
next prev parent reply other threads:[~2011-04-07 9:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-07 9:52 [PATCH 0 of 7] libxl: refactor tap disk handling Ian Campbell
2011-04-07 9:52 ` [PATCH 1 of 7] libxl: remove impossible check for backend != DISK_BACKEND_QDISK Ian Campbell
2011-04-07 9:52 ` Ian Campbell [this message]
2011-04-07 9:52 ` [PATCH 3 of 7] libxl: convert an empty tap disk into a qdisk Ian Campbell
2011-04-07 9:52 ` [PATCH 4 of 7] libxl: only a CDROM type disk can be empty Ian Campbell
2011-04-07 9:52 ` [PATCH 5 of 7] libxl: refactor DISK_BACKEND_PHY handling in libxl_device_disk_add Ian Campbell
2011-04-07 9:52 ` [PATCH 6 of 7] libxl: handle the tail end of a tap device using the phy backend handling code Ian Campbell
2011-04-07 9:52 ` [PATCH 7 of 7] libxl: Drop internal DEVICE_TAP backend type Ian Campbell
2011-04-08 15:46 ` Ian Jackson
2011-04-07 12:31 ` [PATCH 0 of 7] libxl: refactor tap disk handling Christoph Egger
2011-04-07 14:12 ` 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=76d363a113e5ee6111bc.1302169948@localhost.localdomain \
--to=ian.campbell@citrix.com \
--cc=xen-devel@lists.xensource.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).