qemuMonitorMigrationParams is a better name for a structure which contains various migration parameters. While doing that, we should use full names for individual parameters. Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx> --- src/qemu/qemu_migration.c | 16 ++++++++-------- src/qemu/qemu_monitor.c | 25 ++++++++++++++----------- src/qemu/qemu_monitor.h | 27 ++++++++++++++------------- src/qemu/qemu_monitor_json.c | 32 ++++++++++++++++---------------- src/qemu/qemu_monitor_json.h | 8 ++++---- tests/qemumonitorjsontest.c | 28 ++++++++++++++-------------- 6 files changed, 70 insertions(+), 66 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index ec2b3dd..433c00c 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -3436,7 +3436,7 @@ qemuMigrationSetCompression(virQEMUDriverPtr driver, { int ret = -1; qemuDomainObjPrivatePtr priv = vm->privateData; - qemuMonitorMigrationCompression params = { 0 }; + qemuMonitorMigrationParams migParams = { 0 }; if (qemuMigrationSetOption(driver, vm, QEMU_MONITOR_MIGRATION_CAPS_XBZRLE, @@ -3455,16 +3455,16 @@ qemuMigrationSetCompression(virQEMUDriverPtr driver, if (qemuDomainObjEnterMonitorAsync(driver, vm, job) < 0) return -1; - params.level_set = compression->level_set; - params.level = compression->level; + migParams.compressLevel_set = compression->level_set; + migParams.compressLevel = compression->level; - params.threads_set = compression->threads_set; - params.threads = compression->threads; + migParams.compressThreads_set = compression->threads_set; + migParams.compressThreads = compression->threads; - params.dthreads_set = compression->dthreads_set; - params.dthreads = compression->dthreads; + migParams.decompressThreads_set = compression->dthreads_set; + migParams.decompressThreads = compression->dthreads; - if (qemuMonitorSetMigrationCompression(priv->mon, ¶ms) < 0) + if (qemuMonitorSetMigrationParams(priv->mon, &migParams) < 0) goto cleanup; if (compression->xbzrle_cache_set && diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index f7609e9..2862cbc 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2160,29 +2160,32 @@ qemuMonitorSetMigrationCacheSize(qemuMonitorPtr mon, int -qemuMonitorGetMigrationCompression(qemuMonitorPtr mon, - qemuMonitorMigrationCompressionPtr compress) +qemuMonitorGetMigrationParams(qemuMonitorPtr mon, + qemuMonitorMigrationParamsPtr params) { QEMU_CHECK_MONITOR_JSON(mon); - return qemuMonitorJSONGetMigrationCompression(mon, compress); + return qemuMonitorJSONGetMigrationParams(mon, params); } int -qemuMonitorSetMigrationCompression(qemuMonitorPtr mon, - qemuMonitorMigrationCompressionPtr compress) +qemuMonitorSetMigrationParams(qemuMonitorPtr mon, + qemuMonitorMigrationParamsPtr params) { - VIR_DEBUG("level=%d threads=%d dthreads=%d", - compress->level, compress->threads, compress->dthreads); + VIR_DEBUG("compressLevel=%d:%d compressThreads=%d:%d " + "decompressThreads=%d:%d", + params->compressLevel_set, params->compressLevel, + params->compressThreads_set, params->compressThreads, + params->decompressThreads_set, params->decompressThreads); QEMU_CHECK_MONITOR_JSON(mon); - if (!compress->level_set && - !compress->threads_set && - !compress->dthreads_set) + if (!params->compressLevel_set && + !params->compressThreads_set && + !params->decompressThreads_set) return 0; - return qemuMonitorJSONSetMigrationCompression(mon, compress); + return qemuMonitorJSONSetMigrationParams(mon, params); } diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index dd3587f..28cffc9 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -485,22 +485,23 @@ int qemuMonitorGetMigrationCacheSize(qemuMonitorPtr mon, int qemuMonitorSetMigrationCacheSize(qemuMonitorPtr mon, unsigned long long cacheSize); -typedef struct _qemuMonitorMigrationCompression qemuMonitorMigrationCompression; -typedef qemuMonitorMigrationCompression *qemuMonitorMigrationCompressionPtr; -struct _qemuMonitorMigrationCompression { - bool level_set; - bool threads_set; - bool dthreads_set; +typedef struct _qemuMonitorMigrationParams qemuMonitorMigrationParams; +typedef qemuMonitorMigrationParams *qemuMonitorMigrationParamsPtr; +struct _qemuMonitorMigrationParams { + bool compressLevel_set; + int compressLevel; - int level; - int threads; - int dthreads; + bool compressThreads_set; + int compressThreads; + + bool decompressThreads_set; + int decompressThreads; }; -int qemuMonitorGetMigrationCompression(qemuMonitorPtr mon, - qemuMonitorMigrationCompressionPtr compress); -int qemuMonitorSetMigrationCompression(qemuMonitorPtr mon, - qemuMonitorMigrationCompressionPtr compress); +int qemuMonitorGetMigrationParams(qemuMonitorPtr mon, + qemuMonitorMigrationParamsPtr params); +int qemuMonitorSetMigrationParams(qemuMonitorPtr mon, + qemuMonitorMigrationParamsPtr params); typedef enum { QEMU_MONITOR_MIGRATION_STATUS_INACTIVE, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 380ddab..eea32ab 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2529,8 +2529,8 @@ qemuMonitorJSONSetMigrationCacheSize(qemuMonitorPtr mon, int -qemuMonitorJSONGetMigrationCompression(qemuMonitorPtr mon, - qemuMonitorMigrationCompressionPtr compress) +qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon, + qemuMonitorMigrationParamsPtr params) { int ret = -1; virJSONValuePtr result; @@ -2549,31 +2549,31 @@ qemuMonitorJSONGetMigrationCompression(qemuMonitorPtr mon, result = virJSONValueObjectGet(reply, "return"); if (virJSONValueObjectGetNumberInt(result, "compress-level", - &compress->level) < 0) { + ¶ms->compressLevel) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("malformed/missing compress-level " "in migrate parameters")); goto cleanup; } - compress->level_set = true; + params->compressLevel_set = true; if (virJSONValueObjectGetNumberInt(result, "compress-threads", - &compress->threads) < 0) { + ¶ms->compressThreads) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("malformed/missing compress-threads " "in migrate parameters")); goto cleanup; } - compress->threads_set = true; + params->compressThreads_set = true; if (virJSONValueObjectGetNumberInt(result, "decompress-threads", - &compress->dthreads) < 0) { + ¶ms->decompressThreads) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("malformed/missing decompress-threads " "in migrate parameters")); goto cleanup; } - compress->dthreads_set = true; + params->decompressThreads_set = true; ret = 0; cleanup: @@ -2583,8 +2583,8 @@ qemuMonitorJSONGetMigrationCompression(qemuMonitorPtr mon, } int -qemuMonitorJSONSetMigrationCompression(qemuMonitorPtr mon, - qemuMonitorMigrationCompressionPtr compress) +qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon, + qemuMonitorMigrationParamsPtr params) { int ret = -1; virJSONValuePtr cmd = NULL; @@ -2601,19 +2601,19 @@ qemuMonitorJSONSetMigrationCompression(qemuMonitorPtr mon, if (!(args = virJSONValueNewObject())) goto cleanup; - if (compress->level_set && + if (params->compressLevel_set && virJSONValueObjectAppendNumberInt(args, "compress-level", - compress->level) < 0) + params->compressLevel) < 0) goto cleanup; - if (compress->threads_set && + if (params->compressThreads_set && virJSONValueObjectAppendNumberInt(args, "compress-threads", - compress->threads) < 0) + params->compressThreads) < 0) goto cleanup; - if (compress->dthreads_set && + if (params->decompressThreads_set && virJSONValueObjectAppendNumberInt(args, "decompress-threads", - compress->dthreads) < 0) + params->decompressThreads) < 0) goto cleanup; if (virJSONValueObjectAppend(cmd, "arguments", args) < 0) diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 586a363..37a739e 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -131,10 +131,10 @@ int qemuMonitorJSONGetMigrationCacheSize(qemuMonitorPtr mon, int qemuMonitorJSONSetMigrationCacheSize(qemuMonitorPtr mon, unsigned long long cacheSize); -int qemuMonitorJSONGetMigrationCompression(qemuMonitorPtr mon, - qemuMonitorMigrationCompressionPtr compress); -int qemuMonitorJSONSetMigrationCompression(qemuMonitorPtr mon, - qemuMonitorMigrationCompressionPtr compress); +int qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon, + qemuMonitorMigrationParamsPtr params); +int qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon, + qemuMonitorMigrationParamsPtr params); int qemuMonitorJSONGetMigrationStats(qemuMonitorPtr mon, qemuMonitorMigrationStatsPtr stats); diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 0bcf62a..d0b5d9e 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1616,11 +1616,11 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockStatsInfo(const void *data) } static int -testQemuMonitorJSONqemuMonitorJSONGetMigrationCompression(const void *data) +testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data) { virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data; qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt); - qemuMonitorMigrationCompression compress; + qemuMonitorMigrationParams params; int ret = -1; if (!test) @@ -1637,34 +1637,34 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationCompression(const void *data) goto cleanup; } - if (qemuMonitorJSONGetMigrationCompression(qemuMonitorTestGetMonitor(test), - &compress) < 0) + if (qemuMonitorJSONGetMigrationParams(qemuMonitorTestGetMonitor(test), + ¶ms) < 0) goto cleanup; - if (!compress.level_set || - !compress.threads_set || - !compress.dthreads_set) { + if (!params.compressLevel_set || + !params.compressThreads_set || + !params.decompressThreads_set) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", "One of level, threads or dthreads flags is not set"); return -1; } - if (compress.level != 1) { + if (params.compressLevel != 1) { virReportError(VIR_ERR_INTERNAL_ERROR, "Invalid decompress-threads: %d, expected 1", - compress.level); + params.compressLevel); goto cleanup; } - if (compress.threads != 8) { + if (params.compressThreads != 8) { virReportError(VIR_ERR_INTERNAL_ERROR, "Invalid decompress-threads: %d, expected 8", - compress.threads); + params.compressThreads); goto cleanup; } - if (compress.dthreads != 2) { + if (params.decompressThreads != 2) { virReportError(VIR_ERR_INTERNAL_ERROR, "Invalid decompress-threads: %d, expected 2", - compress.dthreads); + params.decompressThreads); goto cleanup; } ret = 0; @@ -2416,7 +2416,7 @@ mymain(void) DO_TEST(qemuMonitorJSONGetBlockInfo); DO_TEST(qemuMonitorJSONGetBlockStatsInfo); DO_TEST(qemuMonitorJSONGetMigrationCacheSize); - DO_TEST(qemuMonitorJSONGetMigrationCompression); + DO_TEST(qemuMonitorJSONGetMigrationParams); DO_TEST(qemuMonitorJSONGetMigrationStats); DO_TEST(qemuMonitorJSONGetChardevInfo); DO_TEST(qemuMonitorJSONSetBlockIoThrottle); -- 2.9.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list