migration: Make events a capability
PATCH 1/1 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.
--- include/migration/migration.h | 1 + migration/migration.c | 20 ++++++++++++++++++-- qapi-schema.json | 5 ++++- 3 files changed, 23 insertions(+), 3 deletions(-)
include/migration/migration.h +1 -0
@@ -177,6 +177,7 @@ bool migrate_use_compression(void);int migrate_compress_level (void );int migrate_compress_threads (void );int migrate_decompress_threads (void ); +bool migrate_use_events (void );void ram_control_before_iterate (QEMUFile *f,uint64_t flags);void ram_control_after_iterate (QEMUFile *f,uint64_t flags);
migration/migration.c +18 -2
@@ -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
@@ -514,8 +522,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); } }
@@ -865,6 +872,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;
qapi-schema.json +4 -1
@@ -523,6 +523,9 @@ # minimize migration traffic. The feature is disabled by default. # (since 2.4 ) # +# @events: generate events for each migration state change +# (since 2.4 ) +# # @auto-converge: If enabled, QEMU will automatically throttle down the guest # to speed up convergence of RAM migration. (since 1.6) #
@@ -530,7 +533,7 @@ ## { 'enum': 'MigrationCapability', 'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks', - 'compress'] } + 'compress', 'events'] } ## # @MigrationCapabilityStatus
Signature · 1 line
2.4.3
Quoted 5 lines · * Juan Quintela ([email protected]) wrote:
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 <[email protected]>
Quoted 24 lines
--- include/migration/migration.h | 1 + migration/migration.c | 20 ++++++++++++++++++-- qapi-schema.json | 5 ++++- 3 files changed, 23 insertions(+), 3 deletions(-)include/migration/migration.h +1
-0@@ -177,6 +177,7 @@ bool migrate_use_compression(void);int migrate_compress_level (void );int migrate_compress_threads (void );int migrate_decompress_threads (void ); +bool migrate_use_events (void );void ram_control_before_iterate (QEMUFile *f,uint64_t flags);void ram_control_after_iterate (QEMUFile *f,uint64_t flags);migration/migration.c +0
-0@@ -205,6 +205,14 @@ void register_global_state(void)vmstate_register (NULL ,0 , &vmstate_globalstate, &global_state);
migration/migration.c void register_global_state(void) · line 215
Quoted 10 lines
migration/migration.c +8
-0} +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); + } +} +
OK, I would have traced it anyway, but not worth holding it up for that.
Dave
Quoted 55 lines
migration/migration.c +10
-2/* * Called on -incoming with a defer: uri. * The migration can be started later after any parameters have been @@ -514,8 +522,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); } }@@ -865,6 +872,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;qapi-schema.json +4
-1@@ -523,6 +523,9 @@ # minimize migration traffic. The feature is disabled by default. # (since 2.4 ) # +# @events: generate events for each migration state change +# (since 2.4 ) +# # @auto-converge: If enabled, QEMU will automatically throttle down the guest # to speed up convergence of RAM migration. (since 1.6) #@@ -530,7 +533,7 @@ ## { 'enum': 'MigrationCapability', 'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks', - 'compress'] } + 'compress', 'events'] } ## # @MigrationCapabilityStatusSignature · 1 line
2.4.3
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Quoted 14 lines · Juan Quintela
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 <[email protected]>--- include/migration/migration.h | 1 + migration/migration.c | 20 ++++++++++++++++++-- qapi-schema.json | 5 ++++- 3 files changed, 23 insertions(+), 3 deletions(-)+++
b/qapi-schema.json
qapi-schema.json line 524
Quoted 2 lines
qapi-schema.json +0
-0@@ -523,6 +523,9 @@ # minimize migration traffic. The feature is disabled by default. # (since 2.4 )
Copying from pre-existing...
qapi-schema.json line 527
Quoted 3 lines
qapi-schema.json +2
-0# +# @events: generate events for each migration state change +# (since 2.4 )
...but the space before ) looks odd. A trivial followup patch may be in order, but no need to hold up 2.4 for it.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org