mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/armbru/tags/pull-monitor-2015-06-02' into staging
Monitor patches # gpg: Signature made Tue Jun 2 09:16:07 2015 BST using RSA key ID EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" * remotes/armbru/tags/pull-monitor-2015-06-02: (21 commits) monitor: Change return type of monitor_cur_is_qmp() to bool monitor: Rename monitor_ctrl_mode() to monitor_is_qmp() monitor: Turn int command_mode into bool in_command_mode monitor: Drop do_qmp_capabilities()'s superfluous QMP check monitor: Unbox Monitor member mc and rename to qmp monitor: Rename monitor_control_read(), monitor_control_event() monitor: Rename handle_user_command() to handle_hmp_command() monitor: Limit QError use to command handlers monitor: Inline monitor_has_error() into its only caller monitor: Wean monitor_protocol_emitter() off mon->error monitor: Propagate errors through invalid_qmp_mode() monitor: Propagate errors through qmp_check_input_obj() monitor: Propagate errors through qmp_check_client_args() monitor: Drop unused "new" HMP command interface monitor: Use trad. command interface for HMP pcie_aer_inject_error monitor: Use traditional command interface for HMP device_add monitor: Use traditional command interface for HMP drive_del monitor: Convert client_migrate_info to QAPI monitor: Improve and document client_migrate_info protocol error monitor: Clean up after previous commit ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
+4
-5
@@ -2113,7 +2113,7 @@ void qmp_block_dirty_bitmap_clear(const char *node, const char *name,
|
||||
aio_context_release(aio_context);
|
||||
}
|
||||
|
||||
int hmp_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
||||
void hmp_drive_del(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
const char *id = qdict_get_str(qdict, "id");
|
||||
BlockBackend *blk;
|
||||
@@ -2124,14 +2124,14 @@ int hmp_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
||||
blk = blk_by_name(id);
|
||||
if (!blk) {
|
||||
error_report("Device '%s' not found", id);
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
bs = blk_bs(blk);
|
||||
|
||||
if (!blk_legacy_dinfo(blk)) {
|
||||
error_report("Deleting device added with blockdev-add"
|
||||
" is not supported");
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
|
||||
aio_context = bdrv_get_aio_context(bs);
|
||||
@@ -2140,7 +2140,7 @@ int hmp_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
||||
if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_DRIVE_DEL, &local_err)) {
|
||||
error_report_err(local_err);
|
||||
aio_context_release(aio_context);
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
|
||||
/* quiesce block driver; prevent further io */
|
||||
@@ -2163,7 +2163,6 @@ int hmp_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
||||
}
|
||||
|
||||
aio_context_release(aio_context);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void qmp_block_resize(bool has_device, const char *device,
|
||||
|
||||
+8
-12
@@ -178,8 +178,7 @@ ETEXI
|
||||
.args_type = "id:B",
|
||||
.params = "device",
|
||||
.help = "remove host block device",
|
||||
.user_print = monitor_user_noop,
|
||||
.mhandler.cmd_new = hmp_drive_del,
|
||||
.mhandler.cmd = hmp_drive_del,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@@ -654,8 +653,7 @@ ETEXI
|
||||
.args_type = "device:O",
|
||||
.params = "driver[,prop=value][,...]",
|
||||
.help = "add device, like -device on the command line",
|
||||
.user_print = monitor_user_noop,
|
||||
.mhandler.cmd_new = do_device_add,
|
||||
.mhandler.cmd = hmp_device_add,
|
||||
.command_completion = device_add_completion,
|
||||
},
|
||||
|
||||
@@ -1011,17 +1009,16 @@ ETEXI
|
||||
.name = "client_migrate_info",
|
||||
.args_type = "protocol:s,hostname:s,port:i?,tls-port:i?,cert-subject:s?",
|
||||
.params = "protocol hostname port tls-port cert-subject",
|
||||
.help = "send migration info to spice/vnc client",
|
||||
.user_print = monitor_user_noop,
|
||||
.mhandler.cmd_new = client_migrate_info,
|
||||
.help = "set migration information for remote display",
|
||||
.mhandler.cmd = hmp_client_migrate_info,
|
||||
},
|
||||
|
||||
STEXI
|
||||
@item client_migrate_info @var{protocol} @var{hostname} @var{port} @var{tls-port} @var{cert-subject}
|
||||
@findex client_migrate_info
|
||||
Set the spice/vnc connection info for the migration target. The spice/vnc
|
||||
server will ask the spice/vnc client to automatically reconnect using the
|
||||
new parameters (if specified) once the vm migration finished successfully.
|
||||
Set migration information for remote display. This makes the server
|
||||
ask the client to automatically reconnect using the new parameters
|
||||
once migration finished successfully. Only implemented for SPICE.
|
||||
ETEXI
|
||||
|
||||
{
|
||||
@@ -1186,8 +1183,7 @@ ETEXI
|
||||
"<error_status> = error string or 32bit\n\t\t\t"
|
||||
"<tlb header> = 32bit x 4\n\t\t\t"
|
||||
"<tlb header prefix> = 32bit x 4",
|
||||
.user_print = pcie_aer_inject_error_print,
|
||||
.mhandler.cmd_new = hmp_pcie_aer_inject_error,
|
||||
.mhandler.cmd = hmp_pcie_aer_inject_error,
|
||||
},
|
||||
|
||||
STEXI
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "qmp-commands.h"
|
||||
#include "qemu/sockets.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "monitor/qdev.h"
|
||||
#include "qapi/opts-visitor.h"
|
||||
#include "qapi/string-output-visitor.h"
|
||||
#include "qapi-visit.h"
|
||||
@@ -1250,6 +1251,23 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
|
||||
}
|
||||
}
|
||||
|
||||
void hmp_client_migrate_info(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
Error *err = NULL;
|
||||
const char *protocol = qdict_get_str(qdict, "protocol");
|
||||
const char *hostname = qdict_get_str(qdict, "hostname");
|
||||
bool has_port = qdict_haskey(qdict, "port");
|
||||
int port = qdict_get_try_int(qdict, "port", -1);
|
||||
bool has_tls_port = qdict_haskey(qdict, "tls-port");
|
||||
int tls_port = qdict_get_try_int(qdict, "tls-port", -1);
|
||||
const char *cert_subject = qdict_get_try_str(qdict, "cert-subject");
|
||||
|
||||
qmp_client_migrate_info(protocol, hostname,
|
||||
has_port, port, has_tls_port, tls_port,
|
||||
!!cert_subject, cert_subject, &err);
|
||||
hmp_handle_error(mon, &err);
|
||||
}
|
||||
|
||||
void hmp_set_password(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
const char *protocol = qdict_get_str(qdict, "protocol");
|
||||
@@ -1482,6 +1500,11 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)
|
||||
}
|
||||
}
|
||||
|
||||
void hmp_device_add(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
do_device_add(mon, qdict, NULL);
|
||||
}
|
||||
|
||||
void hmp_device_del(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
const char *id = qdict_get_str(qdict, "id");
|
||||
|
||||
@@ -67,6 +67,7 @@ void hmp_migrate_set_speed(Monitor *mon, const QDict *qdict);
|
||||
void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict);
|
||||
void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict);
|
||||
void hmp_migrate_set_cache_size(Monitor *mon, const QDict *qdict);
|
||||
void hmp_client_migrate_info(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);
|
||||
@@ -79,6 +80,7 @@ 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);
|
||||
void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict);
|
||||
void hmp_netdev_add(Monitor *mon, const QDict *qdict);
|
||||
|
||||
+1
-13
@@ -29,19 +29,7 @@ PciInfoList *qmp_query_pci(Error **errp)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void pci_error_message(Monitor *mon)
|
||||
void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
monitor_printf(mon, "PCI devices not supported\n");
|
||||
}
|
||||
|
||||
int hmp_pcie_aer_inject_error(Monitor *mon,
|
||||
const QDict *qdict, QObject **ret_data)
|
||||
{
|
||||
pci_error_message(mon);
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
void pcie_aer_inject_error_print(Monitor *mon, const QObject *data)
|
||||
{
|
||||
pci_error_message(mon);
|
||||
}
|
||||
|
||||
+22
-17
@@ -815,21 +815,6 @@ const VMStateDescription vmstate_pcie_aer_log = {
|
||||
}
|
||||
};
|
||||
|
||||
void pcie_aer_inject_error_print(Monitor *mon, const QObject *data)
|
||||
{
|
||||
QDict *qdict;
|
||||
int devfn;
|
||||
assert(qobject_type(data) == QTYPE_QDICT);
|
||||
qdict = qobject_to_qdict(data);
|
||||
|
||||
devfn = (int)qdict_get_int(qdict, "devfn");
|
||||
monitor_printf(mon, "OK id: %s root bus: %s, bus: %x devfn: %x.%x\n",
|
||||
qdict_get_str(qdict, "id"),
|
||||
qdict_get_str(qdict, "root_bus"),
|
||||
(int) qdict_get_int(qdict, "bus"),
|
||||
PCI_SLOT(devfn), PCI_FUNC(devfn));
|
||||
}
|
||||
|
||||
typedef struct PCIEAERErrorName {
|
||||
const char *name;
|
||||
uint32_t val;
|
||||
@@ -962,8 +947,8 @@ static int pcie_aer_parse_error_string(const char *error_name,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
int hmp_pcie_aer_inject_error(Monitor *mon,
|
||||
const QDict *qdict, QObject **ret_data)
|
||||
static int do_pcie_aer_inject_error(Monitor *mon,
|
||||
const QDict *qdict, QObject **ret_data)
|
||||
{
|
||||
const char *id = qdict_get_str(qdict, "id");
|
||||
const char *error_name;
|
||||
@@ -1035,3 +1020,23 @@ int hmp_pcie_aer_inject_error(Monitor *mon,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
QObject *data;
|
||||
int devfn;
|
||||
|
||||
if (do_pcie_aer_inject_error(mon, qdict, &data) < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
assert(qobject_type(data) == QTYPE_QDICT);
|
||||
qdict = qobject_to_qdict(data);
|
||||
|
||||
devfn = (int)qdict_get_int(qdict, "devfn");
|
||||
monitor_printf(mon, "OK id: %s root bus: %s, bus: %x devfn: %x.%x\n",
|
||||
qdict_get_str(qdict, "id"),
|
||||
qdict_get_str(qdict, "root_bus"),
|
||||
(int) qdict_get_int(qdict, "bus"),
|
||||
PCI_SLOT(devfn), PCI_FUNC(devfn));
|
||||
}
|
||||
|
||||
@@ -16,10 +16,7 @@ extern Monitor *default_mon;
|
||||
#define MONITOR_USE_CONTROL 0x04
|
||||
#define MONITOR_USE_PRETTY 0x08
|
||||
|
||||
/* flags for monitor commands */
|
||||
#define MONITOR_CMD_ASYNC 0x0001
|
||||
|
||||
int monitor_cur_is_qmp(void);
|
||||
bool monitor_cur_is_qmp(void);
|
||||
|
||||
void monitor_init(CharDriverState *chr, int flags);
|
||||
|
||||
@@ -43,8 +40,6 @@ void monitor_flush(Monitor *mon);
|
||||
int monitor_set_cpu(int cpu_index);
|
||||
int monitor_get_cpu_index(void);
|
||||
|
||||
typedef void (MonitorCompletion)(void *opaque, QObject *ret_data);
|
||||
|
||||
void monitor_set_error(Monitor *mon, QError *qerror);
|
||||
void monitor_read_command(Monitor *mon, int show_prompt);
|
||||
int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func,
|
||||
|
||||
@@ -66,5 +66,5 @@ DriveInfo *drive_new(QemuOpts *arg, BlockInterfaceType block_default_type);
|
||||
void qmp_change_blockdev(const char *device, const char *filename,
|
||||
const char *format, Error **errp);
|
||||
void hmp_commit(Monitor *mon, const QDict *qdict);
|
||||
int hmp_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data);
|
||||
void hmp_drive_del(Monitor *mon, const QDict *qdict);
|
||||
#endif
|
||||
|
||||
@@ -161,9 +161,7 @@ extern unsigned int nb_prom_envs;
|
||||
void hmp_drive_add(Monitor *mon, const QDict *qdict);
|
||||
|
||||
/* pcie aer error injection */
|
||||
void pcie_aer_inject_error_print(Monitor *mon, const QObject *data);
|
||||
int hmp_pcie_aer_inject_error(Monitor *mon,
|
||||
const QDict *qdict, QObject **ret_data);
|
||||
void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict);
|
||||
|
||||
/* serial ports */
|
||||
|
||||
|
||||
@@ -637,6 +637,25 @@
|
||||
{ 'command': 'query-migrate-parameters',
|
||||
'returns': 'MigrationParameters' }
|
||||
|
||||
##
|
||||
# @client_migrate_info
|
||||
#
|
||||
# Set migration information for remote display. This makes the server
|
||||
# ask the client to automatically reconnect using the new parameters
|
||||
# once migration finished successfully. Only implemented for SPICE.
|
||||
#
|
||||
# @protocol: must be "spice"
|
||||
# @hostname: migration target hostname
|
||||
# @port: #optional spice tcp port for plaintext channels
|
||||
# @tls-port: #optional spice tcp port for tls-secured channels
|
||||
# @cert-subject: #optional server certificate subject
|
||||
#
|
||||
# Since: 0.14.0
|
||||
##
|
||||
{ 'command': 'client_migrate_info',
|
||||
'data': { 'protocol': 'str', 'hostname': 'str', '*port': 'int',
|
||||
'*tls-port': 'int', '*cert-subject': 'str' } }
|
||||
|
||||
##
|
||||
# @MouseInfo:
|
||||
#
|
||||
|
||||
+8
-8
@@ -784,23 +784,23 @@ EQMP
|
||||
.name = "client_migrate_info",
|
||||
.args_type = "protocol:s,hostname:s,port:i?,tls-port:i?,cert-subject:s?",
|
||||
.params = "protocol hostname port tls-port cert-subject",
|
||||
.help = "send migration info to spice/vnc client",
|
||||
.mhandler.cmd_new = client_migrate_info,
|
||||
.help = "set migration information for remote display",
|
||||
.mhandler.cmd_new = qmp_marshal_input_client_migrate_info,
|
||||
},
|
||||
|
||||
SQMP
|
||||
client_migrate_info
|
||||
------------------
|
||||
-------------------
|
||||
|
||||
Set the spice/vnc connection info for the migration target. The spice/vnc
|
||||
server will ask the spice/vnc client to automatically reconnect using the
|
||||
new parameters (if specified) once the vm migration finished successfully.
|
||||
Set migration information for remote display. This makes the server
|
||||
ask the client to automatically reconnect using the new parameters
|
||||
once migration finished successfully. Only implemented for SPICE.
|
||||
|
||||
Arguments:
|
||||
|
||||
- "protocol": protocol: "spice" or "vnc" (json-string)
|
||||
- "protocol": must be "spice" (json-string)
|
||||
- "hostname": migration target hostname (json-string)
|
||||
- "port": spice/vnc tcp port for plaintext channels (json-int, optional)
|
||||
- "port": spice tcp port for plaintext channels (json-int, optional)
|
||||
- "tls-port": spice tcp port for tls-secured channels (json-int, optional)
|
||||
- "cert-subject": server certificate subject (json-string, optional)
|
||||
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
#include "qemu-common.h"
|
||||
#include "monitor/monitor.h"
|
||||
|
||||
int monitor_cur_is_qmp(void)
|
||||
bool monitor_cur_is_qmp(void)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user