[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH COLO-Frame v8 19/34] qmp event: Add event notificati
From: |
zhanghailiang |
Subject: |
[Qemu-devel] [PATCH COLO-Frame v8 19/34] qmp event: Add event notification for COLO error |
Date: |
Wed, 29 Jul 2015 16:45:29 +0800 |
If some errors happen during VM's COLO FT stage, it's import to notify the users
this event, Togehter with '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 exit 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>
---
docs/qmp/qmp-events.txt | 16 ++++++++++++++++
migration/colo.c | 11 ++++++++++-
qapi/event.json | 15 +++++++++++++++
3 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/docs/qmp/qmp-events.txt b/docs/qmp/qmp-events.txt
index d92cc48..c7b4581 100644
--- a/docs/qmp/qmp-events.txt
+++ b/docs/qmp/qmp-events.txt
@@ -488,6 +488,22 @@ Example:
{"timestamp": {"seconds": 1432121972, "microseconds": 744001},
"event": "MIGRATION", "data": {"status": "completed"}}
+COLO_EXIT
+---------
+
+Emitted when VM finish COLO mode due to some errors happening or
+the request of users.
+
+Data: None.
+
+ - "mode": COLO mode, 'primary' or 'secondary'
+ - "error": Error message (json-string, optional)
+
+Example:
+
+{"timestamp": {"seconds": 2032141960, "microseconds": 417172},
+ "event": "COLO_EXIT", "data": {"mode": "primary"}}
+
STOP
----
diff --git a/migration/colo.c b/migration/colo.c
index a03ba0d..afddb52 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -16,6 +16,7 @@
#include "qemu/error-report.h"
#include "qemu/sockets.h"
#include "migration/failover.h"
+#include "qapi-event.h"
/* Fix me: Convert to use QAPI */
typedef enum COLOCommand {
@@ -373,6 +374,7 @@ out:
qemu_fclose(colo_control);
}
+ qapi_event_send_colo_exit("primary", true, "unknown", NULL);;
/* Give users time (2s) to get involved in this verdict */
for (i = 0; i < 10; i++) {
if (failover_request_is_active()) {
@@ -566,6 +568,13 @@ void *colo_process_incoming_checkpoints(void *opaque)
out:
error_report("Detect some error or get a failover request");
+ /*
+ * Here, we raise a qmp event to the user,
+ * It can help user to know what happens, and help deciding whether to
+ * do failover.
+ */
+ qapi_event_send_colo_exit("secondary", true, "unknown", NULL);
+
if (fb) {
qemu_fclose(fb);
}
@@ -581,7 +590,7 @@ out:
error_report("Secondary VM will take over work");
break;
}
- usleep(200*1000);
+ usleep(200 * 1000);
}
/* check flag again*/
if (!failover_request_is_active()) {
diff --git a/qapi/event.json b/qapi/event.json
index f0cef01..21dfe3a 100644
--- a/qapi/event.json
+++ b/qapi/event.json
@@ -255,6 +255,21 @@
'data': {'status': 'MigrationStatus'}}
##
+# @COLO_EXIT
+#
+# Emitted when VM finish COLO mode due to some errors happening or
+# the request of users.
+#
+# @mode: 'primary' or 'secondeary'.
+#
+# @error: #optional, error message. Only present on error happening.
+#
+# Since: 2.4
+##
+{ 'event': 'COLO_EXIT',
+ 'data': {'mode': 'str', '*error':'str'}}
+
+##
# @ACPI_DEVICE_OST
#
# Emitted when guest executes ACPI _OST method.
--
1.8.3.1
- [Qemu-devel] [PATCH COLO-Frame v8 18/34] COLO failover: Implement COLO primary/secondary vm failover work, (continued)
- [Qemu-devel] [PATCH COLO-Frame v8 18/34] COLO failover: Implement COLO primary/secondary vm failover work, zhanghailiang, 2015/07/29
- [Qemu-devel] [PATCH COLO-Frame v8 33/34] COLO: Implement shutdown checkpoint, zhanghailiang, 2015/07/29
- [Qemu-devel] [PATCH COLO-Frame v8 29/34] COLO: Do checkpoint according to the result of packets comparation, zhanghailiang, 2015/07/29
- [Qemu-devel] [PATCH COLO-Frame v8 28/34] COLO: Handle nfnetlink message from proxy module, zhanghailiang, 2015/07/29
- [Qemu-devel] [PATCH COLO-Frame v8 24/34] COLO NIC: Implement colo nic device interface configure(), zhanghailiang, 2015/07/29
- [Qemu-devel] [PATCH COLO-Frame v8 32/34] COLO NIC: Implement NIC checkpoint and failover, zhanghailiang, 2015/07/29
- [Qemu-devel] [PATCH COLO-Frame v8 31/34] COLO: Add colo-set-checkpoint-period command, zhanghailiang, 2015/07/29
- [Qemu-devel] [PATCH COLO-Frame v8 27/34] COLO NIC: Some init work related with proxy module, zhanghailiang, 2015/07/29
- [Qemu-devel] [PATCH COLO-Frame v8 21/34] COLO: Add new command parameter 'forward_nic' 'colo_script' for net, zhanghailiang, 2015/07/29
- [Qemu-devel] [PATCH COLO-Frame v8 34/34] COLO: Add block replication into colo process, zhanghailiang, 2015/07/29
- [Qemu-devel] [PATCH COLO-Frame v8 19/34] qmp event: Add event notification for COLO error,
zhanghailiang <=
- [Qemu-devel] [PATCH COLO-Frame v8 30/34] COLO: Improve checkpoint efficiency by do additional periodic checkpoint, zhanghailiang, 2015/07/29
- [Qemu-devel] [PATCH COLO-Frame v8 02/34] migration: Introduce capability 'colo' to migration, zhanghailiang, 2015/07/29