From nobody Mon Feb 9 11:00:45 2026 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 1549380271728681.3281361657913; Tue, 5 Feb 2019 07:24:31 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8FD7A883B8; Tue, 5 Feb 2019 15:24:26 +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 2F0DF7C810; Tue, 5 Feb 2019 15:24:25 +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 AE8C318033A6; Tue, 5 Feb 2019 15:24:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x15FNLm0008387 for ; Tue, 5 Feb 2019 10:23:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id 77F577C818; Tue, 5 Feb 2019 15:23:21 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 13A74608C1 for ; Tue, 5 Feb 2019 15:23:17 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id DF0DA1011CA; Tue, 5 Feb 2019 16:23:12 +0100 (CET) From: Jiri Denemark To: libvir-list@redhat.com Date: Tue, 5 Feb 2019 16:23:11 +0100 Message-Id: <00b7eada0b39465ae697636b1b19b0663e552b00.1549380136.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 8/8] virsh: Add support for setting 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 05 Feb 2019 15:24:29 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- tools/virsh-domain.c | 33 +++++++++++++++++++++++++++++++-- tools/virsh.pod | 15 +++++++++++---- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 275ac0c318..db0d5d4dcc 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -10557,6 +10557,10 @@ static const vshCmdOptDef opts_migrate[] =3D { .type =3D VSH_OT_BOOL, .help =3D N_("use TLS for migration") }, + {.name =3D "postcopy-bandwidth", + .type =3D VSH_OT_INT, + .help =3D N_("post-copy migration bandwidth limit in MiB/s") + }, {.name =3D NULL} }; =20 @@ -10753,6 +10757,15 @@ doMigrate(void *opaque) goto save_error; } =20 + if ((rv =3D vshCommandOptULongLong(ctl, cmd, "postcopy-bandwidth", &ul= lOpt)) < 0) { + goto out; + } else if (rv > 0) { + if (virTypedParamsAddULLong(¶ms, &nparams, &maxparams, + VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY, + ullOpt) < 0) + goto save_error; + } + if (vshCommandOptBool(cmd, "live")) flags |=3D VIR_MIGRATE_LIVE; if (vshCommandOptBool(cmd, "p2p")) @@ -11150,6 +11163,10 @@ static const vshCmdOptDef opts_migrate_setspeed[] = =3D { .flags =3D VSH_OFLAG_REQ, .help =3D N_("migration bandwidth limit in MiB/s") }, + {.name =3D "postcopy", + .type =3D VSH_OT_BOOL, + .help =3D N_("set postcopy migration bandwidth") + }, {.name =3D NULL} }; =20 @@ -11158,6 +11175,7 @@ cmdMigrateSetMaxSpeed(vshControl *ctl, const vshCmd= *cmd) { virDomainPtr dom =3D NULL; unsigned long bandwidth =3D 0; + unsigned int flags =3D 0; bool ret =3D false; =20 if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) @@ -11166,7 +11184,10 @@ cmdMigrateSetMaxSpeed(vshControl *ctl, const vshCm= d *cmd) if (vshCommandOptULWrap(ctl, cmd, "bandwidth", &bandwidth) < 0) goto done; =20 - if (virDomainMigrateSetMaxSpeed(dom, bandwidth, 0) < 0) + if (vshCommandOptBool(cmd, "postcopy")) + flags |=3D VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY; + + if (virDomainMigrateSetMaxSpeed(dom, bandwidth, flags) < 0) goto done; =20 ret =3D true; @@ -11191,6 +11212,10 @@ static const vshCmdInfo info_migrate_getspeed[] = =3D { =20 static const vshCmdOptDef opts_migrate_getspeed[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), + {.name =3D "postcopy", + .type =3D VSH_OT_BOOL, + .help =3D N_("get postcopy migration bandwidth") + }, {.name =3D NULL} }; =20 @@ -11199,12 +11224,16 @@ cmdMigrateGetMaxSpeed(vshControl *ctl, const vshC= md *cmd) { virDomainPtr dom =3D NULL; unsigned long bandwidth; + unsigned int flags =3D 0; bool ret =3D false; =20 if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) return false; =20 - if (virDomainMigrateGetMaxSpeed(dom, &bandwidth, 0) < 0) + if (vshCommandOptBool(cmd, "postcopy")) + flags |=3D VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY; + + if (virDomainMigrateGetMaxSpeed(dom, &bandwidth, flags) < 0) goto done; =20 vshPrint(ctl, "%lu\n", bandwidth); diff --git a/tools/virsh.pod b/tools/virsh.pod index 59a5900162..67edb57b14 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -1903,6 +1903,7 @@ I I [I] [I]= [I] [I] [I<--comp-mt-threads>] [I<--comp-mt-dthreads>] [I<--comp-xbzrle-cache>] [I<--auto-converge>] [I] [I] [I<--persistent-xml> B] [I<--tls>] +[I<--postcopy-bandwidth> B] =20 Migrate domain to another host. Add I<--live> for live migration; <--p2p> for peer-2-peer migration; I<--direct> for direct migration; or I<--tunnel= led> @@ -1933,6 +1934,8 @@ Once migration is running, the user may switch to pos= t-copy using the B command sent from another virsh instance or use I<--postcopy-after-precopy> along with I<--postcopy> to let libvirt automatically switch to post-copy after the first pass of pre-copy is fini= shed. +The maximum bandwidth consumed during the post-copy phase may be limited u= sing +I<--postcopy-bandwidth>. =20 I<--auto-converge> forces convergence during live migration. The initial guest CPU throttling rate can be set with I. If the @@ -2098,17 +2101,21 @@ is supposed to be used while the domain is being li= ve-migrated as a reaction to migration progress and increasing number of compression cache misses obtained from domjobinfo. =20 -=3Ditem B I I +=3Ditem B I I [I<--postcopy>] =20 Set the maximum migration bandwidth (in MiB/s) for a domain which is being migrated to another host. I is interpreted as an unsigned long long value. Specifying a negative value results in an essentially unlimited value being provided to the hypervisor. The hypervisor can choose whether = to -reject the value or convert it to the maximum value allowed. +reject the value or convert it to the maximum value allowed. If the +I<--postcopy> option is specified, the command will set the maximum bandwi= dth +allowed during a post-copy migration phase. =20 -=3Ditem B I +=3Ditem B I [I<--postcopy>] =20 -Get the maximum migration bandwidth (in MiB/s) for a domain. +Get the maximum migration bandwidth (in MiB/s) for a domain. If the +I<--postcopy> option is specified, the command will get the maximum bandwi= dth +allowed during a post-copy migration phase. =20 =3Ditem B I =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list