aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2013-06-04 09:26:49 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2013-06-04 09:26:49 -0500
commita3416197447e7846a927b6ccb4f1edb3a1982443 (patch)
tree5bc8954542b3dc382bfe5737636007b5bb6aa28e /hw
parente47dccc64b6ca570e4db96fd5fdb3bef251eb559 (diff)
parent5b91704469c0f801e0219f26458356872c4145ab (diff)
downloadqemu-a3416197447e7846a927b6ccb4f1edb3a1982443.zip
qemu-a3416197447e7846a927b6ccb4f1edb3a1982443.tar.gz
qemu-a3416197447e7846a927b6ccb4f1edb3a1982443.tar.bz2
Merge remote-tracking branch 'kwolf/for-anthony' into staging
# By Stefan Hajnoczi (6) and others # Via Kevin Wolf * kwolf/for-anthony: block: dump snapshot and image info to specified output block: move qmp and info dump related code to block/qapi.c block: move snapshot code in block.c to block/snapshot.c block: drop bs_snapshots global variable qemu-iotests: make create_image() common qemu-iotests: make compare_images() common qemu-iotests: make cancel_and_wait() common qemu-iotests: make assert_no_active_block_jobs() common block: add block driver read only whitelist qemu-iotests: fix 054 cluster size help output Message-id: 1370349940-4703-1-git-send-email-kwolf@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/block/xen_disk.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c
index 0ac65d4..247f32f 100644
--- a/hw/block/xen_disk.c
+++ b/hw/block/xen_disk.c
@@ -780,11 +780,13 @@ static int blk_connect(struct XenDevice *xendev)
{
struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev);
int pers, index, qflags;
+ bool readonly = true;
/* read-only ? */
qflags = BDRV_O_CACHE_WB | BDRV_O_NATIVE_AIO;
if (strcmp(blkdev->mode, "w") == 0) {
qflags |= BDRV_O_RDWR;
+ readonly = false;
}
/* init qemu block driver */
@@ -795,8 +797,10 @@ static int blk_connect(struct XenDevice *xendev)
xen_be_printf(&blkdev->xendev, 2, "create new bdrv (xenbus setup)\n");
blkdev->bs = bdrv_new(blkdev->dev);
if (blkdev->bs) {
- if (bdrv_open(blkdev->bs, blkdev->filename, NULL, qflags,
- bdrv_find_whitelisted_format(blkdev->fileproto)) != 0) {
+ BlockDriver *drv = bdrv_find_whitelisted_format(blkdev->fileproto,
+ readonly);
+ if (bdrv_open(blkdev->bs,
+ blkdev->filename, NULL, qflags, drv) != 0) {
bdrv_delete(blkdev->bs);
blkdev->bs = NULL;
}