mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/dgilbert/tags/pull-hmp-20200309' into staging
HMP Pull 2020-03-09 Maxim's hmp block move, Thomas's deprecation in hostfwd. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> # gpg: Signature made Mon 09 Mar 2020 19:43:33 GMT # gpg: using RSA key 45F5C71B4A0CB7FB977A9FA90516331EBC5BFDE7 # gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>" [full] # Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A 9FA9 0516 331E BC5B FDE7 * remotes/dgilbert/tags/pull-hmp-20200309: net: Remove deprecated [hub_id name] tuple of 'hostfwd_add' / 'hostfwd_remove' monitor/hmp: Move hmp_drive_add_node to block-hmp-cmds.c monitor/hmp: move hmp_info_block* to block-hmp-cmds.c monitor/hmp: move remaining hmp_block* functions to block-hmp-cmds.c monitor/hmp: move hmp_nbd_server* to block-hmp-cmds.c monitor/hmp: move hmp_snapshot_* to block-hmp-cmds.c monitor/hmp: move hmp_block_job* to block-hmp-cmds.c monitor/hmp: move hmp_drive_mirror and hmp_drive_backup to block-hmp-cmds.c monitor/hmp: move hmp_drive_del and hmp_commit to block-hmp-cmds.c monitor/hmp: rename device-hotplug.c to block/monitor/block-hmp-cmds.c monitor/hmp: inline add_init_drive usb/dev-storage: remove unused include Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -1920,6 +1920,7 @@ Block QAPI, monitor, command line
|
||||
M: Markus Armbruster <armbru@redhat.com>
|
||||
S: Supported
|
||||
F: blockdev.c
|
||||
F: blockdev-hmp-cmds.c
|
||||
F: block/qapi.c
|
||||
F: qapi/block*.json
|
||||
F: qapi/transaction.json
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ common-obj-y += dump/
|
||||
common-obj-y += job-qmp.o
|
||||
common-obj-y += monitor/
|
||||
common-obj-y += net/
|
||||
common-obj-y += qdev-monitor.o device-hotplug.o
|
||||
common-obj-y += qdev-monitor.o
|
||||
common-obj-$(CONFIG_WIN32) += os-win32.o
|
||||
common-obj-$(CONFIG_POSIX) += os-posix.o
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ block-obj-y += crypto.o
|
||||
block-obj-y += aio_task.o
|
||||
block-obj-y += backup-top.o
|
||||
block-obj-y += filter-compress.o
|
||||
common-obj-y += monitor/
|
||||
|
||||
block-obj-y += stream.o
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
common-obj-y += block-hmp-cmds.o
|
||||
File diff suppressed because it is too large
Load Diff
+8
-129
@@ -64,9 +64,14 @@
|
||||
#include "qemu/main-loop.h"
|
||||
#include "qemu/throttle-options.h"
|
||||
|
||||
static QTAILQ_HEAD(, BlockDriverState) monitor_bdrv_states =
|
||||
QTAILQ_HEAD(, BlockDriverState) monitor_bdrv_states =
|
||||
QTAILQ_HEAD_INITIALIZER(monitor_bdrv_states);
|
||||
|
||||
void bdrv_set_monitor_owned(BlockDriverState *bs)
|
||||
{
|
||||
QTAILQ_INSERT_TAIL(&monitor_bdrv_states, bs, monitor_list);
|
||||
}
|
||||
|
||||
static const char *const if_name[IF_COUNT] = {
|
||||
[IF_NONE] = "none",
|
||||
[IF_IDE] = "ide",
|
||||
@@ -640,7 +645,7 @@ err_no_opts:
|
||||
}
|
||||
|
||||
/* Takes the ownership of bs_opts */
|
||||
static BlockDriverState *bds_tree_init(QDict *bs_opts, Error **errp)
|
||||
BlockDriverState *bds_tree_init(QDict *bs_opts, Error **errp)
|
||||
{
|
||||
int bdrv_flags = 0;
|
||||
|
||||
@@ -1039,41 +1044,6 @@ static BlockDriverState *qmp_get_root_bs(const char *name, Error **errp)
|
||||
return bs;
|
||||
}
|
||||
|
||||
void hmp_commit(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
const char *device = qdict_get_str(qdict, "device");
|
||||
BlockBackend *blk;
|
||||
int ret;
|
||||
|
||||
if (!strcmp(device, "all")) {
|
||||
ret = blk_commit_all();
|
||||
} else {
|
||||
BlockDriverState *bs;
|
||||
AioContext *aio_context;
|
||||
|
||||
blk = blk_by_name(device);
|
||||
if (!blk) {
|
||||
error_report("Device '%s' not found", device);
|
||||
return;
|
||||
}
|
||||
if (!blk_is_available(blk)) {
|
||||
error_report("Device '%s' has no medium", device);
|
||||
return;
|
||||
}
|
||||
|
||||
bs = blk_bs(blk);
|
||||
aio_context = bdrv_get_aio_context(bs);
|
||||
aio_context_acquire(aio_context);
|
||||
|
||||
ret = bdrv_commit(bs);
|
||||
|
||||
aio_context_release(aio_context);
|
||||
}
|
||||
if (ret < 0) {
|
||||
error_report("'commit' error for '%s': %s", device, strerror(-ret));
|
||||
}
|
||||
}
|
||||
|
||||
static void blockdev_do_action(TransactionAction *action, Error **errp)
|
||||
{
|
||||
TransactionActionList list;
|
||||
@@ -2747,66 +2717,6 @@ BlockDirtyBitmapSha256 *qmp_x_debug_block_dirty_bitmap_sha256(const char *node,
|
||||
return ret;
|
||||
}
|
||||
|
||||
void hmp_drive_del(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
const char *id = qdict_get_str(qdict, "id");
|
||||
BlockBackend *blk;
|
||||
BlockDriverState *bs;
|
||||
AioContext *aio_context;
|
||||
Error *local_err = NULL;
|
||||
|
||||
bs = bdrv_find_node(id);
|
||||
if (bs) {
|
||||
qmp_blockdev_del(id, &local_err);
|
||||
if (local_err) {
|
||||
error_report_err(local_err);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
blk = blk_by_name(id);
|
||||
if (!blk) {
|
||||
error_report("Device '%s' not found", id);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!blk_legacy_dinfo(blk)) {
|
||||
error_report("Deleting device added with blockdev-add"
|
||||
" is not supported");
|
||||
return;
|
||||
}
|
||||
|
||||
aio_context = blk_get_aio_context(blk);
|
||||
aio_context_acquire(aio_context);
|
||||
|
||||
bs = blk_bs(blk);
|
||||
if (bs) {
|
||||
if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_DRIVE_DEL, &local_err)) {
|
||||
error_report_err(local_err);
|
||||
aio_context_release(aio_context);
|
||||
return;
|
||||
}
|
||||
|
||||
blk_remove_bs(blk);
|
||||
}
|
||||
|
||||
/* Make the BlockBackend and the attached BlockDriverState anonymous */
|
||||
monitor_remove_blk(blk);
|
||||
|
||||
/* If this BlockBackend has a device attached to it, its refcount will be
|
||||
* decremented when the device is removed; otherwise we have to do so here.
|
||||
*/
|
||||
if (blk_get_attached_dev(blk)) {
|
||||
/* Further I/O must not pause the guest */
|
||||
blk_set_on_error(blk, BLOCKDEV_ON_ERROR_REPORT,
|
||||
BLOCKDEV_ON_ERROR_REPORT);
|
||||
} else {
|
||||
blk_unref(blk);
|
||||
}
|
||||
|
||||
aio_context_release(aio_context);
|
||||
}
|
||||
|
||||
void qmp_block_resize(bool has_device, const char *device,
|
||||
bool has_node_name, const char *node_name,
|
||||
int64_t size, Error **errp)
|
||||
@@ -3814,37 +3724,6 @@ out:
|
||||
aio_context_release(aio_context);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
QTAILQ_INSERT_TAIL(&monitor_bdrv_states, bs, monitor_list);
|
||||
|
||||
out:
|
||||
qemu_opts_del(opts);
|
||||
}
|
||||
|
||||
void qmp_blockdev_add(BlockdevOptions *options, Error **errp)
|
||||
{
|
||||
BlockDriverState *bs;
|
||||
@@ -3874,7 +3753,7 @@ void qmp_blockdev_add(BlockdevOptions *options, Error **errp)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
QTAILQ_INSERT_TAIL(&monitor_bdrv_states, bs, monitor_list);
|
||||
bdrv_set_monitor_owned(bs);
|
||||
|
||||
fail:
|
||||
visit_free(v);
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
/*
|
||||
* QEMU device hotplug helpers
|
||||
*
|
||||
* Copyright (c) 2004 Fabrice Bellard
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/boards.h"
|
||||
#include "sysemu/block-backend.h"
|
||||
#include "sysemu/blockdev.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/config-file.h"
|
||||
#include "qemu/option.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "block/block_int.h"
|
||||
|
||||
static DriveInfo *add_init_drive(const char *optstr)
|
||||
{
|
||||
Error *err = NULL;
|
||||
DriveInfo *dinfo;
|
||||
QemuOpts *opts;
|
||||
MachineClass *mc;
|
||||
|
||||
opts = drive_def(optstr);
|
||||
if (!opts)
|
||||
return NULL;
|
||||
|
||||
mc = MACHINE_GET_CLASS(current_machine);
|
||||
dinfo = drive_new(opts, mc->block_default_type, &err);
|
||||
if (err) {
|
||||
error_report_err(err);
|
||||
qemu_opts_del(opts);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return dinfo;
|
||||
}
|
||||
|
||||
void hmp_drive_add(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
DriveInfo *dinfo = NULL;
|
||||
const char *opts = qdict_get_str(qdict, "opts");
|
||||
bool node = qdict_get_try_bool(qdict, "node", false);
|
||||
|
||||
if (node) {
|
||||
hmp_drive_add_node(mon, opts);
|
||||
return;
|
||||
}
|
||||
|
||||
dinfo = add_init_drive(opts);
|
||||
if (!dinfo) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
switch (dinfo->type) {
|
||||
case IF_NONE:
|
||||
monitor_printf(mon, "OK\n");
|
||||
break;
|
||||
default:
|
||||
monitor_printf(mon, "Can't hot-add drive to type %d\n", dinfo->type);
|
||||
goto err;
|
||||
}
|
||||
return;
|
||||
|
||||
err:
|
||||
if (dinfo) {
|
||||
BlockBackend *blk = blk_by_legacy_dinfo(dinfo);
|
||||
monitor_remove_blk(blk);
|
||||
blk_unref(blk);
|
||||
}
|
||||
}
|
||||
@@ -248,12 +248,6 @@ the 'wait' field, which is only applicable to sockets in server mode
|
||||
Human Monitor Protocol (HMP) commands
|
||||
-------------------------------------
|
||||
|
||||
The ``hub_id`` parameter of ``hostfwd_add`` / ``hostfwd_remove`` (since 3.1)
|
||||
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
|
||||
The ``[hub_id name]`` parameter tuple of the 'hostfwd_add' and
|
||||
'hostfwd_remove' HMP commands has been replaced by ``netdev_id``.
|
||||
|
||||
``cpu-add`` (since 4.0)
|
||||
'''''''''''''''''''''''
|
||||
|
||||
@@ -430,6 +424,15 @@ QEMU Machine Protocol (QMP) commands
|
||||
The "autoload" parameter has been ignored since 2.12.0. All bitmaps
|
||||
are automatically loaded from qcow2 images.
|
||||
|
||||
Human Monitor Protocol (HMP) commands
|
||||
-------------------------------------
|
||||
|
||||
The ``hub_id`` parameter of ``hostfwd_add`` / ``hostfwd_remove`` (removed in 5.0)
|
||||
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
|
||||
The ``[hub_id name]`` parameter tuple of the 'hostfwd_add' and
|
||||
'hostfwd_remove' HMP commands has been replaced by ``netdev_id``.
|
||||
|
||||
Related binaries
|
||||
----------------
|
||||
|
||||
|
||||
+4
-4
@@ -1369,8 +1369,8 @@ ERST
|
||||
#ifdef CONFIG_SLIRP
|
||||
{
|
||||
.name = "hostfwd_add",
|
||||
.args_type = "arg1:s,arg2:s?,arg3:s?",
|
||||
.params = "[hub_id name]|[netdev_id] [tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport",
|
||||
.args_type = "arg1:s,arg2:s?",
|
||||
.params = "[netdev_id] [tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport",
|
||||
.help = "redirect TCP or UDP connections from host to guest (requires -net user)",
|
||||
.cmd = hmp_hostfwd_add,
|
||||
},
|
||||
@@ -1383,8 +1383,8 @@ ERST
|
||||
#ifdef CONFIG_SLIRP
|
||||
{
|
||||
.name = "hostfwd_remove",
|
||||
.args_type = "arg1:s,arg2:s?,arg3:s?",
|
||||
.params = "[hub_id name]|[netdev_id] [tcp|udp]:[hostaddr]:hostport",
|
||||
.args_type = "arg1:s,arg2:s?",
|
||||
.params = "[netdev_id] [tcp|udp]:[hostaddr]:hostport",
|
||||
.help = "remove host-to-guest TCP or UDP redirection",
|
||||
.cmd = hmp_hostfwd_remove,
|
||||
},
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "hw/scsi/scsi.h"
|
||||
#include "migration/vmstate.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "sysemu/block-backend.h"
|
||||
#include "qapi/visitor.h"
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* HMP commands related to the block layer
|
||||
*
|
||||
* Copyright (c) 2003-2008 Fabrice Bellard
|
||||
* Copyright (c) 2020 Red Hat, Inc.
|
||||
* Copyright IBM, Corp. 2011
|
||||
*
|
||||
* Authors:
|
||||
* Anthony Liguori <aliguori@us.ibm.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2. See
|
||||
* the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#ifndef BLOCK_HMP_COMMANDS_H
|
||||
#define BLOCK_HMP_COMMANDS_H
|
||||
|
||||
void hmp_drive_add(Monitor *mon, const QDict *qdict);
|
||||
|
||||
void hmp_commit(Monitor *mon, const QDict *qdict);
|
||||
void hmp_drive_del(Monitor *mon, const QDict *qdict);
|
||||
|
||||
void hmp_drive_mirror(Monitor *mon, const QDict *qdict);
|
||||
void hmp_drive_backup(Monitor *mon, const QDict *qdict);
|
||||
|
||||
void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict);
|
||||
void hmp_block_job_cancel(Monitor *mon, const QDict *qdict);
|
||||
void hmp_block_job_pause(Monitor *mon, const QDict *qdict);
|
||||
void hmp_block_job_resume(Monitor *mon, const QDict *qdict);
|
||||
void hmp_block_job_complete(Monitor *mon, const QDict *qdict);
|
||||
|
||||
void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict);
|
||||
void hmp_snapshot_blkdev_internal(Monitor *mon, const QDict *qdict);
|
||||
void hmp_snapshot_delete_blkdev_internal(Monitor *mon, const QDict *qdict);
|
||||
|
||||
void hmp_nbd_server_start(Monitor *mon, const QDict *qdict);
|
||||
void hmp_nbd_server_add(Monitor *mon, const QDict *qdict);
|
||||
void hmp_nbd_server_remove(Monitor *mon, const QDict *qdict);
|
||||
void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict);
|
||||
|
||||
void hmp_block_resize(Monitor *mon, const QDict *qdict);
|
||||
void hmp_block_stream(Monitor *mon, const QDict *qdict);
|
||||
void hmp_block_passwd(Monitor *mon, const QDict *qdict);
|
||||
void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict);
|
||||
void hmp_eject(Monitor *mon, const QDict *qdict);
|
||||
|
||||
void hmp_qemu_io(Monitor *mon, const QDict *qdict);
|
||||
|
||||
void hmp_info_block(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_blockstats(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_block_jobs(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_snapshots(Monitor *mon, const QDict *qdict);
|
||||
|
||||
#endif
|
||||
@@ -1216,8 +1216,6 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
|
||||
BlockCompletionFunc *cb, void *opaque,
|
||||
JobTxn *txn, Error **errp);
|
||||
|
||||
void hmp_drive_add_node(Monitor *mon, const char *optstr);
|
||||
|
||||
BdrvChild *bdrv_root_attach_child(BlockDriverState *child_bs,
|
||||
const char *child_name,
|
||||
const BdrvChildRole *child_role,
|
||||
@@ -1322,4 +1320,7 @@ int coroutine_fn bdrv_co_copy_range_to(BdrvChild *src, uint64_t src_offset,
|
||||
|
||||
int refresh_total_sectors(BlockDriverState *bs, int64_t hint);
|
||||
|
||||
void bdrv_set_monitor_owned(BlockDriverState *bs);
|
||||
BlockDriverState *bds_tree_init(QDict *bs_opts, Error **errp);
|
||||
|
||||
#endif /* BLOCK_INT_H */
|
||||
|
||||
@@ -30,8 +30,6 @@ void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_migrate_cache_size(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_cpus(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_block(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_blockstats(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_vnc(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_spice(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_balloon(Monitor *mon, const QDict *qdict);
|
||||
@@ -39,7 +37,6 @@ void hmp_info_irq(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_pic(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_rdma(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_pci(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_block_jobs(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_tpm(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_iothreads(Monitor *mon, const QDict *qdict);
|
||||
void hmp_quit(Monitor *mon, const QDict *qdict);
|
||||
@@ -58,18 +55,10 @@ void hmp_cont(Monitor *mon, const QDict *qdict);
|
||||
void hmp_system_wakeup(Monitor *mon, const QDict *qdict);
|
||||
void hmp_nmi(Monitor *mon, const QDict *qdict);
|
||||
void hmp_set_link(Monitor *mon, const QDict *qdict);
|
||||
void hmp_block_passwd(Monitor *mon, const QDict *qdict);
|
||||
void hmp_balloon(Monitor *mon, const QDict *qdict);
|
||||
void hmp_block_resize(Monitor *mon, const QDict *qdict);
|
||||
void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict);
|
||||
void hmp_snapshot_blkdev_internal(Monitor *mon, const QDict *qdict);
|
||||
void hmp_snapshot_delete_blkdev_internal(Monitor *mon, const QDict *qdict);
|
||||
void hmp_drive_mirror(Monitor *mon, const QDict *qdict);
|
||||
void hmp_drive_backup(Monitor *mon, const QDict *qdict);
|
||||
void hmp_loadvm(Monitor *mon, const QDict *qdict);
|
||||
void hmp_savevm(Monitor *mon, const QDict *qdict);
|
||||
void hmp_delvm(Monitor *mon, const QDict *qdict);
|
||||
void hmp_info_snapshots(Monitor *mon, const QDict *qdict);
|
||||
void hmp_migrate_cancel(Monitor *mon, const QDict *qdict);
|
||||
void hmp_migrate_continue(Monitor *mon, const QDict *qdict);
|
||||
void hmp_migrate_incoming(Monitor *mon, const QDict *qdict);
|
||||
@@ -85,15 +74,7 @@ void hmp_migrate_start_postcopy(Monitor *mon, const QDict *qdict);
|
||||
void hmp_x_colo_lost_heartbeat(Monitor *mon, const QDict *qdict);
|
||||
void hmp_set_password(Monitor *mon, const QDict *qdict);
|
||||
void hmp_expire_password(Monitor *mon, const QDict *qdict);
|
||||
void hmp_eject(Monitor *mon, const QDict *qdict);
|
||||
void hmp_change(Monitor *mon, const QDict *qdict);
|
||||
void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict);
|
||||
void hmp_block_stream(Monitor *mon, const QDict *qdict);
|
||||
void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict);
|
||||
void hmp_block_job_cancel(Monitor *mon, const QDict *qdict);
|
||||
void hmp_block_job_pause(Monitor *mon, const QDict *qdict);
|
||||
void hmp_block_job_resume(Monitor *mon, const QDict *qdict);
|
||||
void hmp_block_job_complete(Monitor *mon, const QDict *qdict);
|
||||
void hmp_migrate(Monitor *mon, const QDict *qdict);
|
||||
void hmp_device_add(Monitor *mon, const QDict *qdict);
|
||||
void hmp_device_del(Monitor *mon, const QDict *qdict);
|
||||
@@ -104,15 +85,10 @@ void hmp_getfd(Monitor *mon, const QDict *qdict);
|
||||
void hmp_closefd(Monitor *mon, const QDict *qdict);
|
||||
void hmp_sendkey(Monitor *mon, const QDict *qdict);
|
||||
void hmp_screendump(Monitor *mon, const QDict *qdict);
|
||||
void hmp_nbd_server_start(Monitor *mon, const QDict *qdict);
|
||||
void hmp_nbd_server_add(Monitor *mon, const QDict *qdict);
|
||||
void hmp_nbd_server_remove(Monitor *mon, const QDict *qdict);
|
||||
void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict);
|
||||
void hmp_chardev_add(Monitor *mon, const QDict *qdict);
|
||||
void hmp_chardev_change(Monitor *mon, const QDict *qdict);
|
||||
void hmp_chardev_remove(Monitor *mon, const QDict *qdict);
|
||||
void hmp_chardev_send_break(Monitor *mon, const QDict *qdict);
|
||||
void hmp_qemu_io(Monitor *mon, const QDict *qdict);
|
||||
void hmp_cpu_add(Monitor *mon, const QDict *qdict);
|
||||
void hmp_object_add(Monitor *mon, const QDict *qdict);
|
||||
void hmp_object_del(Monitor *mon, const QDict *qdict);
|
||||
|
||||
@@ -57,8 +57,4 @@ QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file,
|
||||
DriveInfo *drive_new(QemuOpts *arg, BlockInterfaceType block_default_type,
|
||||
Error **errp);
|
||||
|
||||
/* device-hotplug */
|
||||
|
||||
void hmp_commit(Monitor *mon, const QDict *qdict);
|
||||
void hmp_drive_del(Monitor *mon, const QDict *qdict);
|
||||
#endif
|
||||
|
||||
@@ -63,9 +63,6 @@ extern int nb_option_roms;
|
||||
extern const char *prom_envs[MAX_PROM_ENVS];
|
||||
extern unsigned int nb_prom_envs;
|
||||
|
||||
/* generic hotplug */
|
||||
void hmp_drive_add(Monitor *mon, const QDict *qdict);
|
||||
|
||||
/* pcie aer error injection */
|
||||
void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -66,6 +66,7 @@
|
||||
#include "qemu/option.h"
|
||||
#include "qemu/thread.h"
|
||||
#include "block/qapi.h"
|
||||
#include "block/block-hmp-cmds.h"
|
||||
#include "qapi/qapi-commands-char.h"
|
||||
#include "qapi/qapi-commands-control.h"
|
||||
#include "qapi/qapi-commands-migration.h"
|
||||
|
||||
@@ -193,29 +193,6 @@ NetClientState *net_hub_add_port(int hub_id, const char *name,
|
||||
return &port->nc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find a specific client on a hub
|
||||
*/
|
||||
NetClientState *net_hub_find_client_by_name(int hub_id, const char *name)
|
||||
{
|
||||
NetHub *hub;
|
||||
NetHubPort *port;
|
||||
NetClientState *peer;
|
||||
|
||||
QLIST_FOREACH(hub, &hubs, next) {
|
||||
if (hub->id == hub_id) {
|
||||
QLIST_FOREACH(port, &hub->ports, next) {
|
||||
peer = port->nc.peer;
|
||||
|
||||
if (peer && strcmp(peer->name, name) == 0) {
|
||||
return peer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find a available port on a hub; otherwise create one new port
|
||||
*/
|
||||
|
||||
@@ -15,10 +15,8 @@
|
||||
#ifndef NET_HUB_H
|
||||
#define NET_HUB_H
|
||||
|
||||
|
||||
NetClientState *net_hub_add_port(int hub_id, const char *name,
|
||||
NetClientState *hubpeer);
|
||||
NetClientState *net_hub_find_client_by_name(int hub_id, const char *name);
|
||||
void net_hub_info(Monitor *mon);
|
||||
void net_hub_check_clients(void);
|
||||
bool net_hub_flush(NetClientState *nc);
|
||||
|
||||
+12
-32
@@ -610,25 +610,13 @@ error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
static SlirpState *slirp_lookup(Monitor *mon, const char *hub_id,
|
||||
const char *name)
|
||||
static SlirpState *slirp_lookup(Monitor *mon, const char *id)
|
||||
{
|
||||
if (name) {
|
||||
NetClientState *nc;
|
||||
if (hub_id) {
|
||||
nc = net_hub_find_client_by_name(strtol(hub_id, NULL, 0), name);
|
||||
if (!nc) {
|
||||
monitor_printf(mon, "unrecognized (hub-id, stackname) pair\n");
|
||||
return NULL;
|
||||
}
|
||||
warn_report("Using 'hub-id' is deprecated, specify the netdev id "
|
||||
"directly instead");
|
||||
} else {
|
||||
nc = qemu_find_netdev(name);
|
||||
if (!nc) {
|
||||
monitor_printf(mon, "unrecognized netdev id '%s'\n", name);
|
||||
return NULL;
|
||||
}
|
||||
if (id) {
|
||||
NetClientState *nc = qemu_find_netdev(id);
|
||||
if (!nc) {
|
||||
monitor_printf(mon, "unrecognized netdev id '%s'\n", id);
|
||||
return NULL;
|
||||
}
|
||||
if (strcmp(nc->model, "user")) {
|
||||
monitor_printf(mon, "invalid device specified\n");
|
||||
@@ -655,16 +643,12 @@ void hmp_hostfwd_remove(Monitor *mon, const QDict *qdict)
|
||||
int err;
|
||||
const char *arg1 = qdict_get_str(qdict, "arg1");
|
||||
const char *arg2 = qdict_get_try_str(qdict, "arg2");
|
||||
const char *arg3 = qdict_get_try_str(qdict, "arg3");
|
||||
|
||||
if (arg3) {
|
||||
s = slirp_lookup(mon, arg1, arg2);
|
||||
src_str = arg3;
|
||||
} else if (arg2) {
|
||||
s = slirp_lookup(mon, NULL, arg1);
|
||||
if (arg2) {
|
||||
s = slirp_lookup(mon, arg1);
|
||||
src_str = arg2;
|
||||
} else {
|
||||
s = slirp_lookup(mon, NULL, NULL);
|
||||
s = slirp_lookup(mon, NULL);
|
||||
src_str = arg1;
|
||||
}
|
||||
if (!s) {
|
||||
@@ -784,16 +768,12 @@ void hmp_hostfwd_add(Monitor *mon, const QDict *qdict)
|
||||
SlirpState *s;
|
||||
const char *arg1 = qdict_get_str(qdict, "arg1");
|
||||
const char *arg2 = qdict_get_try_str(qdict, "arg2");
|
||||
const char *arg3 = qdict_get_try_str(qdict, "arg3");
|
||||
|
||||
if (arg3) {
|
||||
s = slirp_lookup(mon, arg1, arg2);
|
||||
redir_str = arg3;
|
||||
} else if (arg2) {
|
||||
s = slirp_lookup(mon, NULL, arg1);
|
||||
if (arg2) {
|
||||
s = slirp_lookup(mon, arg1);
|
||||
redir_str = arg2;
|
||||
} else {
|
||||
s = slirp_lookup(mon, NULL, NULL);
|
||||
s = slirp_lookup(mon, NULL);
|
||||
redir_str = arg1;
|
||||
}
|
||||
if (s) {
|
||||
|
||||
Reference in New Issue
Block a user