qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jamie Lokier <jamie@shareable.org>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Christoph Hellwig <hch@lst.de>,
	qemu-devel <qemu-devel@nongnu.org>, Avi Kivity <avi@redhat.com>
Subject: Re: [Qemu-devel] Regression opening read-only cdroms
Date: Tue, 16 Jun 2009 18:46:53 +0100	[thread overview]
Message-ID: <20090616174653.GA11893@shareable.org> (raw)
In-Reply-To: <4A37D30D.40003@eu.citrix.com>

Stefano Stabellini wrote:
> Anthony Liguori wrote:
> 
> > Jamie Lokier wrote:
> >>> Indeed.
> >>> I have a patch that adds bdrv_set_read_only that set bs->read_only = 1
> >>> so that bdrv_open2 can check if the flag is set and act accordingly.
> >>> The problem is that in xen we read whether the device should be opened
> >>> read only in the VM config file, I don't think the user can specify to
> >>> open a drive read-only in qemu.
> >>>     
> >> What's missing is a "ro" sub-option to "-drive".
> >>   
> > 
> > It only is useful if we can expose that read-only attribute to the 
> > guest.  You can't do that consistently with all block devices so the 
> > result would be that you'll fail write operations causing a guest to crash.

You should get disk write errors, rather than a simple crash.  Any
decent operating system will spew a lot of printks, which is a clue.

> > This is not friendly to a user who expects that ro would Just Work.

I don't agree that it's not friendly, because I think it's quite
obvious what behaviour to expect.  Users who don't know what a
read-only disk would do can use virt-manager and that can warn them
when they try to tick the option, or equally likely hide the option so
they can never find it :-)

We already have a user interface for it: chmod.  That's less friendly,
but it's the same result.

Users who expect things to just work will be even more surprised that
"-hda image" where image is read-only does not give any error from
QEMU, but their guest crashes.  Or that "-hda image" works as usual,
and their guest crashes, and eventually they discover it's because
their disk image is not writable, and it's always worked before
because they were using -snapshot or something like that, and QEMU
didn't warn them it would be a problem...

> Well, it could Just Work for cdrom.

It would Just Work for several media types (cdrom, floppy), and
for hard disks on certain interfaces (virtio, SCSI, USB).

Yes, virtio, SCSI and USB have read-only storage flags.

It is also appropriate for disks that you intent to always mount
read-only in the guest anyway, even if the interface doesn't have a
flag, just to protect the image from aberrant guest behaviour.

-- Jamie

  reply	other threads:[~2009-06-16 17:47 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-16 12:00 [Qemu-devel] Regression opening read-only cdroms Avi Kivity
2009-06-16 14:33 ` Jamie Lokier
2009-06-16 14:54   ` Stefano Stabellini
2009-06-16 14:54     ` Jamie Lokier
2009-06-16 16:28       ` Anthony Liguori
2009-06-16 17:14         ` Stefano Stabellini
2009-06-16 17:46           ` Jamie Lokier [this message]
2009-06-16 17:54             ` Avi Kivity
2009-06-16 18:56               ` Jamie Lokier
2009-06-16 19:02                 ` Jamie Lokier
2009-06-16 21:11         ` Gerd Hoffmann
2009-06-17  6:27           ` Avi Kivity
2009-06-16 15:16   ` Avi Kivity
2009-06-16 15:54     ` Jamie Lokier
2009-06-16 16:17       ` Avi Kivity
2009-06-16 17:51         ` Jamie Lokier
2009-06-16 17:58           ` Avi Kivity
2009-06-18 12:37   ` Richard W.M. Jones
2009-06-24 20:23     ` Jamie Lokier
2009-06-24 22:43       ` Richard W.M. Jones
2009-06-25  0:50         ` Jamie Lokier
2009-06-25  8:17           ` Richard W.M. Jones
2009-06-16 16:28 ` Blue Swirl
2009-06-16 18:37   ` Blue Swirl
2009-06-16 21:16     ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090616174653.GA11893@shareable.org \
    --to=jamie@shareable.org \
    --cc=avi@redhat.com \
    --cc=hch@lst.de \
    --cc=qemu-devel@nongnu.org \
    --cc=stefano.stabellini@eu.citrix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).