From: Wolfgang Bumiller Date: Tue, 30 May 2017 13:30:15 +0000 (+0200) Subject: fix burst length parameter names and pass them to qemu X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;ds=sidebyside;h=fb8e95a218bd299202d4b8a1ea50c406405174ed;p=qemu-server.git fix burst length parameter names and pass them to qemu bps_max_length & friends were wrongly named and were only passed to qemu when hot-applying changes. They can only be passed via the command line with their new names. For consistency let's rename them all, that way they're all in one place. Fixes #1195 (for real this time). --- diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index a01c0ba..9dbb17d 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -858,12 +858,18 @@ $add_throttle_desc->('iops_rd_max', 'integer', 'unthrottled read I/O pool', 'io $add_throttle_desc->('iops_wr_max', 'integer', 'unthrottled write I/O pool', 'iops', 'operations per second'); # burst lengths -$add_throttle_desc->('bps_max_length', 'integer', 'length of I/O bursts', 'seconds', 'seconds', 1); -$add_throttle_desc->('bps_rd_length', 'integer', 'length of read I/O bursts', 'seconds', 'seconds', 1); -$add_throttle_desc->('bps_wr_length', 'integer', 'length of write I/O bursts', 'seconds', 'seconds', 1); -$add_throttle_desc->('iops_max_length', 'integer', 'length of I/O bursts', 'seconds', 'seconds', 1); -$add_throttle_desc->('iops_rd_length', 'integer', 'length of read I/O bursts', 'seconds', 'seconds', 1); -$add_throttle_desc->('iops_wr_length', 'integer', 'length of write I/O bursts', 'seconds', 'seconds', 1); +$add_throttle_desc->('bps_max_length', 'integer', 'length of I/O bursts', 'seconds', 'seconds', 1); +$add_throttle_desc->('bps_rd_max_length', 'integer', 'length of read I/O bursts', 'seconds', 'seconds', 1); +$add_throttle_desc->('bps_wr_max_length', 'integer', 'length of write I/O bursts', 'seconds', 'seconds', 1); +$add_throttle_desc->('iops_max_length', 'integer', 'length of I/O bursts', 'seconds', 'seconds', 1); +$add_throttle_desc->('iops_rd_max_length', 'integer', 'length of read I/O bursts', 'seconds', 'seconds', 1); +$add_throttle_desc->('iops_wr_max_length', 'integer', 'length of write I/O bursts', 'seconds', 'seconds', 1); + +# legacy support +$drivedesc_base{'bps_rd_length'} = { alias => 'bps_rd_max_length' }; +$drivedesc_base{'bps_wr_length'} = { alias => 'bps_wr_max_length' }; +$drivedesc_base{'iops_rd_length'} = { alias => 'iops_rd_max_length' }; +$drivedesc_base{'iops_wr_length'} = { alias => 'iops_wr_max_length' }; my $ide_fmt = { %drivedesc_base, @@ -1358,6 +1364,12 @@ sub parse_drive { # can't use the schema's 'requires' because of the mbps* => bps* "transforming aliases" for my $requirement ( + [mbps_max => 'mbps'], + [mbps_rd_max => 'mbps_rd'], + [mbps_wr_max => 'mbps_wr'], + [miops_max => 'miops'], + [miops_rd_max => 'miops_rd'], + [miops_wr_max => 'miops_wr'], [bps_max_length => 'mbps_max'], [bps_rd_max_length => 'mbps_rd_max'], [bps_wr_max_length => 'mbps_wr_max'], @@ -1582,10 +1594,32 @@ sub print_drive_full { } my $opts = ''; - my @qemu_drive_options = qw(heads secs cyls trans media format cache snapshot rerror werror aio discard iops iops_rd iops_wr iops_max iops_rd_max iops_wr_max); + my @qemu_drive_options = qw(heads secs cyls trans media format cache snapshot rerror werror aio discard); foreach my $o (@qemu_drive_options) { $opts .= ",$o=$drive->{$o}" if $drive->{$o}; } + foreach my $type (['', '-total'], [_rd => '-read'], [_wr => '-write']) { + my ($dir, $qmpname) = @$type; + if (my $v = $drive->{"mbps$dir"}) { + $opts .= ",throttling.bps$qmpname=".int($v*1024*1024); + } + if (my $v = $drive->{"mbps${dir}_max"}) { + $opts .= ",throttling.bps$qmpname-max=".int($v*1024*1024); + } + if (my $v = $drive->{"bps${dir}_max_length"}) { + $opts .= ",throttling.bps$qmpname-max-length=$v"; + } + if (my $v = $drive->{"iops${dir}"}) { + $opts .= ",throttling.iops$qmpname=$v"; + } + if (my $v = $drive->{"iops${dir}_max"}) { + $opts .= ",throttling.iops$qmpname=-max$v"; + } + if (my $v = $drive->{"iops${dir}_max_length"}) { + $opts .= ",throttling.iops$qmpname=-max-length$v"; + } + } + if (my $serial = $drive->{serial}) { $serial = URI::Escape::uri_unescape($serial); $opts .= ",serial=$serial"; @@ -1593,11 +1627,6 @@ sub print_drive_full { $opts .= ",format=$format" if $format && !$drive->{format}; - foreach my $o (qw(bps bps_rd bps_wr)) { - my $v = $drive->{"m$o"}; - $opts .= ",$o=" . int($v*1024*1024) if $v; - } - my $cache_direct = 0; if (my $cache = $drive->{cache}) {