summaryrefslogtreecommitdiffstats
path: root/storage-daemon
Commit message (Collapse)AuthorAgeFilesLines
* storage-daemon: Add missing build dependency to the vhost-user-blk-testThomas Huth2021-08-111-4/+4
| | | | | | | | | | vhost-user-blk-test needs the qemu-storage-daemon, otherwise it currently hangs. So make sure that we build the daemon before running the tests. Message-Id: <20210811094705.131314-1-thuth@redhat.com> Tested-by: Alexander Bulekov <alxndr@bu.edu> Signed-off-by: Thomas Huth <thuth@redhat.com>
* qsd: Document FUSE exportsMax Reitz2021-03-291-0/+4
| | | | | | | | | | | Implementing FUSE exports required no changes to the storage daemon, so we forgot to document them there. Considering that both NBD and vhost-user-blk exports are documented in its man page (and NBD exports in its --help text), we should probably do the same for FUSE. Signed-off-by: Max Reitz <mreitz@redhat.com> Message-Id: <20210217115844.62661-1-mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* monitor: Drop query-qmp-schema 'gen': false hackMarkus Armbruster2021-03-191-2/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | | | QMP commands return their response as a generated QAPI type, which the monitor core converts to JSON via QObject. query-qmp-schema's response is the generated introspection data. This is a QLitObject since commit 7d0f982bfb "qapi: generate a literal qobject for introspection", v2.12). Before, it was a string. Instead of converting QLitObject / string -> QObject -> QAPI type SchemaInfoList -> QObject -> JSON, we take a shortcut: the command is 'gen': false, so it can return the QObject instead of the QAPI type. Slightly simpler and more efficient. The next commit will filter the response for output policy, and this is easier in the SchemaInfoList representation. Drop the shortcut. This replaces the manual command registration by a generated one. The manual registration makes the command available before the machine is built by passing flag QCO_ALLOW_PRECONFIG. To keep it available there, we need need to add 'allow-preconfig': true to its definition in the schema. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20210318155519.1224118-7-armbru@redhat.com>
* qom: Factor out user_creatable_process_cmdline()Kevin Wolf2021-03-191-22/+2Star
| | | | | | | | | | | | | | | | | The implementation for --object can be shared between qemu-storage-daemon and other binaries, so move it into a function in qom/object_interfaces.c that is accessible from everywhere. This also requires moving the implementation of qmp_object_add() into a new user_creatable_add_qapi(), because qom/qom-qmp-cmds.c is not linked for tools. user_creatable_print_help_from_qdict() can become static now. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* qemu-storage-daemon: Implement --object with qmp_object_add()Kevin Wolf2021-03-191-11/+10Star
| | | | | | | | | | This QAPIfies --object and ensures that QMP and the command line option behave the same. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* qapi/qom: QAPIfy object-addKevin Wolf2021-03-191-2/+0Star
| | | | | | | | | | | | | | | | | | | This converts object-add from 'gen': false to the ObjectOptions QAPI type. As an immediate benefit, clients can now use QAPI schema introspection for user creatable QOM objects. It is also the first step towards making the QAPI schema the only external interface for the creation of user creatable objects. Once all other places (HMP and command lines of the system emulator and all tools) go through QAPI, too, some object implementations can be simplified because some checks (e.g. that mandatory options are set) are already performed by QAPI, and in another step, QOM boilerplate code could be generated from the schema. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* qapi/qom: Add ObjectOptions for authz-*Kevin Wolf2021-03-191-0/+1
| | | | | | | | | | This adds a QAPI schema for the properties of the authz-* objects. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Peter Krempa <pkrempa@redhat.com> Acked-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* storage-daemon: Call job_cancel_sync_all() on shutdownKevin Wolf2021-03-191-0/+1
| | | | | | | | | | | | bdrv_close_all() asserts that no jobs are running any more, so we need to cancel all jobs first to avoid failing the assertion. Fixes: b55a3c8860b763b62b2cc2f4a6f55379977bbde5 Reported-by: Nini Gu <ngu@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20210309121814.31078-1-kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* qemu-storage-daemon: add --pidfile optionStefan Hajnoczi2021-03-081-0/+36
| | | | | | | | | | | | | | | | | Daemons often have a --pidfile option where the pid is written to a file so that scripts can stop the daemon by sending a signal. The pid file also acts as a lock to prevent multiple instances of the daemon from launching for a given pid file. QEMU, qemu-nbd, qemu-ga, virtiofsd, and qemu-pr-helper all support the --pidfile option. Add it to qemu-storage-daemon too. Reported-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20210302142746.170535-1-stefanha@redhat.com> Reviewed-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* storage-daemon: include current command line option in the errorsPaolo Bonzini2021-03-081-2/+17
| | | | | | | | | | | | | | | | | | | | Use the location management facilities that the emulator uses, so that the current command line option appears in the error message. Before: $ storage-daemon/qemu-storage-daemon --nbd key..= qemu-storage-daemon: Invalid parameter 'key..' After: $ storage-daemon/qemu-storage-daemon --nbd key..= qemu-storage-daemon: --nbd key..=: Invalid parameter 'key..' Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20210301152844.291799-3-pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* storage-daemon: report unexpected arguments on the flyPaolo Bonzini2021-03-081-5/+4Star
| | | | | | | | | | | | If the first character of optstring is '-', then each nonoption argv element is handled as if it were the argument of an option with character code 1. This removes the reordering of the argv array, and enables usage of loc_set_cmdline to provide better error messages. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20210301152844.291799-2-pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* qemu-storage-daemon: Enable object-addKevin Wolf2021-02-151-0/+2
| | | | | | | | | | | | As we don't have a fully QAPIfied version of object-add yet and it still has 'gen': false in the schema, it needs to be registered explicitly in init_qmp_commands() to be available for users. Fixes: 2af282ec51a27116d0402cab237b8970800f870c Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20210204072137.19663-1-kwolf@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* block: move blk_exp_close_all() to qemu_cleanup()Sergio Lopez2021-02-021-0/+1
| | | | | | | | | | | | | | Move blk_exp_close_all() from bdrv_close() to qemu_cleanup(), before bdrv_drain_all_begin(). Export drivers may have coroutines yielding at some point in the block layer, so we need to shut them down before draining the block layer, as otherwise they may get stuck blk_wait_while_drained(). RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1900505 Signed-off-by: Sergio Lopez <slp@redhat.com> Message-Id: <20210201125032.44713-3-slp@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* meson: Propagate gnutls dependencyRoman Bolshakov2021-01-121-1/+1
| | | | | | | | | | | | crypto/tlscreds.h includes GnuTLS headers if CONFIG_GNUTLS is set, but GNUTLS_CFLAGS, that describe include path, are not propagated transitively to all users of crypto and build fails if GnuTLS headers reside in non-standard directory (which is a case for homebrew on Apple Silicon). Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com> Message-Id: <20210102125213.41279-1-r.bolshakov@yadro.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* docs: generate qemu-storage-daemon-qmp-ref(7) man pageStefan Hajnoczi2020-12-181-0/+3
| | | | | | | | | | | | | | | Although individual qemu-storage-daemon QMP commands are identical to QEMU QMP commands, qemu-storage-daemon only supports a subset of QEMU's QMP commands. Generate a manual page of just the commands supported by qemu-storage-daemon so that users know exactly what is available in qemu-storage-daemon. Add an h1 heading in storage-daemon/qapi/qapi-schema.json so that block-core.json is at the h2 heading level. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20201209103802.350848-2-stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* storage-daemon: Call bdrv_close_all() on exitMax Reitz2020-12-111-0/+3
| | | | | | | | | | | Otherwise, exports and block devices are not properly shut down and closed, unless the users explicitly issues blockdev-del and block-export-del commands for each of them. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20201027190600.192171-17-mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* trace: remove argument from trace_init_filePaolo Bonzini2020-11-111-6/+3Star
| | | | | | | | | | It is not needed, all the callers are just saving what was retrieved from -trace and trace_init_file can retrieve it on its own. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 20201102115841.4017692-1-pbonzini@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qemu-storage-daemon: avoid compiling blockdev_ss twiceStefan Hajnoczi2020-10-231-2/+1Star
| | | | | | | | | | Introduce libblkdev.fa to avoid recompiling blockdev_ss twice. Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20200929125516.186715-3-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qemu-storage-daemon: Remove QemuOpts from --object parserKevin Wolf2020-10-151-11/+4Star
| | | | | | | | | | | | | | | The command line parser for --object parses the input twice: Once into QemuOpts just for detecting help options, and then again into a QDict using the keyval parser for actually creating the object. Now that the keyval parser can also detect help options, we can simplify this and remove the QemuOpts part. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201007164903.282198-5-kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* keyval: Parse help optionsKevin Wolf2020-10-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a special meaning for 'help' and '?' as options to the keyval parser. Instead of being an error (because of a missing value) or a value for an implied key, they now request help, which is a new boolean output of the parser in addition to the QDict. A new parameter 'p_help' is added to keyval_parse() that contains on return whether help was requested. If NULL is passed, requesting help results in an error and all other cases work like before. Turning previous error cases into help is a compatible extension. The behaviour potentially changes for implied keys: They could previously get 'help' as their value, which is now interpreted as requesting help. This is not a problem in practice because 'help' and '?' are not a valid values for the implied key of any option parsed with keyval_parse(): * audiodev: union Audiodev, implied key "driver" is enum AudiodevDriver, "help" and "?" are not among its values * display: union DisplayOptions, implied key "type" is enum DisplayType, "help" and "?" are not among its values * blockdev: union BlockdevOptions, implied key "driver is enum BlockdevDriver, "help" and "?" are not among its values * export: union BlockExport, implied key "type" is enum BlockExportType, "help" and "?" are not among its values * monitor: struct MonitorOptions, implied key "mode" is enum MonitorMode, "help" and "?" are not among its values * nbd-server: struct NbdServerOptions, no implied key. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201011073505.1185335-5-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* qemu-storage-daemon: Fix help line for --exportKevin Wolf2020-10-021-1/+1
| | | | | | | | | | | Commit 5f479a8d renamed the 'device' option of --export into 'node-name', but forgot to update the help in qemu-storage-daemon. Fixes: 5f479a8dc086bfa42c9f94e9ab69962f256e207f Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20200930133909.58820-1-kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* block/export: Add 'id' option to block-export-addKevin Wolf2020-10-021-1/+1
| | | | | | | | | | | | | | | | | | We'll need an id to identify block exports in monitor commands. This adds one. Note that this is different from the 'name' option in the NBD server, which is the externally visible export name. While block export ids need to be unique in the whole process, export names must be unique only for the same server. Different export types or (potentially in the future) multiple NBD servers can have the same export name externally, but still need different block export ids internally. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Message-Id: <20200924152717.287415-19-kwolf@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* nbd: Add max-connections to nbd-server-startKevin Wolf2020-10-021-2/+2
| | | | | | | | | | | | This is a QMP equivalent of qemu-nbd's --shared option, limiting the maximum number of clients that can attach at the same time. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20200924152717.287415-9-kwolf@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* qemu-storage-daemon: Use qmp_block_export_add()Kevin Wolf2020-10-021-12/+1Star
| | | | | | | | | | | | No reason to duplicate the functionality locally, we can now just reuse the QMP command block-export-add for --export. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20200924152717.287415-6-kwolf@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* qapi: Rename BlockExport to BlockExportOptionsKevin Wolf2020-10-021-4/+4
| | | | | | | | | | | | The name BlockExport will be used for the struct containing the runtime state of block exports, so change the name of export creation options. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20200924152717.287415-4-kwolf@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* qapi: Create block-export moduleKevin Wolf2020-10-022-1/+2
| | | | | | | | | | | | Move all block export related types and commands from block-core to the new QAPI module block-export. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20200924152717.287415-3-kwolf@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* docs/interop: Convert qemu-qmp-ref to rSTPeter Maydell2020-09-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Convert qemu-qmp-ref to rST format. This includes dropping the plain-text, pdf and info format outputs for this document; as with all our other Sphinx-based documentation, we provide HTML and manpage only. The qemu-qmp-ref.rst is somewhat more stripped down than the .texi was, because we do not (currently) attempt to generate indexes for the commands, events and data types being documented. Again, we drop the direct link from index.html.in now that the QMP ref is part of the interop manual. This commit removes the code from the root meson.build file that handled the various Texinfo-based outputs, because we no longer generate any documentation except for the Sphinx HTML manuals and the manpages, and the code can't handle having an empty list of files to process.. We'll do further cleanup of the remainders of Texinfo support in subsequent commits. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20200925162316.21205-10-peter.maydell@linaro.org> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Unicode legacy literal dumbed down to plain string literal, TODO comment on displaying QEMU version added, "make html" fixed, storage-daemon/qapi/meson.build updated] Signed-off-by: Markus Armbruster <armbru@redhat.com>
* meson: convert qemu-storage-daemonPaolo Bonzini2020-08-214-7/+357
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* libqemuutil, qapi, trace: convert to mesonPaolo Bonzini2020-08-214-2/+14
| | | | | | | | | | | | | | | This shows how to do some "computations" in meson.build using its array and dictionary data structures, and also a basic usage of the sourceset module for conditional compilation. Notice the new "if have_system" part of util/meson.build, which fixes a bug in the old build system was buggy: util/dbus.c was built even for non-softmmu builds, but the dependency on -lgio was lost when the linking was done through libqemuutil.a. Because all of its users required gio otherwise, the bug was hidden. Meson instead propagates libqemuutil's dependencies down to its users, and shows the problem. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* schemas: Add vim modelineAndrea Bolognani2020-08-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | The various schemas included in QEMU use a JSON-based format which is, however, strictly speaking not valid JSON. As a consequence, when vim tries to apply syntax highlight rules for JSON (as guessed from the file name), the result is an unreadable mess which mostly consist of red markers pointing out supposed errors in, well, pretty much everything. Using Python syntax highlighting produces much better results, and in fact these files already start with specially-formatted comments that instruct Emacs to process them as if they were Python files. This commit adds the equivalent special comments for vim. Signed-off-by: Andrea Bolognani <abologna@redhat.com> Message-Id: <20200729185024.121766-1-abologna@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
* qemu-storage-daemon: Add --monitor optionKevin Wolf2020-03-063-0/+28
This adds and parses the --monitor option, so that a QMP monitor can be used in the storage daemon. The monitor offers commands defined in the QAPI schema at storage-daemon/qapi/qapi-schema.json. The --monitor options currently allows to create multiple monitors with the same ID. This part of the interface is considered unstable. We will reject such configurations as soon as we have a design for the monitor subsystem to perform these checks. (In the system emulator, we depend on QemuOpts rejecting duplicate IDs.) Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20200224143008.13362-21-kwolf@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>