diff options
author | Maxim Levitsky <mlevitsk@redhat.com> | 2020-03-08 11:24:40 +0200 |
---|---|---|
committer | Dr. David Alan Gilbert <dgilbert@redhat.com> | 2020-03-09 18:20:22 +0000 |
commit | 89802d5ae72817fdbaeab6d0b5b3af4765f75d4d (patch) | |
tree | 164a29c49c484fa834002085e2efc2256cc27ef9 /block/monitor | |
parent | 2bcad73c4b9b26005afa28d91c3c814083a3c741 (diff) |
monitor/hmp: Move hmp_drive_add_node to block-hmp-cmds.c
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20200308092440.23564-12-mlevitsk@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'block/monitor')
-rw-r--r-- | block/monitor/block-hmp-cmds.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c index aebf1dce0d..c3a6368dfc 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -56,6 +56,36 @@ #include "block/block-hmp-cmds.h" #include "qemu-io.h" +static void hmp_drive_add_node(Monitor *mon, const char *optstr) +{ + QemuOpts *opts; + QDict *qdict; + Error *local_err = NULL; + + opts = qemu_opts_parse_noisily(&qemu_drive_opts, optstr, false); + if (!opts) { + return; + } + + qdict = qemu_opts_to_qdict(opts, NULL); + + if (!qdict_get_try_str(qdict, "node-name")) { + qobject_unref(qdict); + error_report("'node-name' needs to be specified"); + goto out; + } + + BlockDriverState *bs = bds_tree_init(qdict, &local_err); + if (!bs) { + error_report_err(local_err); + goto out; + } + + bdrv_set_monitor_owned(bs); +out: + qemu_opts_del(opts); +} + void hmp_drive_add(Monitor *mon, const QDict *qdict) { Error *err = NULL; |