mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging
* remotes/qmp-unstable/queue/qmp: docs/qmp: Fix documentation of BLOCK_JOB_READY to match code char: report frontend open/closed state in 'query-chardev' virtio-serial: report frontend connection state via monitor qmp: add qmp-events.txt back qapi event: clean up in callers qapi script: clean up in scripts qapi: ignore generated event files qapi: move event defines Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
/qapi-generated
|
||||
/qapi-types.[ch]
|
||||
/qapi-visit.[ch]
|
||||
/qapi-event.[ch]
|
||||
/qmp-commands.h
|
||||
/qmp-marshal.c
|
||||
/qemu-doc.html
|
||||
|
||||
@@ -248,7 +248,7 @@ $(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
|
||||
|
||||
qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json \
|
||||
$(SRC_PATH)/qapi/block.json $(SRC_PATH)/qapi/block-core.json \
|
||||
$(SRC_PATH)/qapi-event.json
|
||||
$(SRC_PATH)/qapi/event.json
|
||||
|
||||
qapi-types.c qapi-types.h :\
|
||||
$(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
|
||||
|
||||
@@ -218,10 +218,10 @@ An example command is:
|
||||
=== Events ===
|
||||
|
||||
Events are defined with the keyword 'event'. When 'data' is also specified,
|
||||
additional info will be carried on. Finally there will be C API generated
|
||||
in qapi-event.h; when called by QEMU code, a message with timestamp will
|
||||
be emitted on the wire. If timestamp is -1, it means failure to retrieve host
|
||||
time.
|
||||
additional info will be included in the event. Finally there will be C API
|
||||
generated in qapi-event.h; when called by QEMU code, a message with timestamp
|
||||
will be emitted on the wire. If timestamp is -1, it means failure to retrieve
|
||||
host time.
|
||||
|
||||
An example event is:
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,6 +14,7 @@
|
||||
#include "qemu/error-report.h"
|
||||
#include "trace.h"
|
||||
#include "hw/virtio/virtio-serial.h"
|
||||
#include "qapi-event.h"
|
||||
|
||||
#define TYPE_VIRTIO_CONSOLE_SERIAL_PORT "virtserialport"
|
||||
#define VIRTIO_CONSOLE(obj) \
|
||||
@@ -81,11 +82,16 @@ static ssize_t flush_buf(VirtIOSerialPort *port,
|
||||
static void set_guest_connected(VirtIOSerialPort *port, int guest_connected)
|
||||
{
|
||||
VirtConsole *vcon = VIRTIO_CONSOLE(port);
|
||||
DeviceState *dev = DEVICE(port);
|
||||
|
||||
if (!vcon->chr) {
|
||||
return;
|
||||
if (vcon->chr) {
|
||||
qemu_chr_fe_set_open(vcon->chr, guest_connected);
|
||||
}
|
||||
|
||||
if (dev->id) {
|
||||
qapi_event_send_vserport_change(dev->id, guest_connected,
|
||||
&error_abort);
|
||||
}
|
||||
qemu_chr_fe_set_open(vcon->chr, guest_connected);
|
||||
}
|
||||
|
||||
/* Readiness of the guest to accept data on a port */
|
||||
|
||||
@@ -106,7 +106,7 @@ int select_watchdog_action(const char *p)
|
||||
*/
|
||||
void watchdog_perform_action(void)
|
||||
{
|
||||
switch(watchdog_action) {
|
||||
switch (watchdog_action) {
|
||||
case WDT_RESET: /* same as 'system_reset' in monitor */
|
||||
qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_RESET, &error_abort);
|
||||
qemu_system_reset_request();
|
||||
|
||||
@@ -217,7 +217,7 @@ void block_job_pause(BlockJob *job);
|
||||
void block_job_resume(BlockJob *job);
|
||||
|
||||
/**
|
||||
* block_job_event_cancle:
|
||||
* block_job_event_cancelled:
|
||||
* @job: The job whose information is requested.
|
||||
*
|
||||
* Send a BLOCK_JOB_CANCELLED event for the specified job.
|
||||
|
||||
@@ -570,6 +570,7 @@ monitor_qapi_event_throttle(QAPIEvent event, int64_t rate)
|
||||
|
||||
trace_monitor_protocol_event_throttle(event, rate);
|
||||
evstate->event = event;
|
||||
assert(rate * SCALE_MS <= INT64_MAX);
|
||||
evstate->rate = rate * SCALE_MS;
|
||||
evstate->last = 0;
|
||||
evstate->data = NULL;
|
||||
@@ -585,9 +586,9 @@ static void monitor_qapi_event_init(void)
|
||||
monitor_qapi_event_throttle(QAPI_EVENT_RTC_CHANGE, 1000);
|
||||
monitor_qapi_event_throttle(QAPI_EVENT_WATCHDOG, 1000);
|
||||
monitor_qapi_event_throttle(QAPI_EVENT_BALLOON_CHANGE, 1000);
|
||||
/* limit the rate of quorum events to avoid hammering the management */
|
||||
monitor_qapi_event_throttle(QAPI_EVENT_QUORUM_REPORT_BAD, 1000);
|
||||
monitor_qapi_event_throttle(QAPI_EVENT_QUORUM_FAILURE, 1000);
|
||||
monitor_qapi_event_throttle(QAPI_EVENT_VSERPORT_CHANGE, 1000);
|
||||
|
||||
qmp_event_set_func_emit(monitor_qapi_event_queue);
|
||||
}
|
||||
|
||||
+14
-6
@@ -8,6 +8,9 @@
|
||||
# QAPI block definitions
|
||||
{ 'include': 'qapi/block.json' }
|
||||
|
||||
# QAPI event definitions
|
||||
{ 'include': 'qapi/event.json' }
|
||||
|
||||
##
|
||||
# LostTickPolicy:
|
||||
#
|
||||
@@ -211,12 +214,18 @@
|
||||
#
|
||||
# @filename: the filename of the character device
|
||||
#
|
||||
# @frontend-open: shows whether the frontend device attached to this backend
|
||||
# (eg. with the chardev=... option) is in open or closed state
|
||||
# (since 2.1)
|
||||
#
|
||||
# Notes: @filename is encoded using the QEMU command line character device
|
||||
# encoding. See the QEMU man page for details.
|
||||
#
|
||||
# Since: 0.14.0
|
||||
##
|
||||
{ 'type': 'ChardevInfo', 'data': {'label': 'str', 'filename': 'str'} }
|
||||
{ 'type': 'ChardevInfo', 'data': {'label': 'str',
|
||||
'filename': 'str',
|
||||
'frontend-open': 'bool'} }
|
||||
|
||||
##
|
||||
# @query-chardev:
|
||||
@@ -654,8 +663,9 @@
|
||||
#
|
||||
# @host: IP address
|
||||
#
|
||||
# @service: The service name of vnc port. This may depend on the host system's
|
||||
# service database so symbolic names should not be relied on.
|
||||
# @service: The service name of the vnc port. This may depend on the host
|
||||
# system's service database so symbolic names should not be relied
|
||||
# on.
|
||||
#
|
||||
# @family: address family
|
||||
#
|
||||
@@ -694,7 +704,7 @@
|
||||
##
|
||||
{ 'type': 'VncClientInfo',
|
||||
'base': 'VncBasicInfo',
|
||||
'data': { '*x509_dname' : 'str', '*sasl_username': 'str' } }
|
||||
'data': { '*x509_dname': 'str', '*sasl_username': 'str' } }
|
||||
|
||||
##
|
||||
# @VncInfo:
|
||||
@@ -3458,5 +3468,3 @@
|
||||
##
|
||||
{ 'enum': 'GuestPanicAction',
|
||||
'data': [ 'pause' ] }
|
||||
|
||||
{ 'include': 'qapi-event.json' }
|
||||
|
||||
@@ -1436,7 +1436,8 @@
|
||||
# @device: device name
|
||||
#
|
||||
# @msg: informative message for human consumption, such as the kind of
|
||||
# corruption being detected
|
||||
# corruption being detected. It should not be parsed by machine as it is
|
||||
# not guaranteed to be stable
|
||||
#
|
||||
# @offset: #optional, if the corruption resulted from an image access, this is
|
||||
# the access offset into the image
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
##
|
||||
# @SHUTDOWN
|
||||
#
|
||||
# Emitted when the virtual machine has shutdown, possibly indicating that QEMU
|
||||
# is about about to exit.
|
||||
# Emitted when the virtual machine has shut down, indicating that qemu is
|
||||
# about to exit.
|
||||
#
|
||||
# Note: If the command-line option "-no-shutdown" has been specified, qemu will
|
||||
# not exit, and a STOP event will eventually follow the SHUTDOWN event
|
||||
@@ -316,3 +316,17 @@
|
||||
{ 'event': 'QUORUM_REPORT_BAD',
|
||||
'data': { '*error': 'str', 'node-name': 'str',
|
||||
'sector-num': 'int', 'sector-count': 'int' } }
|
||||
|
||||
##
|
||||
# @VSERPORT_CHANGE
|
||||
#
|
||||
# Emitted when the guest opens or closes a virtio-serial port.
|
||||
#
|
||||
# @id: device identifier of the virtio-serial port
|
||||
#
|
||||
# @open: true if the guest has opened the virtio-serial port
|
||||
#
|
||||
# Since: 2.1
|
||||
##
|
||||
{ 'event': 'VSERPORT_CHANGE',
|
||||
'data': { 'id': 'str', 'open': 'bool' } }
|
||||
@@ -3705,6 +3705,7 @@ ChardevInfoList *qmp_query_chardev(Error **errp)
|
||||
info->value = g_malloc0(sizeof(*info->value));
|
||||
info->value->label = g_strdup(chr->label);
|
||||
info->value->filename = g_strdup(chr->filename);
|
||||
info->value->frontend_open = chr->fe_open;
|
||||
|
||||
info->next = chr_list;
|
||||
chr_list = info;
|
||||
|
||||
+14
-5
@@ -1921,19 +1921,28 @@ Each json-object contain the following:
|
||||
|
||||
- "label": device's label (json-string)
|
||||
- "filename": device's file (json-string)
|
||||
- "frontend-open": open/closed state of the frontend device attached to this
|
||||
backend (json-bool)
|
||||
|
||||
Example:
|
||||
|
||||
-> { "execute": "query-chardev" }
|
||||
<- {
|
||||
"return":[
|
||||
"return": [
|
||||
{
|
||||
"label":"monitor",
|
||||
"filename":"stdio"
|
||||
"label": "charchannel0",
|
||||
"filename": "unix:/var/lib/libvirt/qemu/seabios.rhel6.agent,server",
|
||||
"frontend-open": false
|
||||
},
|
||||
{
|
||||
"label":"serial0",
|
||||
"filename":"vc"
|
||||
"label": "charmonitor",
|
||||
"filename": "unix:/var/lib/libvirt/qemu/seabios.rhel6.monitor,server",
|
||||
"frontend-open": true
|
||||
},
|
||||
{
|
||||
"label": "charserial0",
|
||||
"filename": "pty:/dev/pts/2",
|
||||
"frontend-open": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -26,9 +26,8 @@ def _generate_event_api_name(event_name, params):
|
||||
api_name += "bool has_%s,\n" % c_var(argname)
|
||||
api_name += "".ljust(l)
|
||||
|
||||
if argentry == "str":
|
||||
api_name += "const "
|
||||
api_name += "%s %s,\n" % (c_type(argentry), c_var(argname))
|
||||
api_name += "%s %s,\n" % (c_type(argentry, is_param=True),
|
||||
c_var(argname))
|
||||
api_name += "".ljust(l)
|
||||
|
||||
api_name += "Error **errp)"
|
||||
|
||||
+1
-1
@@ -255,7 +255,7 @@ def check_event(expr, expr_info):
|
||||
if structured:
|
||||
raise QAPIExprError(expr_info,
|
||||
"Nested structure define in event is not "
|
||||
"supported now, event '%s', argname '%s'"
|
||||
"supported, event '%s', argname '%s'"
|
||||
% (expr['event'], argname))
|
||||
|
||||
def check_union(expr, expr_info):
|
||||
|
||||
@@ -1 +1 @@
|
||||
tests/qapi-schema/event-nest-struct.json:1: Nested structure define in event is not supported now, event 'EVENT_A', argname 'a'
|
||||
tests/qapi-schema/event-nest-struct.json:1: Nested structure define in event is not supported, event 'EVENT_A', argname 'a'
|
||||
|
||||
Reference in New Issue
Block a user