On 12/05/2014 03:08 AM, Max Reitz wrote: > Introduce a new QMP command 'blockdev-change-medium' which is intended > to replace the 'change' command for block devices. The existing function > qmp_change_blockdev() is accordingly renamed to > qmp_blockdev_change_medium(). > > Signed-off-by: Max Reitz <mre...@redhat.com> > --- > blockdev.c | 7 ++++--- > include/sysemu/blockdev.h | 2 -- > qapi/block-core.json | 21 +++++++++++++++++++++ > qmp-commands.hx | 31 +++++++++++++++++++++++++++++++ > qmp.c | 2 +- > 5 files changed, 57 insertions(+), 6 deletions(-)
I like it! > > ## > +# @blockdev-change-medium: > +# > +# Changes the medium inserted into a block device by ejecting the current > medium > +# and loading a new image file which is inserted as the new medium. > +# > +# @device: block device name > +# > +# @filename: filename of the new image to be loaded > +# > +# @format: #optional, format to open the new image with (defaults to the > +# probed format) > +# > +# Since: 2.3 > +## > +{ 'command': 'blockdev-change-medium', > + 'data': { 'device': 'str', > + 'filename': 'str', > + '*format': 'str' } } Someday, we should quit open-coding format as 'str' and instead make it an enum; but that is a separate patch series, and can get this location as part of that series. Should there be a way to empty a cdrom drive? That is, how do I change a drive from visiting a file to being empty? Does passing the empty string for mandatory 'filename' do that, or should we be strict and state that filename is optional (omit to empty the drive) and that an empty string as filename is forbidden? Please also improve the documentation in qapi-schema.json to have the 'change' command mention that it is kept for backwards compatibility, but that it is no longer the preferred command and point users to 'blockdev-change-medium'. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature