All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Max Reitz <mreitz@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
	Luiz Capitulino <lcapitulino@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 0/4] blockdev: Add blockdev-change-medium with read-only option
Date: Fri, 05 Dec 2014 14:31:15 +0100	[thread overview]
Message-ID: <874mtaw7do.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: <1417774136-30001-1-git-send-email-mreitz@redhat.com> (Max Reitz's message of "Fri, 5 Dec 2014 11:08:52 +0100")

Max Reitz <mreitz@redhat.com> writes:

> The 'change' QMP and HMP command allows replacing the medium in drives
> which support this, e.g. floppy disk drives. For some drives, the medium
> carries information about whether it can be written to or not (again,
> floppy drives). Therefore, it should be possible to change the read-only
> state of block devices when changing the loaded medium.
>
> Following a suggestion from Eric, this series first introduces a
> 'blockdev-change-medium' QMP command which is intended to replace the
> 'change' command for block devices. Then, an optional additional
> 'read-only' parameter is added which allows chaning the read-only state
> in three ways:
>
> - 'retain': Just keep the status as it was before; this is the current
>   behavior and thus this will be the default.
> - 'ro': Force read-only access
> - 'rw': Force writable access
>
> Finally, that 'read-only' parameter is added to the HMP 'change'
> command. This series does not add a 'blockdev-change-medium' QMP command
> because 'change' being overloaded for VNC and block devices is not too
> bad for HMP (while it is for QMP).

Debatable, but let's hash out QMP before we worry about HMP.

I'd like to make sure that new commands to control removable media get
us closer to a sane set of such commands.  Let's consider states and
transitions.

If we ignore the tray lock for a moment, we have:

                                    load
                    tray open  --------------->  tray closed
                      empty    <---------------    empty
                      ^   |        eject          
                      |   |
        remove medium |   | insert medium
                      |   |
                      |   v        load
                    tray open  --------------->  tray closed
                       full    <---------------    full
                                    eject

Both the operator and the guest OS can load / eject.

Only the operator can remove / insert medium.

A tray lock complicates things a bit.  Each state above splits into a
locked and unlocked state, with the obvious lock / unlock state
transitions.  Only the guest OS can lock / unlock.

When the tray is locked and closed, operator eject merely notifies the
guest OS (blk_dev_eject_request(blk, false)).

In states tray closed / locked, there's an additional operation "eject
forcefully".  It notifies the guest OS (blk_dev_eject_request(blk,
true)), and opens the tray.  Whether unlocks it depends on the device.

Like change, blockdev-change-medium conflates several basic operations.
Is that what we want, or should we create something that lets us do
basic operations?

  parent reply	other threads:[~2014-12-05 13:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-05 10:08 [Qemu-devel] [PATCH v2 0/4] blockdev: Add blockdev-change-medium with read-only option Max Reitz
2014-12-05 10:08 ` [Qemu-devel] [PATCH v2 1/4] qmp: Introduce blockdev-change-medium Max Reitz
2014-12-05 13:10   ` Eric Blake
2014-12-05 13:18     ` Max Reitz
2014-12-05 13:25       ` Eric Blake
2014-12-05 10:08 ` [Qemu-devel] [PATCH v2 2/4] hmp: Use blockdev-change-medium for change command Max Reitz
2014-12-05 13:24   ` Eric Blake
2014-12-05 13:27     ` Max Reitz
2014-12-05 13:45       ` Eric Blake
2014-12-05 10:08 ` [Qemu-devel] [PATCH v2 3/4] blockdev: Add read-only option to blockdev-change-medium Max Reitz
2014-12-05 13:28   ` Eric Blake
2014-12-05 10:08 ` [Qemu-devel] [PATCH v2 4/4] hmp: Add read-only option to change command Max Reitz
2014-12-05 13:49   ` Eric Blake
2014-12-05 13:14 ` [Qemu-devel] [PATCH v2 0/4] blockdev: Add blockdev-change-medium with read-only option Eric Blake
2014-12-05 13:25   ` Max Reitz
2014-12-05 13:31 ` Markus Armbruster [this message]
2014-12-05 13:47   ` Max Reitz
2014-12-05 14:07     ` Eric Blake
2014-12-05 14:21       ` Max Reitz

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=874mtaw7do.fsf@blackfin.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.