[pve-devel] [PATCH 1/2] fixes for qemu_block_set_io_throttle

Alexandre Derumier aderumier at odiso.com
Sun Jul 15 17:19:06 CEST 2012


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuServer.pm |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index ee1a2b6..1a4daac 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2601,6 +2601,8 @@ sub qemu_netdevdel {
 sub qemu_block_set_io_throttle {
     my ($vmid, $deviceid, $bps, $bps_rd, $bps_wr, $iops, $iops_rd, $iops_wr) = @_;
 
+    return if !check_running($vmid) ;
+
     $bps = 0 if !$bps;
     $bps_rd = 0 if !$bps_rd;
     $bps_wr = 0 if !$bps_wr;
@@ -2608,11 +2610,8 @@ sub qemu_block_set_io_throttle {
     $iops_rd = 0 if !$iops_rd;
     $iops_wr = 0 if !$iops_wr;
 
-    my $ret = vm_mon_cmd($vmid, "block_set_io_throttle", device => $deviceid, bps => $bps, bps_rd => $bps_rd, bps_wr => $bps_wr, iops => $iops, iops_rd => $iops_rd, iops_wr => $iops_wr);
-    $ret =~ s/^\s+//;
-    return 1 if $ret eq "";
-    syslog("err", "error setting block_set_io_throttle: $ret");
-    return undef;
+    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));
+
 }
 
 sub vm_start {
-- 
1.7.2.5




More information about the pve-devel mailing list