libvirt-python passes parameter bandwidth = 0
by default. This means that bandwidth is unlimited.
VZ driver doesn't support bandwidth rate limiting,
but we still need to handle it and fail if bandwidth > 0.
Signed-off-by: Pavel Glushchak <pglushchak(a)virtuozzo.com>
---
src/vz/vz_driver.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index 7a12632..4a0068c 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -2897,6 +2897,7 @@ vzEatCookie(const char *cookiein, int cookieinlen, unsigned int
flags)
VIR_MIGRATE_PARAM_DEST_XML, VIR_TYPED_PARAM_STRING, \
VIR_MIGRATE_PARAM_URI, VIR_TYPED_PARAM_STRING, \
VIR_MIGRATE_PARAM_DEST_NAME, VIR_TYPED_PARAM_STRING, \
+ VIR_MIGRATE_PARAM_BANDWIDTH, VIR_TYPED_PARAM_ULLONG, \
NULL
static char *
@@ -2938,12 +2939,23 @@ vzDomainMigrateBegin3Params(virDomainPtr domain,
char *xml = NULL;
virDomainObjPtr dom = NULL;
vzConnPtr privconn = domain->conn->privateData;
+ unsigned long long bandwidth = 0;
virCheckFlags(VZ_MIGRATION_FLAGS, NULL);
if (virTypedParamsValidate(params, nparams, VZ_MIGRATION_PARAMETERS) < 0)
goto cleanup;
+ if (virTypedParamsGetULLong(params, nparams, VIR_MIGRATE_PARAM_BANDWIDTH,
+ &bandwidth) < 0)
+ goto cleanup;
+
+ if (bandwidth > 0) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("Bandwidth rate limiting is not supported"));
+ goto cleanup;
+ }
+
if (!(dom = vzDomObjFromDomain(domain)))
goto cleanup;
--
2.7.4