]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh migrate: Add --available-switchover-bandwidth option
authorJiri Denemark <jdenemar@redhat.com>
Thu, 23 Jan 2025 09:25:10 +0000 (10:25 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 27 Jan 2025 15:32:57 +0000 (16:32 +0100)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
docs/manpages/virsh.rst
tools/virsh-domain.c

index e801037c04943486c9fe78511a66d077379a46a5..bf0436621b9653cbc1a727b8080a022e5d7d3790 100644 (file)
@@ -3407,6 +3407,7 @@ migrate
       [--parallel [--parallel-connections connections]]
       [--bandwidth bandwidth] [--tls-destination hostname]
       [--disks-uri URI] [--copy-storage-synchronous-writes]
+      [--available-switchover-bandwidth bandwidth]
 
 Migrate domain to another host.  Add *--live* for live migration; <--p2p>
 for peer-2-peer migration; *--direct* for direct migration; or *--tunnelled*
@@ -3663,6 +3664,17 @@ the context of the existing socket because it is different from the file
 representation of the socket and the context is chosen by its creator (usually
 by using *setsockcreatecon{,_raw}()* functions).
 
+Optional *--available-switchover-bandwidth* overrides the automatically
+computed bandwidth (in MiB/s) available for the final phase of (pre-copy)
+migration during which CPUs are stopped and all the remaining memory and device
+state is transferred. Knowing this bandwidth is important for accurate
+estimation of the domain downtime and deciding the right moment for switching
+over. Normally this would be estimated based on the bandwidth used by
+migration, but this could be lower than the actual available bandwidth. Using
+this option may help with migration convergence when the migration would keep
+iterating over and over thinking there's not enough bandwidth to comply with
+the configured maximum downtime.
+
 
 migrate-compcache
 -----------------
index 546db955a9a23fb2749d23e20782e57fa3f4f51d..f3da2f903ff0850500c1d370e0a56e80f43d2972 100644 (file)
@@ -10788,6 +10788,10 @@ static const vshCmdOptDef opts_migrate[] = {
      .type = VSH_OT_INT,
      .help = N_("compress level for zstd compression")
     },
+    {.name = "available-switchover-bandwidth",
+     .type = VSH_OT_INT,
+     .help = N_("bandwidth (in MiB/s) available for the final phase of migration")
+    },
     {.name = NULL}
 };
 
@@ -11102,6 +11106,15 @@ doMigrate(void *opaque)
                                 VIR_MIGRATE_PARAM_TLS_DESTINATION, opt) < 0)
         goto save_error;
 
+    if ((rv = vshCommandOptULongLong(ctl, cmd, "available-switchover-bandwidth", &ullOpt)) < 0) {
+        goto out;
+    } else if (rv > 0) {
+        if (virTypedParamsAddULLong(&params, &nparams, &maxparams,
+                                    VIR_MIGRATE_PARAM_BANDWIDTH_AVAIL_SWITCHOVER,
+                                    ullOpt) < 0)
+            goto save_error;
+    }
+
     if (flags & VIR_MIGRATE_PEER2PEER || vshCommandOptBool(cmd, "direct")) {
         if (virDomainMigrateToURI3(dom, desturi, params, nparams, flags) == 0)
             data->ret = 0;