From f6e2a70ae2c9b9e9452c1e88f15b8beda178aa4a Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Thu, 26 Oct 2017 20:47:16 +0200 Subject: [PATCH] qemu: Add support for max-bandwidth migration parameter We already support several ways of setting migration bandwidth and this is not adding another one. With this patch we are able to read and write this parameter using query-migrate-parameters and migrate-set-parameters in one call with all other parameters. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_monitor.c | 3 ++- src/qemu/qemu_monitor.h | 3 +++ src/qemu/qemu_monitor_json.c | 2 ++ tests/qemumonitorjsontest.c | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 3e2c69a9ab..04b18baf9c 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2607,13 +2607,14 @@ qemuMonitorSetMigrationParams(qemuMonitorPtr mon, VIR_DEBUG("compressLevel=%d:%d compressThreads=%d:%d " "decompressThreads=%d:%d cpuThrottleInitial=%d:%d " "cpuThrottleIncrement=%d:%d tlsCreds=%s tlsHostname=%s " - "downtimeLimit=%d:%llu", + "maxBandwidth=%d:%llu downtimeLimit=%d:%llu", params->compressLevel_set, params->compressLevel, params->compressThreads_set, params->compressThreads, params->decompressThreads_set, params->decompressThreads, params->cpuThrottleInitial_set, params->cpuThrottleInitial, params->cpuThrottleIncrement_set, params->cpuThrottleIncrement, NULLSTR(params->tlsCreds), NULLSTR(params->tlsHostname), + params->maxBandwidth_set, params->maxBandwidth, params->downtimeLimit_set, params->downtimeLimit); QEMU_CHECK_MONITOR_JSON(mon); diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index e123baaaea..7836dd3322 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -628,6 +628,9 @@ struct _qemuMonitorMigrationParams { char *tlsCreds; char *tlsHostname; + bool maxBandwidth_set; + unsigned long long maxBandwidth; + bool downtimeLimit_set; unsigned long long downtimeLimit; }; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 9f238bc30b..115610e50e 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2706,6 +2706,7 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon, PARSE_INT(cpuThrottleIncrement, "cpu-throttle-increment"); PARSE_STR(tlsCreds, "tls-creds"); PARSE_STR(tlsHostname, "tls-hostname"); + PARSE_ULONG(maxBandwidth, "max-bandwidth"); PARSE_ULONG(downtimeLimit, "downtime-limit"); #undef PARSE_SET @@ -2764,6 +2765,7 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon, APPEND_INT(cpuThrottleIncrement, "cpu-throttle-increment"); APPEND_STR(tlsCreds, "tls-creds"); APPEND_STR(tlsHostname, "tls-hostname"); + APPEND_ULONG(maxBandwidth, "max-bandwidth"); APPEND_ULONG(downtimeLimit, "downtime-limit"); #undef APPEND diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index aa5da8be98..488c79cc33 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1804,6 +1804,7 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data) " \"cpu-throttle-initial\": 20," " \"tls-creds\": \"tls0\"," " \"tls-hostname\": \"\"," + " \"max-bandwidth\": 1234567890," " \"downtime-limit\": 500" " }" "}") < 0) { @@ -1855,6 +1856,7 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data) CHECK_INT(cpuThrottleIncrement, "cpu-throttle-increment", 10); CHECK_STR(tlsCreds, "tls-creds", "tls0"); CHECK_STR(tlsHostname, "tls-hostname", ""); + CHECK_ULONG(maxBandwidth, "max-bandwidth", 1234567890ULL); CHECK_ULONG(downtimeLimit, "downtime-limit", 500ULL); #undef CHECK_NUM -- GitLab