From nobody Tue Apr 23 15:04:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549380232905523.389880460518; Tue, 5 Feb 2019 07:23:52 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8D14B7F3E7; Tue, 5 Feb 2019 15:23:50 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3D46E87C4B; Tue, 5 Feb 2019 15:23:50 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D650B18033A3; Tue, 5 Feb 2019 15:23:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x15FNJDS008368 for ; Tue, 5 Feb 2019 10:23:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id C085469314; Tue, 5 Feb 2019 15:23:19 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9519871D4B for ; Tue, 5 Feb 2019 15:23:17 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id D871B1011C7; Tue, 5 Feb 2019 16:23:12 +0100 (CET) From: Jiri Denemark To: libvir-list@redhat.com Date: Tue, 5 Feb 2019 16:23:08 +0100 Message-Id: <90a1b64b2fc820f03feac0a8e06e3b81fcbba833.1549380136.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/8] Public API for post-copy migration bandwidth X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 05 Feb 2019 15:23:51 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This patch adds a new VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY typed parameter for virDomainMigrate3 and virDomainMigrateToURI3 for setting maximum post-copy migration bandwidth. In case the initial VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY value turns out to be suboptimal a new VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY flag for virDomainMigrateSetMaxSpeed and virDomainMigrateGetMaxSpeed may be used to set/get the maximum post-copy migration bandwidth while migration is already running. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- include/libvirt/libvirt-domain.h | 15 +++++++++++++++ src/libvirt-domain.c | 11 ++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 0388911ded..d99f9b690b 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -903,6 +903,15 @@ typedef enum { */ # define VIR_MIGRATE_PARAM_BANDWIDTH "bandwidth" =20 +/** + * VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY: + * + * virDomainMigrate* params field: the maximum bandwidth (in MiB/s) that w= ill + * be used for post-copy phase of a migration as VIR_TYPED_PARAM_ULLONG. I= f set + * to 0 or omitted, post-copy migration speed will not be limited. + */ +# define VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY "bandwidth.postcopy" + /** * VIR_MIGRATE_PARAM_GRAPHICS_URI: * @@ -1062,6 +1071,12 @@ int virDomainMigrateSetCompressionCache(virDomainPtr= domain, unsigned long long cacheSize, unsigned int flags); =20 +/* Domain migration speed flags. */ +typedef enum { + /* Set or get maximum speed of postcopy migration. */ + VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY =3D (1 << 0), +} virDomainMigrateMaxSpeedFlags; + int virDomainMigrateSetMaxSpeed(virDomainPtr domain, unsigned long bandwidth, unsigned int flags); diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 58b4863c8f..7b87b3716a 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -9036,11 +9036,13 @@ virDomainMigrateSetCompressionCache(virDomainPtr do= main, * virDomainMigrateSetMaxSpeed: * @domain: a domain object * @bandwidth: migration bandwidth limit in MiB/s - * @flags: extra flags; not used yet, so callers should always pass 0 + * @flags: bitwise-OR of virDomainMigrateMaxSpeedFlags * * The maximum bandwidth (in MiB/s) that will be used to do migration * can be specified with the bandwidth parameter. Not all hypervisors - * will support a bandwidth cap + * will support a bandwidth cap. When VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY + * is set in @flags, this API sets the maximum bandwidth for the postcopy + * phase of the migration. * * Returns 0 in case of success, -1 otherwise. */ @@ -9077,10 +9079,13 @@ virDomainMigrateSetMaxSpeed(virDomainPtr domain, * virDomainMigrateGetMaxSpeed: * @domain: a domain object * @bandwidth: return value of current migration bandwidth limit in MiB/s - * @flags: extra flags; not used yet, so callers should always pass 0 + * @flags: bitwise-OR of virDomainMigrateMaxSpeedFlags * * Get the current maximum bandwidth (in MiB/s) that will be used if the * domain is migrated. Not all hypervisors will support a bandwidth limit. + * When VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY is set in @flags, this API + * gets the current maximum bandwidth for the postcopy phase of the + * migration. * * Returns 0 in case of success, -1 otherwise. */ --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list