diff options
author | Max Reitz <mreitz@redhat.com> | 2015-11-11 04:49:44 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2015-11-11 16:23:34 +0100 |
commit | 39ff43d9e1f42b1d829a955e546cddab87ac0626 (patch) | |
tree | 40a4f937d8fe47ab085bf7950253c348a941e3d2 /qmp-commands.hx | |
parent | 1068674927a08cb9f535946abe2f91529b13160c (diff) | |
download | qemu-39ff43d9e1f42b1d829a955e546cddab87ac0626.zip qemu-39ff43d9e1f42b1d829a955e546cddab87ac0626.tar.gz qemu-39ff43d9e1f42b1d829a955e546cddab87ac0626.tar.bz2 |
blockdev: read-only-mode for blockdev-change-medium
Add an option to qmp_blockdev_change_medium() which allows changing the
read-only status of the block device whose medium is changed.
Some drives do not have a inherently fixed read-only status; for
instance, floppy disks can be set read-only or writable independently of
the drive. Some users may find it useful to be able to therefore change
the read-only status of a block device when changing the medium.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'qmp-commands.hx')
-rw-r--r-- | qmp-commands.hx | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/qmp-commands.hx b/qmp-commands.hx index f6d9c25..39d6e25 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -4183,7 +4183,7 @@ EQMP { .name = "blockdev-change-medium", - .args_type = "device:B,filename:F,format:s?", + .args_type = "device:B,filename:F,format:s?,read-only-mode:s?", .mhandler.cmd_new = qmp_marshal_blockdev_change_medium, }, @@ -4199,6 +4199,8 @@ Arguments: - "device": device name (json-string) - "filename": filename of the new image (json-string) - "format": format of the new image (json-string, optional) +- "read-only-mode": new read-only mode (json-string, optional) + - Possible values: "retain" (default), "read-only", "read-write" Examples: @@ -4210,6 +4212,26 @@ Examples: "format": "raw" } } <- { "return": {} } +2. Load a read-only medium into a writable drive + +-> { "execute": "blockdev-change-medium", + "arguments": { "device": "isa-fd0", + "filename": "/srv/images/ro.img", + "format": "raw", + "read-only-mode": "retain" } } + +<- { "error": + { "class": "GenericError", + "desc": "Could not open '/srv/images/ro.img': Permission denied" } } + +-> { "execute": "blockdev-change-medium", + "arguments": { "device": "isa-fd0", + "filename": "/srv/images/ro.img", + "format": "raw", + "read-only-mode": "read-only" } } + +<- { "return": {} } + EQMP { |