From 82d72d9d235c341e0b32ed1a1eb5e544d3b3a895 Mon Sep 17 00:00:00 2001 From: Wenchao Xia Date: Tue, 24 Jun 2014 16:33:57 -0700 Subject: qapi: move event defines Signed-off-by: Wenchao Xia Reviewed-by: Eric Blake Signed-off-by: Luiz Capitulino --- qapi-schema.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'qapi-schema.json') diff --git a/qapi-schema.json b/qapi-schema.json index e7727a1153..37c218994e 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -8,6 +8,9 @@ # QAPI block definitions { 'include': 'qapi/block.json' } +# QAPI event definitions +{ 'include': 'qapi/event.json' } + ## # LostTickPolicy: # @@ -3398,5 +3401,3 @@ ## { 'enum': 'GuestPanicAction', 'data': [ 'pause' ] } - -{ 'include': 'qapi-event.json' } -- cgit v1.2.3-55-g7522 From 2f44a08b3e2a42eb78dcb75657e007dffacba30d Mon Sep 17 00:00:00 2001 From: Wenchao Xia Date: Tue, 24 Jun 2014 16:34:00 -0700 Subject: qapi event: clean up in callers This patch improves docs and address small issues in event callers. Signed-off-by: Wenchao Xia Reviewed-by: Eric Blake Signed-off-by: Luiz Capitulino --- hw/watchdog/watchdog.c | 2 +- include/block/blockjob.h | 2 +- monitor.c | 2 +- qapi-schema.json | 7 ++++--- qapi/block-core.json | 3 ++- qapi/event.json | 4 ++-- 6 files changed, 11 insertions(+), 9 deletions(-) (limited to 'qapi-schema.json') diff --git a/hw/watchdog/watchdog.c b/hw/watchdog/watchdog.c index 4aebd34924..9f607d42bb 100644 --- a/hw/watchdog/watchdog.c +++ b/hw/watchdog/watchdog.c @@ -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(); diff --git a/include/block/blockjob.h b/include/block/blockjob.h index e443987ea8..cc765b50e6 100644 --- a/include/block/blockjob.h +++ b/include/block/blockjob.h @@ -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. diff --git a/monitor.c b/monitor.c index a8ab600c88..fd34ab705a 100644 --- a/monitor.c +++ b/monitor.c @@ -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,7 +586,6 @@ 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); diff --git a/qapi-schema.json b/qapi-schema.json index 37c218994e..c68a17f4d8 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -657,8 +657,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 # @@ -697,7 +698,7 @@ ## { 'type': 'VncClientInfo', 'base': 'VncBasicInfo', - 'data': { '*x509_dname' : 'str', '*sasl_username': 'str' } } + 'data': { '*x509_dname': 'str', '*sasl_username': 'str' } } ## # @VncInfo: diff --git a/qapi/block-core.json b/qapi/block-core.json index af6b436540..925e53e944 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.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 diff --git a/qapi/event.json b/qapi/event.json index e7a47f9927..8f817b18a1 100644 --- a/qapi/event.json +++ b/qapi/event.json @@ -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 -- cgit v1.2.3-55-g7522 From 32a97ea1711f43388e178b7c43e02143a61e47ee Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Thu, 26 Jun 2014 17:50:03 +0200 Subject: char: report frontend open/closed state in 'query-chardev' In addition to the on-line reporting added in the previous patch, allow libvirt to query frontend state independently of events. Libvirt's path to identify the guest agent channel it cares about differs between the event added in the previous patch and the QMP response field added here. The event identifies the frontend device, by "id". The 'query-chardev' QMP command identifies the backend device (again by "id"). The association is under libvirt's control. RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1080376 Reviewed-by: Amit Shah Signed-off-by: Laszlo Ersek Reviewed-by: Eric Blake Signed-off-by: Luiz Capitulino --- qapi-schema.json | 8 +++++++- qemu-char.c | 1 + qmp-commands.hx | 19 ++++++++++++++----- 3 files changed, 22 insertions(+), 6 deletions(-) (limited to 'qapi-schema.json') diff --git a/qapi-schema.json b/qapi-schema.json index c68a17f4d8..2284f0f12a 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -214,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: diff --git a/qemu-char.c b/qemu-char.c index cbd6b9a025..51917de462 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -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; diff --git a/qmp-commands.hx b/qmp-commands.hx index e4a1c80434..35f51466fb 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -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": "charchannel0", + "filename": "unix:/var/lib/libvirt/qemu/seabios.rhel6.agent,server", + "frontend-open": false + }, { - "label":"monitor", - "filename":"stdio" + "label": "charmonitor", + "filename": "unix:/var/lib/libvirt/qemu/seabios.rhel6.monitor,server", + "frontend-open": true }, { - "label":"serial0", - "filename":"vc" + "label": "charserial0", + "filename": "pty:/dev/pts/2", + "frontend-open": true } ] } -- cgit v1.2.3-55-g7522