aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Shanahan <kmshanah@disenchant.net>2012-09-21 08:50:22 +0930
committerDoug Goldstein <cardoe@cardoe.com>2012-11-21 15:21:18 -0600
commit5c161e01ff70d94ec36937e3153e6751a98e222d (patch)
tree0587489406bdf1829921ab85380376135df479cd
parenti386: kvm: bit 10 of CPUID[8000_0001].EDX is reserved (diff)
downloadqemu-kvm-5c161e01ff70d94ec36937e3153e6751a98e222d.tar.gz
qemu-kvm-5c161e01ff70d94ec36937e3153e6751a98e222d.tar.bz2
qemu-kvm-5c161e01ff70d94ec36937e3153e6751a98e222d.zip
blockdev: preserve readonly and snapshot states across media changes
If readonly=on is given at device creation time, the ->readonly flag needs to be set in the block driver state for this device so that readonly-ness is preserved across media changes (qmp change command). Similarly, to preserve the snapshot property requires ->open_flags to be correct. Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net> Signed-off-by: Kevin Wolf <kwolf@redhat.com> (cherry picked from commit 80dd1aae3657a902d262f5d20a7a3c655b23705e)
-rw-r--r--blockdev.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/blockdev.c b/blockdev.c
index 0d20460f0..0858de182 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -535,6 +535,8 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi)
devname, mediastr, unit_id);
}
dinfo->bdrv = bdrv_new(dinfo->id);
+ dinfo->bdrv->open_flags = snapshot ? BDRV_O_SNAPSHOT : 0;
+ dinfo->bdrv->read_only = ro;
dinfo->devaddr = devaddr;
dinfo->type = type;
dinfo->bus = bus_id;