[PATCH Libvirt 3/4] virsh: Add support for VIR_MIGRATE_DIRTY_LIMIT flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Hyman Huang <yong.huang@xxxxxxxxxx>

Introudce option to enable dirty-limit convergence algorithim
during live migration.

Signed-off-by: Hyman Huang <yong.huang@xxxxxxxxxx>
---
 docs/manpages/virsh.rst | 10 +++++++++-
 src/libvirt-domain.c    |  8 ++++++++
 tools/virsh-domain.c    | 10 ++++++++++
 3 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index c425974912..9342dd4cfd 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -3373,7 +3373,7 @@ migrate
       [--compressed] [--comp-methods method-list]
       [--comp-mt-level] [--comp-mt-threads] [--comp-mt-dthreads]
       [--comp-xbzrle-cache] [--comp-zlib-level] [--comp-zstd-level]
-      [--auto-converge] [auto-converge-initial]
+      [--dirty-limit] [--auto-converge] [auto-converge-initial]
       [auto-converge-increment] [--persistent-xml file] [--tls]
       [--postcopy-bandwidth bandwidth]
       [--parallel [--parallel-connections connections]]
@@ -3429,6 +3429,14 @@ source or destination host and the ``migrate`` command will report an error
 leaving the domain active on both hosts. To recover from such situation repeat
 the original ``migrate`` command with an additional *--postcopy-resume* flag.
 
+*--dirty-limit* forces convergence using dirty-limit algorithms during live
+migration. For QEMU/KVM, this means migration will throttle vCPUs as needed to
+keep their dirty page rate within the migration parameter ``vcpu-dirty-limit``
+(1 megabits/s by default). This can improve the responsiveness of large guests
+during live migration and result in more stable read performance. It requires
+dirty-ring size configuration and conflicts with the traditional
+``auto-converge`` algorithm.
+
 *--auto-converge* forces convergence during live migration. The initial
 guest CPU throttling rate can be set with *auto-converge-initial*. If the
 initial throttling rate is not enough to ensure convergence, the rate is
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 6616294fc1..f1a7681da5 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -4213,6 +4213,10 @@ virDomainMigrate3(virDomainPtr domain,
     /* Now checkout the destination */
     virCheckReadOnlyGoto(dconn->flags, error);
 
+    VIR_EXCLUSIVE_FLAGS_GOTO(VIR_MIGRATE_AUTO_CONVERGE,
+                             VIR_MIGRATE_DIRTY_LIMIT,
+                             error);
+
     VIR_EXCLUSIVE_FLAGS_GOTO(VIR_MIGRATE_NON_SHARED_DISK,
                              VIR_MIGRATE_NON_SHARED_INC,
                              error);
@@ -4637,6 +4641,10 @@ virDomainMigrateToURI3(virDomainPtr domain,
     virCheckDomainReturn(domain, -1);
     virCheckReadOnlyGoto(domain->conn->flags, error);
 
+    VIR_EXCLUSIVE_FLAGS_GOTO(VIR_MIGRATE_AUTO_CONVERGE,
+                             VIR_MIGRATE_DIRTY_LIMIT,
+                             error);
+
     VIR_EXCLUSIVE_FLAGS_GOTO(VIR_MIGRATE_TUNNELLED,
                              VIR_MIGRATE_PARALLEL,
                              error);
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 7abafe2ba3..31ee31b394 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -10922,6 +10922,10 @@ static const vshCmdOptDef opts_migrate[] = {
      .type = VSH_OT_BOOL,
      .help = N_("compress repeated pages during live migration")
     },
+    {.name = "dirty-limit",
+     .type = VSH_OT_BOOL,
+     .help = N_("force convergence with dirty-limit algorithim during live migration")
+    },
     {.name = "auto-converge",
      .type = VSH_OT_BOOL,
      .help = N_("force convergence during live migration")
@@ -11108,6 +11112,7 @@ doMigrate(void *opaque)
         { "change-protection", VIR_MIGRATE_CHANGE_PROTECTION },
         { "unsafe", VIR_MIGRATE_UNSAFE },
         { "compressed", VIR_MIGRATE_COMPRESSED },
+        { "dirty-limit", VIR_MIGRATE_DIRTY_LIMIT },
         { "auto-converge", VIR_MIGRATE_AUTO_CONVERGE },
         { "rdma-pin-all", VIR_MIGRATE_RDMA_PIN_ALL },
         { "offline", VIR_MIGRATE_OFFLINE },
@@ -11134,6 +11139,11 @@ doMigrate(void *opaque)
             flags |= flagmap[i].migflag;
     }
 
+    if (flags & VIR_MIGRATE_DIRTY_LIMIT && flags & VIR_MIGRATE_AUTO_CONVERGE) {
+        vshError(ctl, "'--dirty-limit' conflicts with '--auto-converge'");
+        goto out;
+    }
+
     if (flags & VIR_MIGRATE_NON_SHARED_SYNCHRONOUS_WRITES &&
         !(flags & (VIR_MIGRATE_NON_SHARED_DISK | VIR_MIGRATE_NON_SHARED_DISK))) {
         vshError(ctl, "'--copy-storage-synchronous-writes' requires one of '--copy-storage-all', '--copy-storage-inc'");
-- 
2.38.5





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux