@@ -473,6 +473,22 @@ Example:
{ "timestamp": {"seconds": 1290688046, "microseconds": 417172},
"event": "SPICE_MIGRATE_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
----
@@ -15,6 +15,7 @@
#include "trace.h"
#include "qemu/error-report.h"
#include "migration/migration-failover.h"
+#include "qapi-event.h"
enum {
COLO_CHECPOINT_READY = 0x46,
@@ -325,13 +326,14 @@ static void *colo_thread(void *opaque)
out:
error_report("colo: some error happens in colo_thread");
+ 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_set()) {
error_report("Primary VM will take over work");
break;
}
- usleep(200*1000);
+ usleep(200 * 1000);
}
qemu_mutex_lock_iothread();
if (!failover_request_is_set()) {
@@ -533,13 +535,19 @@ 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);;
/* Give users time (2s) to get involved in this verdict */
for (i = 0; i < 10; i++) {
if (failover_request_is_set()) {
error_report("Secondary VM will take over work");
break;
}
- usleep(200*1000);
+ usleep(200 * 1000);
}
/* check flag again*/
if (!failover_request_is_set()) {
@@ -243,6 +243,21 @@
{ 'event': 'SPICE_MIGRATE_COMPLETED' }
##
+# @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.