On Thu, Feb 06, 2014 at 15:44:36 -0800, Chegu Vinod wrote:
Hello,
'am sending this updated patch as an attachment (as I was having some
issues with my smtp server and git send-email setup).
Thanks,
Vinod
Subject: [PATCH v2] libvirt support to force convergence of live
guest migration
Changes since RFC (i.e. v1) patch :
- Incorporated feedback from Jiri Denemark
Busy enterprise workloads hosted on large sized VM's tend to dirty
memory faster than the transfer rate achieved via live guest migration.
Despite some good recent improvements (& using dedicated 10Gig NICs
between hosts) the live migration may NOT converge.
Recently support was added in qemu (version 1.6) to allow a user to
choose if they wish to force convergence of their migration via a
new migration capability : "auto-converge". This feature allows for qemu
to auto-detect lack of convergence and trigger a throttle-down of the
VCPUs.
This patch includes the libvirt support needed to trigger this
feature. (Testing is in progress)
Signed-off-by: Chegu Vinod <chegu_vinod(a)hp.com>
---
include/libvirt/libvirt.h.in | 1 +
src/qemu/qemu_migration.c | 40 ++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_migration.h | 3 ++-
src/qemu/qemu_monitor.c | 2 +-
src/qemu/qemu_monitor.h | 1 +
tools/virsh-domain.c | 7 +++++++
6 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 295d551..c0fc08b 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -1200,6 +1200,7 @@ typedef enum {
VIR_MIGRATE_OFFLINE = (1 << 10), /* offline migrate */
VIR_MIGRATE_COMPRESSED = (1 << 11), /* compress data during migration
*/
VIR_MIGRATE_ABORT_ON_ERROR = (1 << 12), /* abort migration on I/O errors
happened during migration */
+ VIR_MIGRATE_AUTO_CONVERGE = (1 << 13), /* force convergence */
} virDomainMigrateFlags;
Since VIR_MIGRATE_AUTO_CONVERGE is a source-only flag now (destination
host does not do anything if it sees it), we should not even send it
there. Otherwise migration with this flag set would be impossible to a
host with older libvirtd that does not support this new flag. It is the
same situation as with VIR_MIGRATE_ABORT_ON_ERROR. Otherwise the patch
is good. And since it took me so long to look at this patch (I was sick
and then I forgot about it), I fixed this for you.
ACK with the following patch squashed in and pushed.
Jirka
diff --git i/src/libvirt.c w/src/libvirt.c
index 2201b07..c5c3136 100644
--- i/src/libvirt.c
+++ w/src/libvirt.c
@@ -4408,7 +4408,8 @@ virDomainMigrateVersion1(virDomainPtr domain,
if (ret == 0 && info.state == VIR_DOMAIN_PAUSED)
flags |= VIR_MIGRATE_PAUSED;
- destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR;
+ destflags = flags & ~(VIR_MIGRATE_ABORT_ON_ERROR |
+ VIR_MIGRATE_AUTO_CONVERGE);
/* Prepare the migration.
*
@@ -4538,7 +4539,8 @@ virDomainMigrateVersion2(virDomainPtr domain,
if (ret == 0 && info.state == VIR_DOMAIN_PAUSED)
flags |= VIR_MIGRATE_PAUSED;
- destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR;
+ destflags = flags & ~(VIR_MIGRATE_ABORT_ON_ERROR |
+ VIR_MIGRATE_AUTO_CONVERGE);
VIR_DEBUG("Prepare2 %p flags=%lx", dconn, destflags);
ret = dconn->driver->domainMigratePrepare2
@@ -4710,7 +4712,8 @@ virDomainMigrateVersion3Full(virDomainPtr domain,
if (ret == 0 && state == VIR_DOMAIN_PAUSED)
flags |= VIR_MIGRATE_PAUSED;
- destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR;
+ destflags = flags & ~(VIR_MIGRATE_ABORT_ON_ERROR |
+ VIR_MIGRATE_AUTO_CONVERGE);
VIR_DEBUG("Prepare3 %p flags=%x", dconn, destflags);
cookiein = cookieout;
diff --git i/src/qemu/qemu_migration.c w/src/qemu/qemu_migration.c
index cbb3d2f..57e2436 100644
--- i/src/qemu/qemu_migration.c
+++ w/src/qemu/qemu_migration.c
@@ -3627,7 +3627,8 @@ static int doPeer2PeerMigrate2(virQEMUDriverPtr driver,
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED)
flags |= VIR_MIGRATE_PAUSED;
- destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR;
+ destflags = flags & ~(VIR_MIGRATE_ABORT_ON_ERROR |
+ VIR_MIGRATE_AUTO_CONVERGE);
VIR_DEBUG("Prepare2 %p", dconn);
if (flags & VIR_MIGRATE_TUNNELLED) {
@@ -3820,7 +3821,8 @@ doPeer2PeerMigrate3(virQEMUDriverPtr driver,
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED)
flags |= VIR_MIGRATE_PAUSED;
- destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR;
+ destflags = flags & ~(VIR_MIGRATE_ABORT_ON_ERROR |
+ VIR_MIGRATE_AUTO_CONVERGE);
VIR_DEBUG("Prepare3 %p", dconn);
cookiein = cookieout;