Skip to contentSkip to conversation

qemu-xen: Fix extendable images

PATCH In review Kevin Wolf 2 participants 2 messages Jul 1, 2008 – Jul 2, 2008

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 qemu-xen: Fix extendable images

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

Quoted 1 line

From 2e45a5eb3a46e26f582f1cc0805a650b58c04109 Mon Sep 17 00:00:00 2001

From: Kevin Wolf <[email protected]>
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.

---
 block-raw-posix.c |    4 ++--
 block-raw-win32.c |    4 ++--
 block.c           |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
block-raw-posix.c +2 -2
index 44d8497..b1740d2 100644
@@ -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
 };
block-raw-win32.c +2 -2
index 428ff68..c94ad0e 100644
@@ -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;
 };
block.c +1 -1
index fd1fd35..b83e633 100644
@@ -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;
Signature · 1 line
1.5.4.5

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

Kevin Wolf writes ("[PATCH] qemu-xen: Fix extendable images"):

Quoted 8 lines

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.

I think you're right, thanks.

Ian.