[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH COLO-Frame v13 25/39] qmp event: Add COLO_EXIT event
From: |
zhanghailiang |
Subject: |
[Qemu-devel] [PATCH COLO-Frame v13 25/39] qmp event: Add COLO_EXIT event to notify users while exited from COLO |
Date: |
Tue, 29 Dec 2015 15:09:21 +0800 |
If some errors happen during VM's COLO FT stage, it's important to notify the
users
of this event. Together with 'x_colo_lost_heartbeat', users can intervene in
COLO's
failover work immediately.
If users don't want to get involved in COLO's failover verdict,
it is still necessary to notify users that we exited COLO mode.
Cc: Markus Armbruster <address@hidden>
Cc: Michael Roth <address@hidden>
Signed-off-by: zhanghailiang <address@hidden>
Signed-off-by: Li Zhijian <address@hidden>
---
v13:
- Remove optional 'error' string for this event.
(I doubted it was usefull for users, Since users shouldn't interpret it and
can't depend on it to decide what happened exaclty.
Besides it is really hard to organize.)
- Remove unused 'unknown' member for enum COLOExitReason.
(Eric's suggestion)
- Fix comment for COLO_EXIT
v11:
- Fix several typos found by Eric
---
docs/qmp-events.txt | 16 ++++++++++++++++
migration/colo.c | 20 ++++++++++++++++++++
qapi-schema.json | 14 ++++++++++++++
qapi/event.json | 15 +++++++++++++++
4 files changed, 65 insertions(+)
diff --git a/docs/qmp-events.txt b/docs/qmp-events.txt
index d2f1ce4..fef577e 100644
--- a/docs/qmp-events.txt
+++ b/docs/qmp-events.txt
@@ -184,6 +184,22 @@ Example:
Note: The "ready to complete" status is always reset by a BLOCK_JOB_ERROR
event.
+COLO_EXIT
+---------
+
+Emitted when VM finishes COLO mode due to some errors happening or
+at the request of users.
+
+Data:
+
+ - "mode": COLO mode, primary or secondary side (json-string)
+ - "reason": the exit reason, internal error or external request. (json-string)
+
+Example:
+
+{"timestamp": {"seconds": 2032141960, "microseconds": 417172},
+ "event": "COLO_EXIT", "data": {"mode": "primary", "reason": "request" } }
+
DEVICE_DELETED
--------------
diff --git a/migration/colo.c b/migration/colo.c
index 752a667..6c17cc4 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -17,6 +17,7 @@
#include "trace.h"
#include "qemu/error-report.h"
#include "migration/failover.h"
+#include "qapi-event.h"
/* colo buffer */
#define COLO_BUFFER_BASE_SIZE (4 * 1024 * 1024)
@@ -367,6 +368,18 @@ out:
if (local_err) {
error_report_err(local_err);
}
+ /*
+ * There are only two reasons we can go here, something error happened,
+ * Or users triggered failover.
+ */
+ if (!failover_request_is_active()) {
+ qapi_event_send_colo_exit(COLO_MODE_PRIMARY,
+ COLO_EXIT_REASON_ERROR, NULL);
+ } else {
+ qapi_event_send_colo_exit(COLO_MODE_PRIMARY,
+ COLO_EXIT_REASON_REQUEST, NULL);
+ }
+
qsb_free(buffer);
buffer = NULL;
@@ -530,6 +543,13 @@ out:
if (local_err) {
error_report_err(local_err);
}
+ if (!failover_request_is_active()) {
+ qapi_event_send_colo_exit(COLO_MODE_SECONDARY,
+ COLO_EXIT_REASON_ERROR, NULL);
+ } else {
+ qapi_event_send_colo_exit(COLO_MODE_SECONDARY,
+ COLO_EXIT_REASON_REQUEST, NULL);
+ }
if (fb) {
qemu_fclose(fb);
diff --git a/qapi-schema.json b/qapi-schema.json
index 7326102..94f23a6 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -776,6 +776,20 @@
'data': [ 'unknown', 'primary', 'secondary'] }
##
+# @COLOExitReason
+#
+# The reason for a COLO exit
+#
+# @request: COLO exit is due to an external request
+#
+# @error: COLO exit is due to an internal error
+#
+# Since: 2.6
+##
+{ 'enum': 'COLOExitReason',
+ 'data': [ 'request', 'error' ] }
+
+##
# @x-colo-lost-heartbeat
#
# Tell qemu that heartbeat is lost, request it to do takeover procedures.
diff --git a/qapi/event.json b/qapi/event.json
index f0cef01..1958137 100644
--- a/qapi/event.json
+++ b/qapi/event.json
@@ -255,6 +255,21 @@
'data': {'status': 'MigrationStatus'}}
##
+# @COLO_EXIT
+#
+# Emitted when VM finishes COLO mode due to some errors happening or
+# at the request of users.
+#
+# @mode: which COLO mode the VM was in when it exited.
+#
+# @reason: describes the reason for the COLO exit.
+#
+# Since: 2.6
+##
+{ 'event': 'COLO_EXIT',
+ 'data': {'mode': 'COLOMode', 'reason': 'COLOExitReason' } }
+
+##
# @ACPI_DEVICE_OST
#
# Emitted when guest executes ACPI _OST method.
--
1.8.3.1
- [Qemu-devel] [PATCH COLO-Frame v13 14/39] ram: Split host_from_stream_offset() into two helper functions, (continued)
- [Qemu-devel] [PATCH COLO-Frame v13 14/39] ram: Split host_from_stream_offset() into two helper functions, zhanghailiang, 2015/12/29
- [Qemu-devel] [PATCH COLO-Frame v13 17/39] COLO: Load VMState into qsb before restore it, zhanghailiang, 2015/12/29
- [Qemu-devel] [PATCH COLO-Frame v13 30/39] savevm: Split load vm state function qemu_loadvm_state, zhanghailiang, 2015/12/29
- [Qemu-devel] [PATCH COLO-Frame v13 39/39] COLO: Add block replication into colo process, zhanghailiang, 2015/12/29
- [Qemu-devel] [PATCH COLO-Frame v13 29/39] COLO: Update the global runstate after going into colo state, zhanghailiang, 2015/12/29
- [Qemu-devel] [PATCH COLO-Frame v13 03/39] COLO: migrate colo related info to secondary node, zhanghailiang, 2015/12/29
- [Qemu-devel] [PATCH COLO-Frame v13 35/39] filter-buffer: Accept zero interval, zhanghailiang, 2015/12/29
- [Qemu-devel] [PATCH COLO-Frame v13 37/39] filter-buffer: Introduce a helper function to release packets, zhanghailiang, 2015/12/29
- [Qemu-devel] [PATCH COLO-Frame v13 21/39] COLO failover: Introduce a new command to trigger a failover, zhanghailiang, 2015/12/29
- [Qemu-devel] [PATCH COLO-Frame v13 26/39] COLO failover: Shutdown related socket fd when do failover, zhanghailiang, 2015/12/29
- [Qemu-devel] [PATCH COLO-Frame v13 25/39] qmp event: Add COLO_EXIT event to notify users while exited from COLO,
zhanghailiang <=
- [Qemu-devel] [PATCH COLO-Frame v13 34/39] net/filter-buffer: Add default filter-buffer for each netdev, zhanghailiang, 2015/12/29
- [Qemu-devel] [PATCH COLO-Frame v13 31/39] savevm: Introduce two helper functions for save/find loadvm_handlers entry, zhanghailiang, 2015/12/29
- [Qemu-devel] [PATCH COLO-Frame v13 28/39] COLO: Process shutdown command for VM in COLO state, zhanghailiang, 2015/12/29
- [Qemu-devel] [PATCH COLO-Frame v13 36/39] filter-buffer: Introduce a helper function to enable/disable default filter, zhanghailiang, 2015/12/29
- [Qemu-devel] [PATCH COLO-Frame v13 38/39] colo: Use default buffer-filter to buffer and release packets, zhanghailiang, 2015/12/29
- [Qemu-devel] [PATCH COLO-Frame v13 06/39] migration: Integrate COLO checkpoint process into migration, zhanghailiang, 2015/12/29
- Re: [Qemu-devel] [PATCH COLO-Frame v13 00/39] COarse-grain LOck-stepping(COLO) Virtual Machines for Non-stop Service (FT), Hailiang Zhang, 2015/12/29