aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2015-07-07 14:44:05 +0200
committerJuan Quintela <quintela@redhat.com>2015-07-07 14:54:55 +0200
commitb05dc72342b27585909d9e99d95d17fd3dfbb269 (patch)
treed1088c8f86568e7cefb97ce674872f2e138360b7 /migration
parent598cd2bda0845096d2f06500e45b4d0d399b384a (diff)
downloadqemu-b05dc72342b27585909d9e99d95d17fd3dfbb269.zip
qemu-b05dc72342b27585909d9e99d95d17fd3dfbb269.tar.gz
qemu-b05dc72342b27585909d9e99d95d17fd3dfbb269.tar.bz2
migration: Make events a capability
Make check fails with events. THis is due to the parser/lexer that it uses. Just in case that they are more broken parsers, just only send events when there are capabilities. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r--migration/migration.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/migration/migration.c b/migration/migration.c
index d8415c4..cd32eac 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -205,6 +205,14 @@ void register_global_state(void)
vmstate_register(NULL, 0, &vmstate_globalstate, &global_state);
}
+static void migrate_generate_event(int new_state)
+{
+ if (migrate_use_events()) {
+ qapi_event_send_migration(new_state, &error_abort);
+ trace_migrate_set_state(new_state);
+ }
+}
+
/*
* Called on -incoming with a defer: uri.
* The migration can be started later after any parameters have been
@@ -511,8 +519,7 @@ void qmp_migrate_set_parameters(bool has_compress_level,
static void migrate_set_state(MigrationState *s, int old_state, int new_state)
{
if (atomic_cmpxchg(&s->state, old_state, new_state) == old_state) {
- qapi_event_send_migration(new_state, &error_abort);
- trace_migrate_set_state(new_state);
+ migrate_generate_event(new_state);
}
}
@@ -862,6 +869,15 @@ int migrate_decompress_threads(void)
return s->parameters[MIGRATION_PARAMETER_DECOMPRESS_THREADS];
}
+bool migrate_use_events(void)
+{
+ MigrationState *s;
+
+ s = migrate_get_current();
+
+ return s->enabled_capabilities[MIGRATION_CAPABILITY_EVENTS];
+}
+
int migrate_use_xbzrle(void)
{
MigrationState *s;