Make info migrate output consistent
cover Make info migrate output consistent
Hi
This series make the output of info migrate be printed in a single place for the states ACTIVE, CANCELLING and POSTCOPY_ACTIVE.
The code was duplicated, just use the same code. Once done that, fix the inconsistences that were not needed.
Please, review.
Thanks, Juan.
Juan Quintela (4):
ram: Unfold get_xbzrle_cache_stats() into populate_ram_info()
ram: We only print throttling information sometimes
ram: Print block stats also in the complete case
ram: Now POSTCOPY_ACTIVE is the same that STATUS_ACTIVE
migration/migration.c | 77 ++++++++++++++++----------------------------------- 1 file changed, 24 insertions(+), 53 deletions(-)
Signature · 1 line
2.9.4
PATCH 1/4 ram: Unfold get_xbzrle_cache_stats() into populate_ram_info()
They were called consequtiveley always.
--- migration/migration.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-)
migration/migration.c +11 -18
@@ -476,20 +476,6 @@ static bool migration_is_setup_or_active(int state) } } -static void get_xbzrle_cache_stats (MigrationInfo *info) -{ -if (migrate_use_xbzrle ()) { - info->has_xbzrle_cache = true; - info->xbzrle_cache =g_malloc0 (sizeof (*info->xbzrle_cache)); - info->xbzrle_cache->cache_size =migrate_xbzrle_cache_size (); - info->xbzrle_cache->bytes =xbzrle_mig_bytes_transferred (); - info->xbzrle_cache->pages =xbzrle_mig_pages_transferred (); - info->xbzrle_cache->cache_miss =xbzrle_mig_pages_cache_miss (); - info->xbzrle_cache->cache_miss_rate =xbzrle_mig_cache_miss_rate (); - info->xbzrle_cache->overflow =xbzrle_mig_pages_overflow (); - } -} -static void populate_ram_info (MigrationInfo *info,MigrationState *s) { info->has_ram = true;
@@ -507,6 +493,17 @@ static void populate_ram_info(MigrationInfo *info, MigrationState *s) info->ram->postcopy_requests =ram_postcopy_requests (); info->ram->page_size =qemu_target_page_size (); +if (migrate_use_xbzrle ()) { + info->has_xbzrle_cache = true; + info->xbzrle_cache =g_malloc0 (sizeof (*info->xbzrle_cache)); + info->xbzrle_cache->cache_size =migrate_xbzrle_cache_size (); + info->xbzrle_cache->bytes =xbzrle_mig_bytes_transferred (); + info->xbzrle_cache->pages =xbzrle_mig_pages_transferred (); + info->xbzrle_cache->cache_miss =xbzrle_mig_pages_cache_miss (); + info->xbzrle_cache->cache_miss_rate =xbzrle_mig_cache_miss_rate (); + info->xbzrle_cache->overflow =xbzrle_mig_pages_overflow (); + } +if (s->state !=MIGRATION_STATUS_COMPLETED ) { info->ram->remaining =ram_bytes_remaining (); info->ram->dirty_pages_rate =ram_dirty_pages_rate ();
@@ -552,7 +549,6 @@ MigrationInfo *qmp_query_migrate(Error **errp) info->cpu_throttle_percentage =cpu_throttle_get_percentage (); } -get_xbzrle_cache_stats (info);break ;case MIGRATION_STATUS_POSTCOPY_ACTIVE :/* Mostly the same as active; TODO add some postcopy stats */
@@ -575,15 +571,12 @@ MigrationInfo *qmp_query_migrate(Error **errp) info->disk->total =blk_mig_bytes_total (); } -get_xbzrle_cache_stats (info);break ;case MIGRATION_STATUS_COLO : info->has_status = true;/* TODO: display COLO specific information (checkpoint info etc.) */ break ;case MIGRATION_STATUS_COMPLETED : -get_xbzrle_cache_stats (info); - info->has_status = true; info->has_total_time = true; info->total_time = s->total_time;
Signature · 1 line
2.9.4
Re: [Qemu-devel] [PATCH 1/4] ram: Unfold get_xbzrle_cache_stats() into populate_ram_info()
Quoted 1 line · Juan Quintela
They were called consequtiveley always.
s/consequtiveley/consecutively/
Quoted 6 lines
Signed-off-by Juan Quintela <[email protected]>--- migration/migration.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
PATCH 2/4 ram: We only print throttling information sometimes
In reply to Juan QuintelaChange it to be consistent with everything else.
--- migration/migration.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
migration/migration.c +5 -5
@@ -504,6 +504,11 @@ static void populate_ram_info(MigrationInfo *info, MigrationState *s) info->xbzrle_cache->overflow =xbzrle_mig_pages_overflow (); } +if (cpu_throttle_active ()) { + info->has_cpu_throttle_percentage = true; + info->cpu_throttle_percentage =cpu_throttle_get_percentage (); + } +if (s->state !=MIGRATION_STATUS_COMPLETED ) { info->ram->remaining =ram_bytes_remaining (); info->ram->dirty_pages_rate =ram_dirty_pages_rate ();
@@ -544,11 +549,6 @@ MigrationInfo *qmp_query_migrate(Error **errp) info->disk->total =blk_mig_bytes_total (); } -if (cpu_throttle_active ()) { - info->has_cpu_throttle_percentage = true; - info->cpu_throttle_percentage =cpu_throttle_get_percentage (); - } -break ;case MIGRATION_STATUS_POSTCOPY_ACTIVE :/* Mostly the same as active; TODO add some postcopy stats */
Signature · 1 line
2.9.4
Re: [Qemu-devel] [PATCH 2/4] ram: We only print throttling information sometimes
Quoted 6 lines · Juan Quintela
Change it to be consistent with everything else.
Signed-off-by Juan Quintela <[email protected]>--- migration/migration.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
PATCH 3/4 ram: Print block stats also in the complete case
In reply to Juan QuintelaTo make things easier, I just moved it to populate_ram_info().
--- migration/migration.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-)
migration/migration.c +8 -18
@@ -509,6 +509,14 @@ static void populate_ram_info(MigrationInfo *info, MigrationState *s) info->cpu_throttle_percentage =cpu_throttle_get_percentage (); } +if (blk_mig_active ()) { + info->has_disk = true; + info->disk =g_malloc0 (sizeof (*info->disk)); + info->disk->transferred =blk_mig_bytes_transferred (); + info->disk->remaining =blk_mig_bytes_remaining (); + info->disk->total =blk_mig_bytes_total (); + } +if (s->state !=MIGRATION_STATUS_COMPLETED ) { info->ram->remaining =ram_bytes_remaining (); info->ram->dirty_pages_rate =ram_dirty_pages_rate ();
@@ -540,15 +548,6 @@ MigrationInfo *qmp_query_migrate(Error **errp) info->setup_time = s->setup_time;populate_ram_info (info, s); - -if (blk_mig_active ()) { - info->has_disk = true; - info->disk =g_malloc0 (sizeof (*info->disk)); - info->disk->transferred =blk_mig_bytes_transferred (); - info->disk->remaining =blk_mig_bytes_remaining (); - info->disk->total =blk_mig_bytes_total (); - } -break ;case MIGRATION_STATUS_POSTCOPY_ACTIVE :/* Mostly the same as active; TODO add some postcopy stats */
@@ -562,15 +561,6 @@ MigrationInfo *qmp_query_migrate(Error **errp) info->setup_time = s->setup_time;populate_ram_info (info, s); - -if (blk_mig_active ()) { - info->has_disk = true; - info->disk =g_malloc0 (sizeof (*info->disk)); - info->disk->transferred =blk_mig_bytes_transferred (); - info->disk->remaining =blk_mig_bytes_remaining (); - info->disk->total =blk_mig_bytes_total (); - } -break ;case MIGRATION_STATUS_COLO : info->has_status = true;
Signature · 1 line
2.9.4
Re: [Qemu-devel] [PATCH 3/4] ram: Print block stats also in the complete case
Quoted 7 lines · Juan Quintela
To make things easier, I just moved it to
populate_ram_info().Signed-off-by Juan Quintela <[email protected]>--- migration/migration.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH 3/4] ram: Print block stats also in the complete case
In reply to Juan QuintelaQuoted 1 line · * Juan Quintela ([email protected]) wrote:
To make things easier, I just moved it to
populate_ram_info().
Blk is not RAM; better to create a separate function.
Dave
Quoted 59 lines
Signed-off-by Juan Quintela <[email protected]>--- migration/migration.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-)migration/migration.c +8
-18@@ -509,6 +509,14 @@ static void populate_ram_info(MigrationInfo *info, MigrationState *s) info->cpu_throttle_percentage =cpu_throttle_get_percentage (); } +if (blk_mig_active ()) { + info->has_disk = true; + info->disk =g_malloc0 (sizeof (*info->disk)); + info->disk->transferred =blk_mig_bytes_transferred (); + info->disk->remaining =blk_mig_bytes_remaining (); + info->disk->total =blk_mig_bytes_total (); + } +if (s->state !=MIGRATION_STATUS_COMPLETED ) { info->ram->remaining =ram_bytes_remaining (); info->ram->dirty_pages_rate =ram_dirty_pages_rate ();@@ -540,15 +548,6 @@ MigrationInfo *qmp_query_migrate(Error **errp) info->setup_time = s->setup_time;populate_ram_info (info, s); - -if (blk_mig_active ()) { - info->has_disk = true; - info->disk =g_malloc0 (sizeof (*info->disk)); - info->disk->transferred =blk_mig_bytes_transferred (); - info->disk->remaining =blk_mig_bytes_remaining (); - info->disk->total =blk_mig_bytes_total (); - } -break ;case MIGRATION_STATUS_POSTCOPY_ACTIVE :/* Mostly the same as active; TODO add some postcopy stats */ @@ -562,15 +561,6 @@ MigrationInfo *qmp_query_migrate(Error **errp) info->setup_time = s->setup_time;populate_ram_info (info, s); - -if (blk_mig_active ()) { - info->has_disk = true; - info->disk =g_malloc0 (sizeof (*info->disk)); - info->disk->transferred =blk_mig_bytes_transferred (); - info->disk->remaining =blk_mig_bytes_remaining (); - info->disk->total =blk_mig_bytes_total (); - } -break ;case MIGRATION_STATUS_COLO : info->has_status = true;Signature · 1 line
2.9.4
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Re: [Qemu-devel] [PATCH 3/4] ram: Print block stats also in the complete case
Quoted 4 lines · Dr. David Alan Gilbert
Quoted 1 line · * Juan Quintela ([email protected]) wrote:
To make things easier, I just moved it to
populate_ram_info().Blk is not RAM; better to create a separate function.
Agree...
Maybe rename populate_ram_info() into more general name? migrate_info_populate()?
(Also, I think auto convergence is not RAM-related as well, so same
comment may apply to patch 2)
Thanks,
Quoted 64 lines
Dave
Quoted 59 lines
Signed-off-by Juan Quintela <[email protected]>--- migration/migration.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-)migration/migration.c +8
-18@@ -509,6 +509,14 @@ static void populate_ram_info(MigrationInfo *info, MigrationState *s) info->cpu_throttle_percentage =cpu_throttle_get_percentage (); } +if (blk_mig_active ()) { + info->has_disk = true; + info->disk =g_malloc0 (sizeof (*info->disk)); + info->disk->transferred =blk_mig_bytes_transferred (); + info->disk->remaining =blk_mig_bytes_remaining (); + info->disk->total =blk_mig_bytes_total (); + } +if (s->state !=MIGRATION_STATUS_COMPLETED ) { info->ram->remaining =ram_bytes_remaining (); info->ram->dirty_pages_rate =ram_dirty_pages_rate ();@@ -540,15 +548,6 @@ MigrationInfo *qmp_query_migrate(Error **errp) info->setup_time = s->setup_time;populate_ram_info (info, s); - -if (blk_mig_active ()) { - info->has_disk = true; - info->disk =g_malloc0 (sizeof (*info->disk)); - info->disk->transferred =blk_mig_bytes_transferred (); - info->disk->remaining =blk_mig_bytes_remaining (); - info->disk->total =blk_mig_bytes_total (); - } -break ;case MIGRATION_STATUS_POSTCOPY_ACTIVE :/* Mostly the same as active; TODO add some postcopy stats */ @@ -562,15 +561,6 @@ MigrationInfo *qmp_query_migrate(Error **errp) info->setup_time = s->setup_time;populate_ram_info (info, s); - -if (blk_mig_active ()) { - info->has_disk = true; - info->disk =g_malloc0 (sizeof (*info->disk)); - info->disk->transferred =blk_mig_bytes_transferred (); - info->disk->remaining =blk_mig_bytes_remaining (); - info->disk->total =blk_mig_bytes_total (); - } -break ;case MIGRATION_STATUS_COLO : info->has_status = true;Signature · 1 line
2.9.4--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Signature · 1 line
Peter Xu
PATCH 4/4 ram: Now POSTCOPY_ACTIVE is the same that STATUS_ACTIVE
In reply to Juan QuintelaMerge them.
--- migration/migration.c | 12 ------------ 1 file changed, 12 deletions(-)
migration/migration.c +0 -12
@@ -538,19 +538,7 @@ MigrationInfo *qmp_query_migrate(Error **errp)break ;case MIGRATION_STATUS_ACTIVE :case MIGRATION_STATUS_CANCELLING : - info->has_status = true; - info->has_total_time = true; - info->total_time =qemu_clock_get_ms (QEMU_CLOCK_REALTIME ) - - s->total_time; - info->has_expected_downtime = true; - info->expected_downtime = s->expected_downtime; - info->has_setup_time = true; - info->setup_time = s->setup_time; - -populate_ram_info (info, s); -break ;case MIGRATION_STATUS_POSTCOPY_ACTIVE : -/* Mostly the same as active; TODO add some postcopy stats */ info->has_status = true; info->has_total_time = true; info->total_time =qemu_clock_get_ms (QEMU_CLOCK_REALTIME )
Signature · 1 line
2.9.4
Re: [Qemu-devel] [PATCH 4/4] ram: Now POSTCOPY_ACTIVE is the same that STATUS_ACTIVE
Quoted 6 lines · Juan Quintela
Merge them.
Signed-off-by Juan Quintela <[email protected]>--- migration/migration.c | 12 ------------ 1 file changed, 12 deletions(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org