[pve-devel] [PATCH 2/2] implement qmp block_set_io_throttle on running vm config update

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


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

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 68562fa..dccfbcc 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -674,6 +674,15 @@ my $vmconfig_update_disk = sub {
 		&$vmconfig_delete_option($rpcenv, $authuser, $conf, $storecfg, $vmid, $opt, $force);
 		$conf = PVE::QemuServer::load_config($vmid); # update/reload
 	    }
+
+            if($drive->{bps} != $old_drive->{bps} ||
+               $drive->{bps_rd} != $old_drive->{bps_rd} ||
+               $drive->{bps_wr} != $old_drive->{bps_wr} ||
+               $drive->{iops} != $old_drive->{iops} ||
+               $drive->{iops_rd} != $old_drive->{iops_rd} ||
+               $drive->{iops_wr} != $old_drive->{iops_wr} ) {
+               PVE::QemuServer::qemu_block_set_io_throttle($vmid,"drive-$opt",$drive->{bps}, $drive->{bps_rd}, $drive->{bps_wr}, $drive->{iops}, $drive->{iops_rd}, $drive->{iops_wr}) if !PVE::QemuServer::drive_is_cdrom($drive);
+            }
 	}
     }
 
-- 
1.7.2.5




More information about the pve-devel mailing list