[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 20/30] qemu-storage-daemon: Implement --object with qmp_object
From: |
Kevin Wolf |
Subject: |
[PATCH v3 20/30] qemu-storage-daemon: Implement --object with qmp_object_add() |
Date: |
Mon, 8 Mar 2021 17:54:30 +0100 |
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: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
storage-daemon/qemu-storage-daemon.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/storage-daemon/qemu-storage-daemon.c
b/storage-daemon/qemu-storage-daemon.c
index a1bcbacf05..4ab7e73053 100644
--- a/storage-daemon/qemu-storage-daemon.c
+++ b/storage-daemon/qemu-storage-daemon.c
@@ -38,6 +38,7 @@
#include "qapi/qapi-visit-block-core.h"
#include "qapi/qapi-visit-block-export.h"
#include "qapi/qapi-visit-control.h"
+#include "qapi/qapi-visit-qom.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qstring.h"
#include "qapi/qobject-input-visitor.h"
@@ -134,15 +135,6 @@ enum {
extern QemuOptsList qemu_chardev_opts;
-static QemuOptsList qemu_object_opts = {
- .name = "object",
- .implied_opt_name = "qom-type",
- .head = QTAILQ_HEAD_INITIALIZER(qemu_object_opts.head),
- .desc = {
- { }
- },
-};
-
static void init_qmp_commands(void)
{
qmp_init_marshal(&qmp_commands);
@@ -282,14 +274,22 @@ static void process_options(int argc, char *argv[])
{
QDict *args;
bool help;
+ Visitor *v;
+ ObjectOptions *options;
args = keyval_parse(optarg, "qom-type", &help, &error_fatal);
if (help) {
user_creatable_print_help_from_qdict(args);
exit(EXIT_SUCCESS);
}
- user_creatable_add_dict(args, true, &error_fatal);
+
+ v = qobject_input_visitor_new_keyval(QOBJECT(args));
+ visit_type_ObjectOptions(v, NULL, &options, &error_fatal);
+ visit_free(v);
qobject_unref(args);
+
+ qmp_object_add(options, &error_fatal);
+ qapi_free_ObjectOptions(options);
break;
}
case OPTION_PIDFILE:
@@ -338,7 +338,6 @@ int main(int argc, char *argv[])
module_call_init(MODULE_INIT_QOM);
module_call_init(MODULE_INIT_TRACE);
- qemu_add_opts(&qemu_object_opts);
qemu_add_opts(&qemu_trace_opts);
qcrypto_init(&error_fatal);
bdrv_init();
--
2.29.2
- [PATCH v3 07/30] qapi/qom: Add ObjectOptions for rng-*, deprecate 'opened', (continued)
- [PATCH v3 07/30] qapi/qom: Add ObjectOptions for rng-*, deprecate 'opened', Kevin Wolf, 2021/03/08
- [PATCH v3 10/30] qapi/qom: Add ObjectOptions for tls-*, deprecate 'loaded', Kevin Wolf, 2021/03/08
- [PATCH v3 11/30] qapi/qom: Add ObjectOptions for can-*, Kevin Wolf, 2021/03/08
- [PATCH v3 13/30] qapi/qom: Add ObjectOptions for filter-*, Kevin Wolf, 2021/03/08
- [PATCH v3 12/30] qapi/qom: Add ObjectOptions for colo-compare, Kevin Wolf, 2021/03/08
- [PATCH v3 14/30] qapi/qom: Add ObjectOptions for pr-manager-helper, Kevin Wolf, 2021/03/08
- [PATCH v3 17/30] qapi/qom: Add ObjectOptions for x-remote-object, Kevin Wolf, 2021/03/08
- [PATCH v3 18/30] qapi/qom: QAPIfy object-add, Kevin Wolf, 2021/03/08
- [PATCH v3 19/30] qom: Make "object" QemuOptsList optional, Kevin Wolf, 2021/03/08
- [PATCH v3 20/30] qemu-storage-daemon: Implement --object with qmp_object_add(),
Kevin Wolf <=
- [PATCH v3 08/30] qapi/qom: Add ObjectOptions for throttle-group, Kevin Wolf, 2021/03/08
- [PATCH v3 21/30] qom: Remove user_creatable_add_dict(), Kevin Wolf, 2021/03/08
- [PATCH v3 23/30] qemu-io: Use user_creatable_process_cmdline() for --object, Kevin Wolf, 2021/03/08
- [PATCH v3 25/30] qom: Add user_creatable_add_from_str(), Kevin Wolf, 2021/03/08
- [PATCH v3 24/30] qemu-nbd: Use user_creatable_process_cmdline() for --object, Kevin Wolf, 2021/03/08
- [PATCH v3 27/30] hmp: QAPIfy object_add, Kevin Wolf, 2021/03/08