1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

qemu: Add support for cpu throttling parameters

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiri Denemark 2016-06-20 17:10:32 +02:00
parent 8d58952bed
commit abaa11006f
4 changed files with 23 additions and 4 deletions

View File

@ -2173,16 +2173,21 @@ qemuMonitorSetMigrationParams(qemuMonitorPtr mon,
qemuMonitorMigrationParamsPtr params)
{
VIR_DEBUG("compressLevel=%d:%d compressThreads=%d:%d "
"decompressThreads=%d:%d",
"decompressThreads=%d:%d cpuThrottleInitial=%d:%d "
"cpuThrottleIncrement=%d:%d",
params->compressLevel_set, params->compressLevel,
params->compressThreads_set, params->compressThreads,
params->decompressThreads_set, params->decompressThreads);
params->decompressThreads_set, params->decompressThreads,
params->cpuThrottleInitial_set, params->cpuThrottleInitial,
params->cpuThrottleIncrement_set, params->cpuThrottleIncrement);
QEMU_CHECK_MONITOR_JSON(mon);
if (!params->compressLevel_set &&
!params->compressThreads_set &&
!params->decompressThreads_set)
!params->decompressThreads_set &&
!params->cpuThrottleInitial_set &&
!params->cpuThrottleIncrement_set)
return 0;
return qemuMonitorJSONSetMigrationParams(mon, params);

View File

@ -496,6 +496,12 @@ struct _qemuMonitorMigrationParams {
bool decompressThreads_set;
int decompressThreads;
bool cpuThrottleInitial_set;
int cpuThrottleInitial;
bool cpuThrottleIncrement_set;
int cpuThrottleIncrement;
};
int qemuMonitorGetMigrationParams(qemuMonitorPtr mon,

View File

@ -2560,6 +2560,8 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon,
PARSE(compressLevel, "compress-level");
PARSE(compressThreads, "compress-threads");
PARSE(decompressThreads, "decompress-threads");
PARSE(cpuThrottleInitial, "cpu-throttle-initial");
PARSE(cpuThrottleIncrement, "cpu-throttle-increment");
#undef PARSE
@ -2600,6 +2602,8 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon,
APPEND(compressLevel, "compress-level");
APPEND(compressThreads, "compress-threads");
APPEND(decompressThreads, "decompress-threads");
APPEND(cpuThrottleInitial, "cpu-throttle-initial");
APPEND(cpuThrottleIncrement, "cpu-throttle-increment");
#undef APPEND

View File

@ -1630,8 +1630,10 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data)
"{"
" \"return\": {"
" \"decompress-threads\": 2,"
" \"cpu-throttle-increment\": 10,"
" \"compress-threads\": 8,"
" \"compress-level\": 1"
" \"compress-level\": 1,"
" \"cpu-throttle-initial\": 20"
" }"
"}") < 0) {
goto cleanup;
@ -1658,6 +1660,8 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data)
CHECK(compressLevel, "compress-level", 1);
CHECK(compressThreads, "compress-threads", 8);
CHECK(decompressThreads, "decompress-threads", 2);
CHECK(cpuThrottleInitial, "cpu-throttle-initial", 20);
CHECK(cpuThrottleIncrement, "cpu-throttle-increment", 10);
#undef CHECK