qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] blockdev: preserve readonly and snapshot states across media changes
@ 2012-09-20 23:20 Kevin Shanahan
  2012-09-21  7:11 ` Kevin Wolf
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Shanahan @ 2012-09-20 23:20 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: libvir-list, Michael Tokarev, Markus Armbruster, qemu-devel

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>
---
 blockdev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/blockdev.c b/blockdev.c
index 8669142..84f9a2e 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -526,6 +526,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;
-- 
1.7.12

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] blockdev: preserve readonly and snapshot states across media changes
  2012-09-20 23:20 [Qemu-devel] [PATCH] blockdev: preserve readonly and snapshot states across media changes Kevin Shanahan
@ 2012-09-21  7:11 ` Kevin Wolf
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Wolf @ 2012-09-21  7:11 UTC (permalink / raw)
  To: Kevin Shanahan
  Cc: libvir-list, Michael Tokarev, Markus Armbruster, qemu-devel

Am 21.09.2012 01:20, schrieb Kevin Shanahan:
> 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>

Thanks, applied to the block branch.

Kevin

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-09-21  7:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-20 23:20 [Qemu-devel] [PATCH] blockdev: preserve readonly and snapshot states across media changes Kevin Shanahan
2012-09-21  7:11 ` Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).