SHA256
1
0
forked from pool/libvirt
libvirt/8fc40c51-mig-speed-5.patch

66 lines
2.1 KiB
Diff
Raw Normal View History

commit 8fc40c511c08143cb64ff0d212942dde8e81c279
Author: Jim Fehlig <jfehlig@novell.com>
Date: Fri Aug 26 12:10:25 2011 -0600
Save migration speed in qemuDomainMigrateSetMaxSpeed
Now that migration speed is stored in qemuDomainObjPrivate structure,
save the new value when invoking qemuDomainMigrateSetMaxSpeed().
Allow setting migration speed on inactive domain too.
Index: libvirt-0.9.4/src/qemu/qemu_driver.c
===================================================================
--- libvirt-0.9.4.orig/src/qemu/qemu_driver.c
+++ libvirt-0.9.4/src/qemu/qemu_driver.c
@@ -8202,32 +8202,26 @@ qemuDomainMigrateSetMaxSpeed(virDomainPt
return -1;
}
- if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MIGRATION_OP) < 0)
- goto cleanup;
-
- if (!virDomainObjIsActive(vm)) {
- qemuReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
- goto endjob;
- }
-
priv = vm->privateData;
-
- if (priv->job.asyncJob != QEMU_ASYNC_JOB_MIGRATION_OUT) {
- qemuReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not being migrated"));
- goto endjob;
+ if (virDomainObjIsActive(vm)) {
+ if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MIGRATION_OP) < 0)
+ goto cleanup;
+
+ VIR_DEBUG("Setting migration bandwidth to %luMbs", bandwidth);
+ qemuDomainObjEnterMonitor(driver, vm);
+ ret = qemuMonitorSetMigrationSpeed(priv->mon, bandwidth);
+ qemuDomainObjExitMonitor(driver, vm);
+
+ if (ret == 0)
+ priv->migMaxBandwidth = bandwidth;
+
+ if (qemuDomainObjEndJob(driver, vm) == 0)
+ vm = NULL;
+ } else {
+ priv->migMaxBandwidth = bandwidth;
+ ret = 0;
}
- VIR_DEBUG("Setting migration bandwidth to %luMbs", bandwidth);
- qemuDomainObjEnterMonitor(driver, vm);
- ret = qemuMonitorSetMigrationSpeed(priv->mon, bandwidth);
- qemuDomainObjExitMonitor(driver, vm);
-
-endjob:
- if (qemuDomainObjEndJob(driver, vm) == 0)
- vm = NULL;
-
cleanup:
if (vm)
virDomainObjUnlock(vm);