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>
This commit is contained in:
Max Reitz authored and Kevin Wolf committed 2015-11-11 16:23:34 +01:00
1 parent 1068674927
commit 39ff43d9e1
6 files changed
+72 -4

No files matched your search

+23 -1
View File
@@ -1958,6 +1958,24 @@
'node-name': 'str'} }
##
# @BlockdevChangeReadOnlyMode:
#
# Specifies the new read-only mode of a block device subject to the
# @blockdev-change-medium command.
#
# @retain: Retains the current read-only mode
#
# @read-only: Makes the device read-only
#
# @read-write: Makes the device writable
#
# Since: 2.3
##
{ 'enum': 'BlockdevChangeReadOnlyMode',
'data': ['retain', 'read-only', 'read-write'] }
##
# @blockdev-change-medium:
#
@@ -1973,12 +1991,16 @@
# @format: #optional, format to open the new image with (defaults to
# the probed format)
#
# @read-only-mode: #optional, change the read-only mode of the device; defaults
# to 'retain'
#
# Since: 2.5
##
{ 'command': 'blockdev-change-medium',
'data': { 'device': 'str',
'filename': 'str',
'*format': 'str' } }
'*format': 'str',
'*read-only-mode': 'BlockdevChangeReadOnlyMode' } }
##