File 61f2b6ba-no-unlimited-mig2file-speed.patch of Package libvirt.1301

commit 61f2b6ba5fdef0613d6351b99913b5ef468144ce
Author: Eric Blake <eblake@redhat.com>
Date:   Tue Nov 8 12:01:48 2011 -0700

    qemu: fix domjobabort regression
    
    This reverts commit ef1065cf5ac; see also this bug report:
    https://bugzilla.redhat.com/show_bug.cgi?id=751900
    
    In qemu 0.15.1 and earlier, during migration to file, the
    qemu_savevm_state_begin and qemu_savevm_state_iterate methods
    will both process as much migration data as possible until either
    
      1. The file descriptor returns EAGAIN
      2. The bandwidth rate limit is reached
    
    If we set the rate limit to ULONG_MAX, test 2 never becomes true. We're
    passing a plain file descriptor to QEMU and POSIX does not support EAGAIN on
    regular files / block devices, so test 1 never becomes true either.
    
    In the 'virsh save --bypass-cache' case, we pass a pipe instead of a
    regular fd, but using a pipe adds I/O overhead, so always passing a
    pipe just so qemu can see EAGAIN doesn't seem nice.
    
    The ultimate fix needs to come from qemu - background migration must
    respect asynchronous abort requests, or else periodically return
    control to the main handling loop without an EAGAIN and without
    waiting to hit an insanely large amount of data.  But until a
    version of qemu is fixed to support "unlimited" data rates while
    still allowing cancellation, the best we can do is avoid the
    automatic use of unlimited rates from within libvirt (users can
    still explicitly change the migration rates, if they are aware that
    they are giving up the ability to cancel a job).
    
    Reverting the lone use of QEMU_DOMAIN_FILE_MIG_BANDWIDTH_MAX is
    the simplest patch; this slows migration back down to a default
    32M/sec cap, but also ensures that the main qemu processing loop
    will still be responsive to cancellation requests.  Hopefully
    upstream qemu will provide us a means of safely using unlimited
    speed, including a runtime probe of that capability.
    
    * src/qemu/qemu_migration.c (qemuMigrationToFile): Revert attempt
    to use unlimited migration bandwidth when migrating to file.
    
    Signed-off-by: Daniel Veillard <veillard@redhat.com>
    Signed-off-by: Eric Blake <eblake@redhat.com>

Index: libvirt-0.9.6/src/qemu/qemu_migration.c
===================================================================
--- libvirt-0.9.6.orig/src/qemu/qemu_migration.c
+++ libvirt-0.9.6/src/qemu/qemu_migration.c
@@ -2718,16 +2718,6 @@ qemuMigrationToFile(struct qemud_driver
     bool restoreLabel = false;
     virCommandPtr cmd = NULL;
     int pipeFD[2] = { -1, -1 };
-    unsigned long saveMigBandwidth = priv->migMaxBandwidth;
-
-    /* Increase migration bandwidth to unlimited since target is a file.
-     * Failure to change migration speed is not fatal. */
-    if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) {
-        qemuMonitorSetMigrationSpeed(priv->mon,
-                                     QEMU_DOMAIN_FILE_MIG_BANDWIDTH_MAX);
-        priv->migMaxBandwidth = QEMU_DOMAIN_FILE_MIG_BANDWIDTH_MAX;
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
-    }
 
     if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD) &&
         (!compressor || pipe(pipeFD) == 0)) {
@@ -2839,13 +2829,6 @@ qemuMigrationToFile(struct qemud_driver
     ret = 0;
 
 cleanup:
-    /* Restore max migration bandwidth */
-    if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) {
-        qemuMonitorSetMigrationSpeed(priv->mon, saveMigBandwidth);
-        priv->migMaxBandwidth = saveMigBandwidth;
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
-    }
-
     VIR_FORCE_CLOSE(pipeFD[0]);
     VIR_FORCE_CLOSE(pipeFD[1]);
     virCommandFree(cmd);
openSUSE Build Service is sponsored by