mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-02 07:26:04 +00:00
migration: fix calculation of bandwith limit for non-disk migration
The case with: 1. no generic 'migration' limit from the storage plugin 2. a migrate_speed limit in the VM config was broken. It would assign 0 to migrate_speed when picking the minimum value and then default to the default value. Fix it by checking if bwlimit is 0 before picking the minimum. Also, make it a bit more readable by avoiding the trick of //-assigning bwlimit before the units match up and relying on getting back the original bwlimit value as the minimum. Instead, only ||-assign after the units match up and don't rely on other things. Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
parent
3276a43470
commit
2c4ba4c3ee
@ -961,11 +961,15 @@ sub phase2 {
|
||||
# migrate speed can be set via bwlimit (datacenter.cfg and API) and via the
|
||||
# migrate_speed parameter in qm.conf - take the lower of the two.
|
||||
my $bwlimit = PVE::Storage::get_bandwidth_limit('migration', undef, $opt_bwlimit) // 0;
|
||||
my $migrate_speed = $conf->{migrate_speed} // $bwlimit;
|
||||
my $migrate_speed = $conf->{migrate_speed} // 0;
|
||||
# migrate_speed is in MB/s, bwlimit in KB/s
|
||||
$migrate_speed *= 1024;
|
||||
|
||||
$migrate_speed = ($bwlimit < $migrate_speed) ? $bwlimit : $migrate_speed;
|
||||
if ($bwlimit && $migrate_speed) {
|
||||
$migrate_speed = ($bwlimit < $migrate_speed) ? $bwlimit : $migrate_speed;
|
||||
} else {
|
||||
$migrate_speed ||= $bwlimit;
|
||||
}
|
||||
|
||||
# always set migrate speed (overwrite kvm default of 32m) we set a very high
|
||||
# default of 8192m which is basically unlimited
|
||||
|
Loading…
Reference in New Issue
Block a user