Hi Ian,
I'm not completely sure about this one. The question is what you really
wanted to achieve with that BLOCK_DRIVER_FLAG_EXTENDABLE thing. I
suspect that you just put it into the wrong struct accidentally
(bdrv_host_device instead of bdrv_raw), but I might be wrong. Changing
it allows me to use qcow2 images through tap:ioemu again - in fact, I
think it fixes extendable images in general, i.e. also for HVM.
Please check if the attached patch makes sense and apply if appropriate.
Kevin
>From 2e45a5eb3a46e26f582f1cc0805a650b58c04109 Mon Sep 17 00:00:00 2001
From: Kevin Wolf <kwolf@xxxxxxx>
Date: Tue, 1 Jul 2008 14:19:30 +0200
Subject: [PATCH] qemu-xen: Fix extendable images
bdrv_file_open should specify raw image format instead of guessing. This fixes
a segfault when bdrv_open2 wants to access drv->flags. bdrv_file_open is used
at least by qcow2.
Additionally, move the extensible flag from bdrv_host_device to bdrv_raw. qcow2
wants to open the image file as an extensible file.
Signed-off-by: Kevin Wolf <kwolf@xxxxxxx>
---
block-raw-posix.c | 4 ++--
block-raw-win32.c | 4 ++--
block.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/block-raw-posix.c b/block-raw-posix.c
index 44d8497..b1740d2 100644
--- a/block-raw-posix.c
+++ b/block-raw-posix.c
@@ -582,6 +582,8 @@ BlockDriver bdrv_raw = {
.bdrv_pwrite = raw_pwrite,
.bdrv_truncate = raw_truncate,
.bdrv_getlength = raw_getlength,
+
+ .bdrv_flags = BLOCK_DRIVER_FLAG_EXTENDABLE
};
/***********************************************/
@@ -942,6 +944,4 @@ BlockDriver bdrv_host_device = {
.bdrv_set_locked = raw_set_locked,
/* generic scsi device */
.bdrv_ioctl = raw_ioctl,
-
- .bdrv_flags = BLOCK_DRIVER_FLAG_EXTENDABLE
};
diff --git a/block-raw-win32.c b/block-raw-win32.c
index 428ff68..c94ad0e 100644
--- a/block-raw-win32.c
+++ b/block-raw-win32.c
@@ -399,6 +399,8 @@ BlockDriver bdrv_raw = {
.bdrv_pwrite = raw_pwrite,
.bdrv_truncate = raw_truncate,
.bdrv_getlength = raw_getlength,
+
+ .bdrv_flags = BLOCK_DRIVER_FLAG_EXTENDABLE
};
/***********************************************/
@@ -549,6 +551,4 @@ BlockDriver bdrv_host_device = {
.bdrv_pread = raw_pread,
.bdrv_pwrite = raw_pwrite,
.bdrv_getlength = raw_getlength,
-
- .bdrv_flags = BLOCK_DRIVER_FLAG_EXTENDABLE;
};
diff --git a/block.c b/block.c
index fd1fd35..b83e633 100644
--- a/block.c
+++ b/block.c
@@ -356,7 +356,7 @@ int bdrv_file_open(BlockDriverState **pbs, const char
*filename, int flags)
bs = bdrv_new("");
if (!bs)
return -ENOMEM;
- ret = bdrv_open2(bs, filename, flags | BDRV_O_FILE, NULL);
+ ret = bdrv_open2(bs, filename, flags | BDRV_O_FILE, &bdrv_raw);
if (ret < 0) {
bdrv_delete(bs);
return ret;
--
1.5.4.5
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|