ram: Print block stats also in the complete case

Once there, create populate_disk_info.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>

--

- create populate_disk_info instead of "abusing" populate_ram_info
This commit is contained in:
Juan Quintela 2017-05-04 10:21:46 +02:00
parent 250561e1ae
commit 930ac04c22

View File

@ -627,6 +627,17 @@ static void populate_ram_info(MigrationInfo *info, MigrationState *s)
} }
} }
static void populate_disk_info(MigrationInfo *info)
{
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();
}
}
MigrationInfo *qmp_query_migrate(Error **errp) MigrationInfo *qmp_query_migrate(Error **errp)
{ {
MigrationInfo *info = g_malloc0(sizeof(*info)); MigrationInfo *info = g_malloc0(sizeof(*info));
@ -652,15 +663,7 @@ MigrationInfo *qmp_query_migrate(Error **errp)
info->setup_time = s->setup_time; info->setup_time = s->setup_time;
populate_ram_info(info, s); populate_ram_info(info, s);
populate_disk_info(info);
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; break;
case MIGRATION_STATUS_POSTCOPY_ACTIVE: case MIGRATION_STATUS_POSTCOPY_ACTIVE:
/* Mostly the same as active; TODO add some postcopy stats */ /* Mostly the same as active; TODO add some postcopy stats */
@ -674,15 +677,7 @@ MigrationInfo *qmp_query_migrate(Error **errp)
info->setup_time = s->setup_time; info->setup_time = s->setup_time;
populate_ram_info(info, s); populate_ram_info(info, s);
populate_disk_info(info);
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; break;
case MIGRATION_STATUS_COLO: case MIGRATION_STATUS_COLO:
info->has_status = true; info->has_status = true;