Skip to content

Commit

Permalink
qmp/hmp: Add throttle ratio to query-migrate and info migrate
Browse files Browse the repository at this point in the history
Report throttle percentage in info migrate and query-migrate responses when
cpu throttling is active.

Signed-off-by: Jason J. Herne <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Signed-off-by: Juan Quintela <[email protected]>
Reviewed-by: Juan Quintela <[email protected]>
  • Loading branch information
Jason J. Herne authored and Juan Quintela committed Sep 30, 2015
1 parent 070afca commit 4782893
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions hmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict)
info->xbzrle_cache->overflow);
}

if (info->has_x_cpu_throttle_percentage) {
monitor_printf(mon, "cpu throttle percentage: %" PRIu64 "\n",
info->x_cpu_throttle_percentage);
}

qapi_free_MigrationInfo(info);
qapi_free_MigrationCapabilityStatusList(caps);
}
Expand Down
5 changes: 5 additions & 0 deletions migration/migration.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,11 @@ MigrationInfo *qmp_query_migrate(Error **errp)
info->disk->total = blk_mig_bytes_total();
}

if (cpu_throttle_active()) {
info->has_x_cpu_throttle_percentage = true;
info->x_cpu_throttle_percentage = cpu_throttle_get_percentage();
}

get_xbzrle_cache_stats(info);
break;
case MIGRATION_STATUS_COMPLETED:
Expand Down
7 changes: 6 additions & 1 deletion qapi-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,10 @@
# may be expensive, but do not actually occur during the iterative
# migration rounds themselves. (since 1.6)
#
# @x-cpu-throttle-percentage: #optional percentage of time guest cpus are being
# throttled during auto-converge. This is only present when auto-converge
# has started throttling guest cpus. (Since 2.5)
#
# Since: 0.14.0
##
{ 'struct': 'MigrationInfo',
Expand All @@ -489,7 +493,8 @@
'*total-time': 'int',
'*expected-downtime': 'int',
'*downtime': 'int',
'*setup-time': 'int'} }
'*setup-time': 'int',
'*x-cpu-throttle-percentage': 'int'} }

##
# @query-migrate
Expand Down

0 comments on commit 4782893

Please sign in to comment.