vz: added VIR_MIGRATE_PARAM_BANDWIDTH param handling

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@virtuozzo.com>
This commit is contained in:
Pavel Glushchak 2016-08-25 17:00:25 +03:00 committed by Maxim Nestratov
parent d7af2218b6
commit 2354266acf

View File

@ -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;