diff options
author | Kevin Shanahan <kmshanah@disenchant.net> | 2012-09-21 08:50:22 +0930 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2012-09-24 15:15:11 +0200 |
commit | 80dd1aae3657a902d262f5d20a7a3c655b23705e (patch) | |
tree | c4a22665f9d5483e89184d14ad018fdc97298ad1 /blockdev.c | |
parent | d3e8f95753114a827f9cd8e819b1d5cc8333f76b (diff) | |
download | qemu-80dd1aae3657a902d262f5d20a7a3c655b23705e.tar.gz qemu-80dd1aae3657a902d262f5d20a7a3c655b23705e.tar.bz2 qemu-80dd1aae3657a902d262f5d20a7a3c655b23705e.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>
Diffstat (limited to 'blockdev.c')
-rw-r--r-- | blockdev.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/blockdev.c b/blockdev.c index 7c83baa353..e5d450f0bb 100644 --- a/blockdev.c +++ b/blockdev.c @@ -527,6 +527,8 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi) if_name[type], 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; |