From: Kamala Narasimhan <kamala.narasimhan@gmail.com>
To: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>,
Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Subject: [PATCH] xl: Special case tap/aio for disk validation
Date: Wed, 26 Jan 2011 14:46:14 -0500 [thread overview]
Message-ID: <4D407A06.1050902@gmail.com> (raw)
Current disk validation code will fail when the disk file path is prefixed with tap:aio:vhd in the disk configuration file option. This patch special cases tap:aio validation.
Note: It appears qcow/qcow2 file format does not work with the current tapdisk. So, I am checking only for vhd file format. If there are other formats to check also, let me know.
Signed-off-by: Kamala Narasimhan <kamala.narasimhan@citrix.com>
Kamala
diff -r 67d5b8004947 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Wed Jan 26 11:58:45 2011 +0000
+++ b/tools/libxl/libxl.c Wed Jan 26 14:26:57 2011 -0500
@@ -836,22 +836,40 @@ static int validate_virtual_disk(libxl_c
static int validate_virtual_disk(libxl_ctx *ctx, char *file_name, libxl_disk_phystype disk_type)
{
struct stat stat_buf;
+ const char *fname;
if ( (file_name[0] == '\0') && (disk_type == PHYSTYPE_EMPTY) )
return 0;
- if ( stat(file_name, &stat_buf) != 0 ) {
- LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to stat %s", file_name);
+ if ( disk_type == PHYSTYPE_AIO ) {
+ fname = strchr(file_name, ':');
+ if ( fname == NULL ) {
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "missing file format prefix!"
+ " tap:aio disk option must be followed by file format type");
+ return ERROR_INVAL;
+ }
+ fname++;
+ if ( strncmp(file_name, "vhd:", sizeof("vhd:")-1) != 0 ) {
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Only vhd file format supported"
+ " with tapdisk");
+ return ERROR_INVAL;
+ }
+ }
+ else
+ fname = file_name;
+
+ if ( stat(fname, &stat_buf) != 0 ) {
+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to stat %s", fname);
return ERROR_INVAL;
}
if ( disk_type == PHYSTYPE_PHY ) {
if ( !(S_ISBLK(stat_buf.st_mode)) ) {
LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Virtual disk %s is not a block device!\n",
- file_name);
+ fname);
return ERROR_INVAL;
}
} else if ( S_ISREG(stat_buf.st_mode) && stat_buf.st_size == 0 ) {
- LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Virtual disk %s size is 0!\n", file_name);
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Virtual disk %s size is 0!\n", fname);
return ERROR_INVAL;
}
next reply other threads:[~2011-01-26 19:46 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-26 19:46 Kamala Narasimhan [this message]
2011-01-27 15:17 ` [PATCH] xl: Special case tap/aio for disk validation Stefano Stabellini
2011-01-27 15:22 ` Ian Jackson
2011-01-27 15:35 ` Ian Campbell
2011-01-27 16:23 ` Ian Jackson
2011-01-27 17:46 ` Kamala Narasimhan
2011-01-27 17:59 ` Stefano Stabellini
2011-01-27 20:14 ` Kamala Narasimhan
2011-01-28 9:27 ` Ian Campbell
2011-01-28 12:51 ` Stefano Stabellini
2011-01-27 17:53 ` Ian Campbell
2011-01-27 17:43 ` Kamala Narasimhan
2011-01-27 16:08 ` Philipp Hahn
2011-01-27 17:31 ` Kamala Narasimhan
2011-01-27 17:54 ` Stefano Stabellini
2011-01-27 18:35 ` Ian Jackson
2011-01-27 18:46 ` Ian Campbell
2011-01-27 18:46 ` Stefano Stabellini
2011-01-28 1:56 ` Kamala Narasimhan
2011-01-28 10:06 ` Ian Campbell
2011-01-28 10:25 ` Ian Campbell
2011-01-28 12:02 ` Ian Jackson
2011-01-28 13:19 ` Stefano Stabellini
2011-01-28 13:21 ` Ian Campbell
2011-01-28 13:28 ` Stefano Stabellini
2011-01-28 13:29 ` Ian Campbell
2011-01-28 15:11 ` Kamala Narasimhan
2011-01-28 14:43 ` Kamala Narasimhan
2011-01-28 17:22 ` Kamala Narasimhan
2011-01-28 19:10 ` Kamala Narasimhan
2011-01-31 17:28 ` Stefano Stabellini
2011-01-28 13:11 ` Stefano Stabellini
2011-01-28 17:55 ` Ian Jackson
2011-01-27 22:15 ` Kamala Narasimhan
2011-01-28 12:57 ` xl: drdb support Stefano Stabellini
2011-01-28 16:48 ` Shriram Rajagopalan
2011-01-28 17:58 ` Ian Jackson
2011-01-28 18:03 ` Stefano Stabellini
2011-01-28 18:06 ` Ian Jackson
2011-01-28 18:12 ` Stefano Stabellini
2011-01-28 18:16 ` Ian Jackson
2011-01-28 21:41 ` James Harper
2011-01-29 1:12 ` James Harper
2011-01-29 12:53 ` RE: drdb support / xend locking for live migration Pasi Kärkkäinen
2011-01-28 16:03 ` [PATCH] xl: Special case tap/aio for disk validation Jim Fehlig
2011-01-28 16:30 ` Stefano Stabellini
2011-01-28 16:52 ` Jim Fehlig
2011-01-28 17:51 ` Stefano Stabellini
2011-01-28 17:53 ` Ian Jackson
2011-01-27 22:31 ` M A Young
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=4D407A06.1050902@gmail.com \
--to=kamala.narasimhan@gmail.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=Stefano.Stabellini@eu.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 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.