Hi all,

On Thu, 02 May 2013 18:34:10 +0200 (CEST)
Alexandre DERUMIER <aderum...@odiso.com> wrote:

> 
> Maybe can we compute average source new writes (ios ? bandwith ?), or 
> something like that, and decrease progressively the ios or bandwith.
> I need to think about that a little more.
> 
I have given this some thoughts and I think it could be implemented
this way:

my $max_bps_wr = get_target_max_bps_wr($target);
my $bps_wr = $max_bps_wr;
my $new_bps_wr = 0;
my $timer = 0;
eval {
        while (1) {
                my $elapsed = time() - $timer
                if ($elapsed < $timer) {
                        $new_bps_wr = $bps_wr * 0.9;
                        if ($new_bps_wr <= ($max_bps_wr * 0.1) {
                                die "Target $target is to congested";
                        }
                }
                else {
                        $new_bps_wr = $bps_wr * 1.05;
                        if ($new_bps_wr > $max_bps_wr) {
                                $new_bps_wr = $max_bps_wr;
                        }
                }
                $timer = $elapsed;
                $bps_wr = $new_bps_wr;
                PVE::QemuServer::qemu_block_set_io_throttle(
                        $vmid, $target, 0, 0, $new_bps_wr);
                # do other migration stuff
        }
};
do {
                my $err = $@;
                PVE::QemuServer::qemu_block_set_io_throttle(
                        $vmid, $target, 0, 0, 0);
                # do other error stuff
                die $err;
} if $@;

PVE::QemuServer::qemu_block_set_io_throttle($vmid, $target, 0, 0, 0);

-- 
Hilsen/Regards
Michael Rasmussen

Get my public GnuPG keys:
michael <at> rasmussen <dot> cc
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xD3C9A00E
mir <at> datanom <dot> net
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE501F51C
mir <at> miras <dot> org
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE3E80917
--------------------------------------------------------------
People think love is an emotion.  Love is good sense.
                -- Ken Kesey

Attachment: signature.asc
Description: PGP signature

_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to