commit 0257ba8f9f4bf522a106aa2bbb4756e391a3dd42 Author: Jim Fehlig Date: Fri Aug 26 12:10:27 2011 -0600 Use max bandwidth from qemuDomainObjPrivate struct when migrating Adjust qemuMigrationRun() to use migMaxBandwidth in qemuDomainObjPrivate structure when setting qemu migration speed. Caller-specified 'resource' parameter overrides migMaxBandwidth. Index: libvirt-0.9.4/src/qemu/qemu_migration.c =================================================================== --- libvirt-0.9.4.orig/src/qemu/qemu_migration.c +++ libvirt-0.9.4/src/qemu/qemu_migration.c @@ -1284,6 +1284,7 @@ static int doNativeMigrate(struct qemud_ qemuDomainObjPrivatePtr priv = vm->privateData; unsigned int background_flags = QEMU_MONITOR_MIGRATE_BACKGROUND; qemuMigrationCookiePtr mig = NULL; + unsigned long migrate_speed = resource ? resource : priv->migMaxBandwidth; VIR_DEBUG("driver=%p, vm=%p, uri=%s, cookiein=%s, cookieinlen=%d, " "cookieout=%p, cookieoutlen=%p, flags=%x, dname=%s, resource=%lu", driver, vm, uri, NULLSTR(cookiein), cookieinlen, @@ -1334,8 +1335,7 @@ static int doNativeMigrate(struct qemud_ QEMU_ASYNC_JOB_MIGRATION_OUT) < 0) goto cleanup; - if (resource > 0 && - qemuMonitorSetMigrationSpeed(priv->mon, resource) < 0) { + if (qemuMonitorSetMigrationSpeed(priv->mon, migrate_speed) < 0) { qemuDomainObjExitMonitorWithDriver(driver, vm); goto cleanup; } @@ -1506,6 +1506,7 @@ static int doTunnelMigrate(struct qemud_ int ret = -1; qemuMigrationCookiePtr mig = NULL; qemuMigrationIOThreadPtr iothread = NULL; + unsigned long migrate_speed = resource ? resource : priv->migMaxBandwidth; VIR_DEBUG("driver=%p, vm=%p, st=%p, cookiein=%s, cookieinlen=%d, " "cookieout=%p, cookieoutlen=%p, flags=%lx, resource=%lu", driver, vm, st, NULLSTR(cookiein), cookieinlen, @@ -1597,8 +1598,7 @@ static int doTunnelMigrate(struct qemud_ QEMU_ASYNC_JOB_MIGRATION_OUT) < 0) goto cleanup; - if (resource > 0 && - qemuMonitorSetMigrationSpeed(priv->mon, resource) < 0) { + if (qemuMonitorSetMigrationSpeed(priv->mon, migrate_speed) < 0) { qemuDomainObjExitMonitorWithDriver(driver, vm); goto cleanup; }