dcavalca / rpms / qemu

Forked from rpms/qemu 11 months ago
Clone

Blame 0229-blockdev-preserve-readonly-and-snapshot-states-acros.patch

5544c1
From 2afae8c7d44a043e36038d5f6f600034ad2b2aca Mon Sep 17 00:00:00 2001
5544c1
From: Kevin Shanahan <kmshanah@disenchant.net>
5544c1
Date: Fri, 21 Sep 2012 08:50:22 +0930
5544c1
Subject: [PATCH] blockdev: preserve readonly and snapshot states across media
5544c1
 changes
5544c1
5544c1
If readonly=on is given at device creation time, the ->readonly flag
5544c1
needs to be set in the block driver state for this device so that
5544c1
readonly-ness is preserved across media changes (qmp change command).
5544c1
Similarly, to preserve the snapshot property requires ->open_flags to
5544c1
be correct.
5544c1
5544c1
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
5544c1
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5544c1
(cherry picked from commit 80dd1aae3657a902d262f5d20a7a3c655b23705e)
5544c1
5544c1
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5544c1
---
5544c1
 blockdev.c | 2 ++
5544c1
 1 file changed, 2 insertions(+)
5544c1
5544c1
diff --git a/blockdev.c b/blockdev.c
5544c1
index 4a5266e..9ba3503 100644
5544c1
--- a/blockdev.c
5544c1
+++ b/blockdev.c
5544c1
@@ -533,6 +533,8 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi)
5544c1
                      if_name[type], mediastr, unit_id);
5544c1
     }
5544c1
     dinfo->bdrv = bdrv_new(dinfo->id);
5544c1
+    dinfo->bdrv->open_flags = snapshot ? BDRV_O_SNAPSHOT : 0;
5544c1
+    dinfo->bdrv->read_only = ro;
5544c1
     dinfo->devaddr = devaddr;
5544c1
     dinfo->type = type;
5544c1
     dinfo->bus = bus_id;
5544c1
-- 
5544c1
1.7.12.1
5544c1