[libvirt] [PATCH] virsh: Add support for setting bandwidth in migrate

Jim Fehlig JFEHLIG at suse.com
Mon Aug 26 22:09:28 UTC 2019


Commit f15789ec added support for setting postcopy migration bandwidth to
the migrate subcommand. This change does the same for standard migration.

Signed-off-by: Jim Fehlig <jfehlig at suse.com>
---

I used the term 'standard migration' in the commit message but 'pre-copy'
in the documentation. If one is preferred or more correct I can change
the other.

 tools/virsh-domain.c | 13 +++++++++++++
 tools/virsh.pod      |  4 +++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index ccda71d7e0..8984c2f3b4 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -10587,6 +10587,10 @@ static const vshCmdOptDef opts_migrate[] = {
      .type = VSH_OT_INT,
      .help = N_("number of connections for parallel migration")
     },
+    {.name = "precopy-bandwidth",
+     .type = VSH_OT_INT,
+     .help = N_("pre-copy migration bandwidth limit in MiB/s")
+    },
     {.name = NULL}
 };
 
@@ -10801,6 +10805,15 @@ doMigrate(void *opaque)
             goto save_error;
     }
 
+    if ((rv = vshCommandOptULongLong(ctl, cmd, "precopy-bandwidth", &ullOpt)) < 0) {
+        goto out;
+    } else if (rv > 0) {
+        if (virTypedParamsAddULLong(&params, &nparams, &maxparams,
+                                    VIR_MIGRATE_PARAM_BANDWIDTH,
+                                    ullOpt) < 0)
+            goto save_error;
+    }
+
     if (vshCommandOptBool(cmd, "live"))
         flags |= VIR_MIGRATE_LIVE;
     if (vshCommandOptBool(cmd, "p2p"))
diff --git a/tools/virsh.pod b/tools/virsh.pod
index af739bec24..aa0eb16f1a 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -1927,6 +1927,7 @@ I<domain> I<desturi> [I<migrateuri>] [I<graphicsuri>] [I<listen-address>] [I<dna
 [I<auto-converge-increment>] [I<--persistent-xml> B<file>] [I<--tls>]
 [I<--postcopy-bandwidth> B<bandwidth>]
 [I<--parallel> [I<--parallel-connections> B<connections>]]
+[I<--precopy-bandwidth> B<bandwidth>]
 
 Migrate domain to another host.  Add I<--live> for live migration; <--p2p>
 for peer-2-peer migration; I<--direct> for direct migration; or I<--tunnelled>
@@ -1958,7 +1959,8 @@ B<migrate-postcopy> 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 finished.
 The maximum bandwidth consumed during the post-copy phase may be limited using
-I<--postcopy-bandwidth>.
+I<--postcopy-bandwidth>. The maximum bandwidth consumed during the pre-copy phase
+may be limited using I<--precopy-bandwidth>.
 
 I<--auto-converge> forces convergence during live migration. The initial
 guest CPU throttling rate can be set with I<auto-converge-initial>. If the
-- 
2.22.0





More information about the libvir-list mailing list