On 02/27/2017 05:20 AM, Markus Armbruster wrote: > The new command line option -blockdev works like QMP command > blockdev-add. > > The option argument may be given in JSON syntax, exactly as in QMP. > Example usage: > > -blockdev '{"node-name": "foo", "driver": "raw", "file": {"driver": > "file", "filename": "foo.img"} }' > > The JSON argument doesn't exactly blend into the existing option > syntax, so the traditional KEY=VALUE,... syntax is also supported, > using dotted keys to do the nesting: > > -blockdev node-name=foo,driver=raw,file.driver=file,file.filename=foo.img > > This does not yet support lists or downstream extensions, i.e. keys > with __RFQDN_ prefix, but the next few patches will take care of that. > > Note that calling qmp_blockdev_add() (say via qmp_marshal_block_add()) > right away would crash. We need to stash the configuration for later > instead. This is crudely done, and bypasses QemuOpts, even though > storing configuration is what QemuOpts is for. Need to revamp option > infrastructure to support QAPI types like BlockdevOptions. > > Signed-off-by: Markus Armbruster <arm...@redhat.com> > --- > qemu-options.hx | 7 +++++++ > vl.c | 39 +++++++++++++++++++++++++++++++++++++++ > 2 files changed, 46 insertions(+) > > diff --git a/qemu-options.hx b/qemu-options.hx > index bf458f8..8f02264 100644 > --- a/qemu-options.hx > +++ b/qemu-options.hx > @@ -532,6 +532,13 @@ Use @var{file} as CD-ROM image (you cannot use > @option{-hdc} and > using @file{/dev/cdrom} as filename (@pxref{host_drives}). > ETEXI > > +DEF("blockdev", HAS_ARG, QEMU_OPTION_blockdev, > + "-blockdev driver[,node-name=N][,discard=ignore|unmap]\n"
Maybe "-blockdev [driver=]DRIVER[,node-name"..... to call out that you use driver as an implied key? But I'm also fine with what you wrote (it's sufficient enough for a human reading it, and the help output is not scraped by libvirt). > + " [,cache.direct=on|off][,cache.no-flush=on|off]\n" > + " [,read-only=on|off][,detect-zeroes=on|off|unmap]\n" > + " [,driver specific parameters...]\n" > + " configure a block backend\n", QEMU_ARCH_ALL) > + > DEF("drive", HAS_ARG, QEMU_OPTION_drive, > "-drive [file=file][,if=type][,bus=n][,unit=m][,media=d][,index=i]\n" > " [,cyls=c,heads=h,secs=s[,trans=t]][,snapshot=on|off]\n" Reviewed-by: Eric Blake <ebl...@redhat.com> -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature