[pve-devel] pve api function for blkio limit
Игорь
shinespb at gmail.com
Mon Sep 16 18:52:52 CEST 2013
diff --git a/PVE/OpenVZ.pm b/PVE/OpenVZ.pm
index a16d4fc..88376e2 100644
--- a/PVE/OpenVZ.pm
+++ b/PVE/OpenVZ.pm
@@ -184,6 +184,31 @@ sub read_container_blkio_stat {
return ($read, $write);
};
+sub container_blkio_limit_set {
+ my $rw = shift;
+ my $vmid = shift;
+ my $dev = shift;
+ my $limit = shift;
+
+ my $filename;
+ if ($rw eq "read"){
+ $filename =
"/proc/vz/beancounter/$vmid/blkio.throttle.read_iops_device";
+ }
+ if ($rw eq "write"){
+ $filename =
"/proc/vz/beancounter/$vmid/blkio.throttle.write_iops_device";
+ }
+
+ if (my $fh = IO::File->new ($filename, "w")) {
+
+ print $fh "$dev $limit";
+
+ undef $fh;
+ }
+
+ return;
+};
+
+
my $last_proc_vestat = {};
sub vmstatus {
More information about the pve-devel
mailing list