From: Stefan Reiter <s.reiter@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server 3/4] vzdump: display actually uploaded chunks as 'write' speed
Date: Thu, 13 Aug 2020 14:03:33 +0200 [thread overview]
Message-ID: <20200813120334.20928-4-s.reiter@proxmox.com> (raw)
In-Reply-To: <20200813120334.20928-1-s.reiter@proxmox.com>
Previously 'read' and 'write' would always show the same value, which is
of little use. Change it so 'write' excludes reused bytes, thus
displaying the actual upload speed.
$last_reused needs to be initialized to contain reused data from 'clean'
dirty bitmaps to ensure the first output line is correct.
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---
PVE/VZDump/QemuServer.pm | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/PVE/VZDump/QemuServer.pm b/PVE/VZDump/QemuServer.pm
index 6420bf4..5edc62b 100644
--- a/PVE/VZDump/QemuServer.pm
+++ b/PVE/VZDump/QemuServer.pm
@@ -306,7 +306,7 @@ my $query_backup_status_loop = sub {
my $starttime = time ();
my $last_time = $starttime;
- my ($last_percent, $last_total, $last_target, $last_zero, $last_transferred) = (-1, 0, 0, 0, 0);
+ my ($last_percent, $last_total, $last_target, $last_zero, $last_transferred) = (-1, 0, 0, 0, 0);
my ($transferred, $reused);
my $get_mbps = sub {
@@ -317,6 +317,7 @@ my $query_backup_status_loop = sub {
};
my $target = 0;
+ my $last_reused = 0;
my $has_query_bitmap = 0;
if (defined($pbs_features) && $pbs_features->{'query-bitmap-info'}) {
$has_query_bitmap = 1;
@@ -328,6 +329,7 @@ my $query_backup_status_loop = sub {
$drive =~ s/^drive-//; # for consistency
$self->loginfo("$drive: $text");
$target += $info->{dirty};
+ $last_reused += $info->{size} - $info->{dirty};
}
}
@@ -347,7 +349,13 @@ my $query_backup_status_loop = sub {
my $duration = $ctime - $starttime;
my $rbytes = $transferred - $last_transferred;
- my $wbytes = $rbytes - ($zero - $last_zero);
+ my $wbytes;
+ if ($reused) {
+ # reused includes zero bytes for PBS
+ $wbytes = $rbytes - ($reused - $last_reused);
+ } else {
+ $wbytes = $rbytes - ($zero - $last_zero);
+ }
my $timediff = ($ctime - $last_time) || 1; # fixme
my $mbps_read = $get_mbps->($rbytes, $timediff);
@@ -379,6 +387,7 @@ my $query_backup_status_loop = sub {
$last_zero = $zero if $zero;
$last_transferred = $transferred if $transferred;
$last_time = $ctime;
+ $last_reused = $reused;
}
sleep(1);
}
--
2.20.1
next prev parent reply other threads:[~2020-08-13 12:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-13 12:03 [pve-devel] [PATCH 0/4] improve logging for dirty bitmap PBS backups Stefan Reiter
2020-08-13 12:03 ` [pve-devel] [PATCH qemu 1/4] PVE: add query-pbs-bitmap-info QMP call Stefan Reiter
2020-08-19 9:41 ` Thomas Lamprecht
2020-08-13 12:03 ` [pve-devel] [PATCH qemu-server 2/4] vzdump: improve logging output with dirty bitmaps Stefan Reiter
2020-08-13 12:03 ` Stefan Reiter [this message]
2020-08-13 12:03 ` [pve-devel] [PATCH qemu-server 4/4] vzdump: log 100% percent in case $target is 0 Stefan Reiter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200813120334.20928-4-s.reiter@proxmox.com \
--to=s.reiter@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox