[pve-devel] [PATCH qemu-server 1/7] bwlimit: honor bwlimit for migrate qmp call
Stoiko Ivanov
s.ivanov at proxmox.com
Fri Mar 29 08:28:00 CET 2019
The 'migrate_speed' can be set in the VM config. Additionally migrate should
honor the 'migrate' bwlimit set in datacenter.cfg (storage-specific limits play
no role for memory+state migration) or the parameter provided to the API call.
With this patch a set bwlimit overrides the 'migrate_speed' setting.
Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
PVE/QemuMigrate.pm | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index ee605d8..8f4ee5b 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -663,9 +663,11 @@ sub phase2 {
# always set migrate speed (overwrite kvm default of 32m)
# we set a very hight default of 8192m which is basically unlimited
- my $migrate_speed = $defaults->{migrate_speed} || 8192;
- $migrate_speed = $conf->{migrate_speed} || $migrate_speed;
- $migrate_speed = $migrate_speed * 1048576;
+ my $migrate_speed = $conf->{migrate_speed} // ($defaults->{migrate_speed} || 8192*1024);
+ #optionally override with $opt_bwlimit - with undef as storagelist
+ my $bwlimit = PVE::Storage::get_bandwidth_limit('migrate', undef, $opt_bwlimit);
+ $migrate_speed = $bwlimit // $migrate_speed;
+ $migrate_speed *= 1024;
$self->log('info', "migrate_set_speed: $migrate_speed");
eval {
PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "migrate_set_speed", value => int($migrate_speed));
--
2.11.0
More information about the pve-devel
mailing list