5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-01-10 01:18:01 +03:00

correctly handle undef values when calling qemu_block_set_io_throttle

This commit is contained in:
Dietmar Maurer 2013-06-12 07:08:02 +02:00
parent 0e6165343a
commit 9b2c0efbd6
2 changed files with 7 additions and 10 deletions

View File

@ -766,9 +766,13 @@ my $vmconfig_update_disk = sub {
&$safe_num_ne($drive->{iops}, $old_drive->{iops}) || &$safe_num_ne($drive->{iops}, $old_drive->{iops}) ||
&$safe_num_ne($drive->{iops_rd}, $old_drive->{iops_rd}) || &$safe_num_ne($drive->{iops_rd}, $old_drive->{iops_rd}) ||
&$safe_num_ne($drive->{iops_wr}, $old_drive->{iops_wr})) { &$safe_num_ne($drive->{iops_wr}, $old_drive->{iops_wr})) {
PVE::QemuServer::qemu_block_set_io_throttle($vmid,"drive-$opt", $drive->{mbps}*1024*1024, PVE::QemuServer::qemu_block_set_io_throttle($vmid,"drive-$opt",
$drive->{mbps_rd}*1024*1024, $drive->{mbps_wr}*1024*1024, ($drive->{mbps} || 0)*1024*1024,
$drive->{iops}, $drive->{iops_rd}, $drive->{iops_wr}) ($drive->{mbps_rd} || 0)*1024*1024,
($drive->{mbps_wr} || 0)*1024*1024,
$drive->{iops} || 0,
$drive->{iops_rd} || 0,
$drive->{iops_wr} || 0)
if !PVE::QemuServer::drive_is_cdrom($drive); if !PVE::QemuServer::drive_is_cdrom($drive);
} }
} }

View File

@ -2803,13 +2803,6 @@ sub qemu_block_set_io_throttle {
return if !check_running($vmid) ; return if !check_running($vmid) ;
$bps = 0 if !$bps;
$bps_rd = 0 if !$bps_rd;
$bps_wr = 0 if !$bps_wr;
$iops = 0 if !$iops;
$iops_rd = 0 if !$iops_rd;
$iops_wr = 0 if !$iops_wr;
vm_mon_cmd($vmid, "block_set_io_throttle", device => $deviceid, bps => int($bps), bps_rd => int($bps_rd), bps_wr => int($bps_wr), iops => int($iops), iops_rd => int($iops_rd), iops_wr => int($iops_wr)); vm_mon_cmd($vmid, "block_set_io_throttle", device => $deviceid, bps => int($bps), bps_rd => int($bps_rd), bps_wr => int($bps_wr), iops => int($iops), iops_rd => int($iops_rd), iops_wr => int($iops_wr));
} }