File 3d179919-virsh-precopy-bandwidth.patch of Package libvirt.16766

commit 3d1799192de9d4dd2fa14cb10ac0dbda23a6e305
Author: Jim Fehlig <jfehlig@suse.com>
Date:   Mon Aug 26 13:41:25 2019 -0600

    virsh: Add support for setting bandwidth in migrate
    
    Commit f15789ec added support for setting postcopy migration bandwidth to
    the migrate subcommand. This change does the same for precopy migration.
    
    Signed-off-by: Jim Fehlig <jfehlig@suse.com>
    Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Index: libvirt-4.0.0/tools/virsh-domain.c
===================================================================
--- libvirt-4.0.0.orig/tools/virsh-domain.c
+++ libvirt-4.0.0/tools/virsh-domain.c
@@ -10540,6 +10540,10 @@ static const vshCmdOptDef opts_migrate[]
      .type = VSH_OT_BOOL,
      .help = N_("use TLS for migration")
     },
+    {.name = "precopy-bandwidth",
+     .type = VSH_OT_INT,
+     .help = N_("pre-copy migration bandwidth limit in MiB/s")
+    },
     {.name = NULL}
 };
 
@@ -10736,6 +10740,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"))
Index: libvirt-4.0.0/tools/virsh.pod
===================================================================
--- libvirt-4.0.0.orig/tools/virsh.pod
+++ libvirt-4.0.0/tools/virsh.pod
@@ -1758,6 +1758,7 @@ I<domain> I<desturi> [I<migrateuri>] [I<
 [I<--comp-mt-level>] [I<--comp-mt-threads>] [I<--comp-mt-dthreads>]
 [I<--comp-xbzrle-cache>] [I<--auto-converge>] [I<auto-converge-initial>]
 [I<auto-converge-increment>] [I<--persistent-xml> B<file>] [I<--tls>]
+[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>
@@ -1788,6 +1789,8 @@ Once migration is running, the user may
 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 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
openSUSE Build Service is sponsored by