[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH COLO-Frame v18 20/34] qmp event: Add COLO_EXIT event
From: |
zhanghailiang |
Subject: |
[Qemu-devel] [PATCH COLO-Frame v18 20/34] qmp event: Add COLO_EXIT event to notify users while exited from COLO |
Date: |
Wed, 3 Aug 2016 20:25:58 +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>
Reviewed-by: Eric Blake <address@hidden>
---
v16:
- fix some minor grammars from Eric
- Add Reviewed-by tag
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 | 19 +++++++++++++++++++
qapi-schema.json | 14 ++++++++++++++
qapi/event.json | 15 +++++++++++++++
4 files changed, 64 insertions(+)
diff --git a/docs/qmp-events.txt b/docs/qmp-events.txt
index 7967ec4..02dd521 100644
--- a/docs/qmp-events.txt
+++ b/docs/qmp-events.txt
@@ -188,6 +188,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 eeef775..f8fce0d 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -19,6 +19,7 @@
#include "qemu/error-report.h"
#include "qapi/error.h"
#include "migration/failover.h"
+#include "qapi-event.h"
#define COLO_BUFFER_BASE_SIZE (4 * 1024 * 1024)
@@ -361,6 +362,17 @@ out:
}
qemu_fclose(fb);
+ /*
+ * There are only two reasons we can go here, some error happened.
+ * Or the user 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);
+ }
if (s->rp_state.from_dst_file) {
qemu_fclose(s->rp_state.from_dst_file);
@@ -520,6 +532,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 ee7131d..d729b61 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -835,6 +835,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.8
+##
+{ '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 8642052..88d10e7 100644
--- a/qapi/event.json
+++ b/qapi/event.json
@@ -268,6 +268,21 @@
'data': { 'pass': 'int' } }
##
+# @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.8
+##
+{ '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 v18 14/34] COLO: Add checkpoint-delay parameter for migrate-set-parameters, (continued)
- [Qemu-devel] [PATCH COLO-Frame v18 14/34] COLO: Add checkpoint-delay parameter for migrate-set-parameters, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 26/34] migration/savevm: Add new helpers to process the different stages of loadvm, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 21/34] COLO failover: Shutdown related socket fd when do failover, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 18/34] COLO: Implement failover work for Primary VM, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 12/34] COLO: Load VMState into buffer before restore it, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 28/34] COLO: Separate the process of saving/loading ram and device state, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 10/34] COLO: Load PVM's dirty pages into SVM's RAM cache temporarily, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 24/34] COLO: Update the global runstate after going into colo state, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 20/34] qmp event: Add COLO_EXIT event to notify users while exited from COLO,
zhanghailiang <=
- [Qemu-devel] [PATCH COLO-Frame v18 05/34] migration: Integrate COLO checkpoint process into loadvm, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 11/34] ram/COLO: Record the dirty pages that SVM received, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 02/34] migration: Introduce capability 'x-colo' to migration, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 32/34] COLO/filter: Add each netdev a buffer filter, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 31/34] net: Add notifier/callback for netdev init, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 06/34] COLO/migration: Create a new communication path from destination to source, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 03/34] COLO: migrate colo related info to secondary node, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 17/34] COLO failover: Introduce state to record failover process, zhanghailiang, 2016/08/03