public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH v2 common 1/6] extract PVE::Format from PVE::CLIFormatter for reuse
@ 2021-02-08 11:15 Stefan Reiter
  2021-02-08 11:15 ` [pve-devel] [PATCH v2 common 2/6] format: handle undef, 0, and decimals in render_duration Stefan Reiter
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Stefan Reiter @ 2021-02-08 11:15 UTC (permalink / raw)
  To: pve-devel

and add some tests

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---
 src/Makefile            |  1 +
 src/PVE/CLIFormatter.pm | 81 ++++++-----------------------------------
 src/PVE/Format.pm       | 77 +++++++++++++++++++++++++++++++++++++++
 test/format_test.pl     | 29 ++++++++++++++-
 4 files changed, 117 insertions(+), 71 deletions(-)
 create mode 100644 src/PVE/Format.pm

diff --git a/src/Makefile b/src/Makefile
index 098a648..13de6c6 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -16,6 +16,7 @@ LIB_SOURCES = \
 	CGroup.pm \
 	Daemon.pm \
 	Exception.pm \
+	Format.pm \
 	INotify.pm \
 	JSONSchema.pm \
 	LDAP.pm \
diff --git a/src/PVE/CLIFormatter.pm b/src/PVE/CLIFormatter.pm
index ccecfc3..c2f92d2 100644
--- a/src/PVE/CLIFormatter.pm
+++ b/src/PVE/CLIFormatter.pm
@@ -4,86 +4,27 @@ use strict;
 use warnings;
 
 use I18N::Langinfo;
-use POSIX qw(strftime);
 use YAML::XS; # supports Dumping JSON::PP::Boolean
 $YAML::XS::Boolean = "JSON::PP";
 
 use PVE::JSONSchema;
 use PVE::PTY;
+use PVE::Format;
 
 use JSON;
 use utf8;
 use Encode;
 
-sub render_timestamp {
-    my ($epoch) = @_;
-
-    # ISO 8601 date format
-    return strftime("%F %H:%M:%S", localtime($epoch));
-}
-
-PVE::JSONSchema::register_renderer('timestamp', \&render_timestamp);
-
-sub render_timestamp_gmt {
-    my ($epoch) = @_;
-
-    # ISO 8601 date format, standard Greenwich time zone
-    return strftime("%F %H:%M:%S", gmtime($epoch));
-}
-
-PVE::JSONSchema::register_renderer('timestamp_gmt', \&render_timestamp_gmt);
-
-sub render_duration {
-    my ($duration_in_seconds) = @_;
-
-    my $text = '';
-    my $rest = $duration_in_seconds;
-
-    my $step = sub {
-	my ($unit, $unitlength) = @_;
-
-	if ((my $v = int($rest/$unitlength)) > 0) {
-	    $text .= " " if length($text);
-	    $text .= "${v}${unit}";
-	    $rest -= $v * $unitlength;
-	}
-    };
-
-    $step->('w', 7*24*3600);
-    $step->('d', 24*3600);
-    $step->('h', 3600);
-    $step->('m', 60);
-    $step->('s', 1);
-
-    return $text;
-}
-
-PVE::JSONSchema::register_renderer('duration', \&render_duration);
-
-sub render_fraction_as_percentage {
-    my ($fraction) = @_;
-
-    return sprintf("%.2f%%", $fraction*100);
-}
-
-PVE::JSONSchema::register_renderer(
-    'fraction_as_percentage', \&render_fraction_as_percentage);
-
-sub render_bytes {
-    my ($value) = @_;
-
-    my @units = qw(B KiB MiB GiB TiB PiB);
-
-    my $max_unit = 0;
-    if ($value > 1023) {
-        $max_unit = int(log($value)/log(1024));
-        $value /= 1024**($max_unit);
-    }
-    my $unit = $units[$max_unit];
-    return sprintf "%.2f $unit", $value;
-}
-
-PVE::JSONSchema::register_renderer('bytes', \&render_bytes);
+PVE::JSONSchema::register_renderer('timestamp',
+    \&PVE::Format::render_timestamp);
+PVE::JSONSchema::register_renderer('timestamp_gmt',
+    \&PVE::Format::render_timestamp_gmt);
+PVE::JSONSchema::register_renderer('duration',
+    \&PVE::Format::render_duration);
+PVE::JSONSchema::register_renderer('fraction_as_percentage',
+    \&PVE::Format::render_fraction_as_percentage);
+PVE::JSONSchema::register_renderer('bytes',
+    \&PVE::Format::render_bytes);
 
 sub render_yaml {
     my ($value) = @_;
diff --git a/src/PVE/Format.pm b/src/PVE/Format.pm
new file mode 100644
index 0000000..7c3c062
--- /dev/null
+++ b/src/PVE/Format.pm
@@ -0,0 +1,77 @@
+package PVE::Format;
+
+use strict;
+use warnings;
+
+use POSIX qw(strftime);
+use PVE::JSONSchema;
+
+use base 'Exporter';
+our @EXPORT_OK = qw(
+render_timestamp
+render_timestamp_gmt
+render_duration
+render_fraction_as_percentage
+render_bytes
+);
+
+sub render_timestamp {
+    my ($epoch) = @_;
+
+    # ISO 8601 date format
+    return strftime("%F %H:%M:%S", localtime($epoch));
+}
+
+sub render_timestamp_gmt {
+    my ($epoch) = @_;
+
+    # ISO 8601 date format, standard Greenwich time zone
+    return strftime("%F %H:%M:%S", gmtime($epoch));
+}
+
+sub render_duration {
+    my ($duration_in_seconds) = @_;
+
+    my $text = '';
+    my $rest = $duration_in_seconds;
+
+    my $step = sub {
+	my ($unit, $unitlength) = @_;
+
+	if ((my $v = int($rest/$unitlength)) > 0) {
+	    $text .= " " if length($text);
+	    $text .= "${v}${unit}";
+	    $rest -= $v * $unitlength;
+	}
+    };
+
+    $step->('w', 7*24*3600);
+    $step->('d', 24*3600);
+    $step->('h', 3600);
+    $step->('m', 60);
+    $step->('s', 1);
+
+    return $text;
+}
+
+sub render_fraction_as_percentage {
+    my ($fraction) = @_;
+
+    return sprintf("%.2f%%", $fraction*100);
+}
+
+sub render_bytes {
+    my ($value, $precision) = @_;
+
+    my @units = qw(B KiB MiB GiB TiB PiB);
+
+    my $max_unit = 0;
+    if ($value > 1023) {
+        $max_unit = int(log($value)/log(1024));
+        $value /= 1024**($max_unit);
+    }
+    my $unit = $units[$max_unit];
+    return sprintf "%." . ($precision || 2) . "f $unit", $value;
+}
+
+1;
diff --git a/test/format_test.pl b/test/format_test.pl
index 3f225de..b6688ab 100755
--- a/test/format_test.pl
+++ b/test/format_test.pl
@@ -5,6 +5,7 @@ use warnings;
 
 use lib '../src';
 use PVE::JSONSchema;
+use PVE::CLIFormatter;
 
 use Test::More;
 use Test::MockModule;
@@ -24,4 +25,30 @@ foreach my $id (@$invalid_configids) {
     is(PVE::JSONSchema::pve_verify_configid($id, $noerr), undef, 'invalid configid');
 }
 
-done_testing();
\ No newline at end of file
+# test some string rendering
+my $render_data = [
+    ["timestamp", 0, undef, "1970-01-01 01:00:00"],
+    ["timestamp", 1612776831, undef, "2021-02-08 10:33:51"],
+    ["timestamp_gmt", 0, undef, "1970-01-01 00:00:00"],
+    ["timestamp_gmt", 1612776831, undef, "2021-02-08 09:33:51"],
+    ["duration", 0, undef, ""],
+    ["duration", 40, undef, "40s"],
+    ["duration", 60, undef, "1m"],
+    ["duration", 110, undef, "1m 50s"],
+    ["duration", 7*24*3829*2, undef, "2w 21h 22m 24s"],
+    ["fraction_as_percentage", 0.412, undef, "41.20%"],
+    ["bytes", 0, undef, "0.00 B"],
+    ["bytes", 1023, 4, "1023.0000 B"],
+    ["bytes", 1024, undef, "1.00 KiB"],
+    ["bytes", 1024*1024*123 + 1024*300, 1, "123.3 MiB"],
+    ["bytes", 1024*1024*1024*1024*4 + 1024*1024*2048*8, undef, "4.02 TiB"],
+];
+
+foreach my $data (@$render_data) {
+    my ($renderer_name, $p1, $p2, $expected) = @$data;
+    my $renderer = PVE::JSONSchema::get_renderer($renderer_name);
+    my $actual = $renderer->($p1, $p2);
+    is($actual, $expected, "string format '$renderer_name'");
+}
+
+done_testing();
-- 
2.20.1





^ permalink raw reply	[flat|nested] 12+ messages in thread

* [pve-devel] [PATCH v2 common 2/6] format: handle undef, 0, and decimals in render_duration
  2021-02-08 11:15 [pve-devel] [PATCH v2 common 1/6] extract PVE::Format from PVE::CLIFormatter for reuse Stefan Reiter
@ 2021-02-08 11:15 ` Stefan Reiter
  2021-02-08 14:04   ` [pve-devel] applied: " Thomas Lamprecht
  2021-02-08 11:15 ` [pve-devel] [PATCH v2 qemu-server 3/6] vzdump: use renderers from Tools instead of duplicating code Stefan Reiter
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Stefan Reiter @ 2021-02-08 11:15 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---

This might be a "breaking" change for some situations, but I believe this should
be more correct in the long run... If this is not wanted, we must do a ceil() or
similar on the value passed in from patch 4/6, otherwise it will not print a
time value for the first iteration.

 src/PVE/Format.pm   | 6 ++++--
 test/format_test.pl | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/PVE/Format.pm b/src/PVE/Format.pm
index 7c3c062..b345129 100644
--- a/src/PVE/Format.pm
+++ b/src/PVE/Format.pm
@@ -3,7 +3,7 @@ package PVE::Format;
 use strict;
 use warnings;
 
-use POSIX qw(strftime);
+use POSIX qw(strftime round);
 use PVE::JSONSchema;
 
 use base 'Exporter';
@@ -33,7 +33,9 @@ sub render_duration {
     my ($duration_in_seconds) = @_;
 
     my $text = '';
-    my $rest = $duration_in_seconds;
+    my $rest = round($duration_in_seconds // 0);
+
+    return "0s" if !$rest;
 
     my $step = sub {
 	my ($unit, $unitlength) = @_;
diff --git a/test/format_test.pl b/test/format_test.pl
index b6688ab..32c00f1 100755
--- a/test/format_test.pl
+++ b/test/format_test.pl
@@ -31,9 +31,11 @@ my $render_data = [
     ["timestamp", 1612776831, undef, "2021-02-08 10:33:51"],
     ["timestamp_gmt", 0, undef, "1970-01-01 00:00:00"],
     ["timestamp_gmt", 1612776831, undef, "2021-02-08 09:33:51"],
-    ["duration", 0, undef, ""],
+    ["duration", undef, undef, "0s"],
+    ["duration", 0.3, undef, "0s"],
+    ["duration", 0, undef, "0s"],
     ["duration", 40, undef, "40s"],
-    ["duration", 60, undef, "1m"],
+    ["duration", 59.64432, undef, "1m"],
     ["duration", 110, undef, "1m 50s"],
     ["duration", 7*24*3829*2, undef, "2w 21h 22m 24s"],
     ["fraction_as_percentage", 0.412, undef, "41.20%"],
-- 
2.20.1





^ permalink raw reply	[flat|nested] 12+ messages in thread

* [pve-devel] [PATCH v2 qemu-server 3/6] vzdump: use renderers from Tools instead of duplicating code
  2021-02-08 11:15 [pve-devel] [PATCH v2 common 1/6] extract PVE::Format from PVE::CLIFormatter for reuse Stefan Reiter
  2021-02-08 11:15 ` [pve-devel] [PATCH v2 common 2/6] format: handle undef, 0, and decimals in render_duration Stefan Reiter
@ 2021-02-08 11:15 ` Stefan Reiter
  2021-02-11 16:17   ` [pve-devel] applied: " Thomas Lamprecht
  2021-02-08 11:15 ` [pve-devel] [PATCH v2 qemu-server 4/6] savevm: periodically print progress Stefan Reiter
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Stefan Reiter @ 2021-02-08 11:15 UTC (permalink / raw)
  To: pve-devel

...taking card not to lose the custom precision for byte conversion.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---

v2:
* add precision parameter to render_bytes

now needs a dependency bump on common

 PVE/VZDump/QemuServer.pm | 64 ++++++++--------------------------------
 1 file changed, 13 insertions(+), 51 deletions(-)

diff --git a/PVE/VZDump/QemuServer.pm b/PVE/VZDump/QemuServer.pm
index b5e74d3..901b366 100644
--- a/PVE/VZDump/QemuServer.pm
+++ b/PVE/VZDump/QemuServer.pm
@@ -21,6 +21,7 @@ use PVE::Storage::PBSPlugin;
 use PVE::Storage;
 use PVE::Tools;
 use PVE::VZDump;
+use PVE::Format qw(render_duration render_bytes);
 
 use PVE::QemuConfig;
 use PVE::QemuServer;
@@ -262,45 +263,6 @@ sub archive {
     }
 }
 
-# number, [precision=1]
-my $num2str = sub {
-    return sprintf( "%." . ( $_[1] || 1 ) . "f", $_[0] );
-};
-my sub bytes_to_human {
-    my ($bytes, $precission) = @_;
-
-    return $num2str->($bytes, $precission) . ' B' if $bytes < 1024;
-    my $kb = $bytes/1024;
-
-    return $num2str->($kb, $precission) . " KiB" if $kb < 1024;
-    my $mb = $kb/1024;
-
-    return $num2str->($mb, $precission) . " MiB" if $mb < 1024;
-    my $gb = $mb/1024;
-
-    return $num2str->($gb, $precission) . " GiB" if $gb < 1024;
-    my $tb = $gb/1024;
-
-    return $num2str->($tb, $precission) . " TiB";
-}
-my sub duration_to_human {
-    my ($seconds) = @_;
-
-    return sprintf('%2ds', $seconds) if $seconds < 60;
-    my $minutes = $seconds / 60;
-    $seconds = $seconds % 60;
-
-    return sprintf('%2dm %2ds', $minutes, $seconds) if $minutes < 60;
-    my $hours = $minutes / 60;
-    $minutes = $minutes % 60;
-
-    return sprintf('%2dh %2dm %2ds', $hours, $minutes, $seconds) if $hours < 24;
-    my $days = $hours / 24;
-    $hours = $hours % 24;
-
-    return sprintf('%2dd %2dh %2dm', $days, $hours, $minutes);
-}
-
 my $bitmap_action_to_human = sub {
     my ($self, $info) = @_;
 
@@ -316,8 +278,8 @@ my $bitmap_action_to_human = sub {
 	if ($info->{dirty} == 0) {
 	    return "OK (drive clean)";
 	} else {
-	    my $size = bytes_to_human($info->{size});
-	    my $dirty = bytes_to_human($info->{dirty});
+	    my $size = render_bytes($info->{size}, 1);
+	    my $dirty = render_bytes($info->{dirty}, 1);
 	    return "OK ($dirty of $size dirty)";
 	}
     } elsif ($action eq "invalid") {
@@ -339,7 +301,7 @@ my $query_backup_status_loop = sub {
 	my ($mb, $delta) = @_;
 	return "0 B/s" if $mb <= 0;
 	my $bw = int(($mb / $delta));
-	return bytes_to_human($bw) . "/s";
+	return render_bytes($bw, 1) . "/s";
     };
 
     my $target = 0;
@@ -361,8 +323,8 @@ my $query_backup_status_loop = sub {
 	    $last_reused += $info->{size} - $info->{dirty};
 	}
 	if ($target < $total) {
-	    my $total_h = bytes_to_human($total);
-	    my $target_h = bytes_to_human($target);
+	    my $total_h = render_bytes($total, 1);
+	    my $target_h = render_bytes($target, 1);
 	    $self->loginfo("using fast incremental mode (dirty-bitmap), $target_h dirty of $total_h total");
 	}
     }
@@ -397,16 +359,16 @@ my $query_backup_status_loop = sub {
 	my $timediff = ($ctime - $last_time) || 1; # fixme
 	my $mbps_read = $get_mbps->($rbytes, $timediff);
 	my $mbps_write = $get_mbps->($wbytes, $timediff);
-	my $target_h = bytes_to_human($target);
-	my $transferred_h = bytes_to_human($transferred);
+	my $target_h = render_bytes($target, 1);
+	my $transferred_h = render_bytes($transferred, 1);
 
 	if (!$has_query_bitmap && $first_round && $target != $total) { # FIXME: remove with PVE 7.0
-	    my $total_h = bytes_to_human($total);
+	    my $total_h = render_bytes($total, 1);
 	    $self->loginfo("using fast incremental mode (dirty-bitmap), $target_h dirty of $total_h total");
 	}
 
 	my $statusline = sprintf("%3d%% ($transferred_h of $target_h) in %s"
-	    .", read: $mbps_read, write: $mbps_write", $percent, duration_to_human($duration));
+	    .", read: $mbps_read, write: $mbps_write", $percent, render_duration($duration));
 
 	my $res = $status->{status} || 'unknown';
 	if ($res ne 'active') {
@@ -446,16 +408,16 @@ my $query_backup_status_loop = sub {
 
     if ($last_zero) {
 	my $zero_per = $last_target ? int(($last_zero * 100)/$last_target) : 0;
-	my $zero_h = bytes_to_human($last_zero, 2);
+	my $zero_h = render_bytes($last_zero);
 	$self->loginfo("backup is sparse: $zero_h (${zero_per}%) total zero data");
     }
     if ($reused) {
-	my $reused_h = bytes_to_human($reused, 2);
+	my $reused_h = render_bytes($reused);
 	my $reuse_per = int($reused * 100 / $last_total);
 	$self->loginfo("backup was done incrementally, reused $reused_h (${reuse_per}%)");
     }
     if ($transferred) {
-	my $transferred_h = bytes_to_human($transferred, 2);
+	my $transferred_h = render_bytes($transferred);
 	if ($duration) {
 	    my $mbps = $get_mbps->($transferred, $duration);
 	    $self->loginfo("transferred $transferred_h in $duration seconds ($mbps)");
-- 
2.20.1





^ permalink raw reply	[flat|nested] 12+ messages in thread

* [pve-devel] [PATCH v2 qemu-server 4/6] savevm: periodically print progress
  2021-02-08 11:15 [pve-devel] [PATCH v2 common 1/6] extract PVE::Format from PVE::CLIFormatter for reuse Stefan Reiter
  2021-02-08 11:15 ` [pve-devel] [PATCH v2 common 2/6] format: handle undef, 0, and decimals in render_duration Stefan Reiter
  2021-02-08 11:15 ` [pve-devel] [PATCH v2 qemu-server 3/6] vzdump: use renderers from Tools instead of duplicating code Stefan Reiter
@ 2021-02-08 11:15 ` Stefan Reiter
  2021-02-11 16:19   ` [pve-devel] applied: " Thomas Lamprecht
  2021-02-08 11:15 ` [pve-devel] [PATCH v2 qemu-server 5/6] savevm: show information about drives during snapshot Stefan Reiter
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Stefan Reiter @ 2021-02-08 11:15 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---

v2:
* rename helper
* return tuple
* use 'total-time'
* improve messages

 PVE/QemuConfig.pm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/PVE/QemuConfig.pm b/PVE/QemuConfig.pm
index 3f4605f..0c4b8fd 100644
--- a/PVE/QemuConfig.pm
+++ b/PVE/QemuConfig.pm
@@ -14,6 +14,7 @@ use PVE::QemuServer;
 use PVE::QemuServer::Machine;
 use PVE::Storage;
 use PVE::Tools;
+use PVE::Format qw(render_bytes render_duration);
 
 use base qw(PVE::AbstractConfig);
 
@@ -280,14 +281,25 @@ sub __snapshot_create_vol_snapshots_hook {
 		PVE::Storage::activate_volumes($storecfg, [$snap->{vmstate}]);
 
 		mon_cmd($vmid, "savevm-start", statefile => $path);
+		print "saving VM state and RAM\n";
+		my $render_state = sub {
+		    my ($stat) = @_;
+		    my $b = render_bytes($stat->{bytes});
+		    my $t = render_duration($stat->{'total-time'} / 1000);
+		    return ($b, $t);
+		};
 		for(;;) {
 		    my $stat = mon_cmd($vmid, "query-savevm");
 		    if (!$stat->{status}) {
 			die "savevm not active\n";
 		    } elsif ($stat->{status} eq 'active') {
 			sleep(1);
+			my ($b, $t) = $render_state->($stat);
+			print "$b in $t\n";
 			next;
 		    } elsif ($stat->{status} eq 'completed') {
+			my ($b, $t) = $render_state->($stat);
+			print "completed savevm in $t, saved $b\n";
 			last;
 		    } else {
 			die "query-savevm returned status '$stat->{status}'\n";
-- 
2.20.1





^ permalink raw reply	[flat|nested] 12+ messages in thread

* [pve-devel] [PATCH v2 qemu-server 5/6] savevm: show information about drives during snapshot
  2021-02-08 11:15 [pve-devel] [PATCH v2 common 1/6] extract PVE::Format from PVE::CLIFormatter for reuse Stefan Reiter
                   ` (2 preceding siblings ...)
  2021-02-08 11:15 ` [pve-devel] [PATCH v2 qemu-server 4/6] savevm: periodically print progress Stefan Reiter
@ 2021-02-08 11:15 ` Stefan Reiter
  2021-02-11 16:19   ` [pve-devel] applied: " Thomas Lamprecht
  2021-02-08 11:15 ` [pve-devel] [PATCH v2 manager 6/6] ui: snapshot: show task viewer for progress log Stefan Reiter
  2021-02-08 14:03 ` [pve-devel] applied: [PATCH v2 common 1/6] extract PVE::Format from PVE::CLIFormatter for reuse Thomas Lamprecht
  5 siblings, 1 reply; 12+ messages in thread
From: Stefan Reiter @ 2021-02-08 11:15 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---

v2:
* use $device

 PVE/QemuConfig.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/PVE/QemuConfig.pm b/PVE/QemuConfig.pm
index 0c4b8fd..31b3e36 100644
--- a/PVE/QemuConfig.pm
+++ b/PVE/QemuConfig.pm
@@ -339,6 +339,8 @@ sub __snapshot_create_vol_snapshot {
     my $device = "drive-$ds";
     my $storecfg = PVE::Storage::config();
 
+    print "snapshotting '$device' ($drive->{file})\n";
+
     PVE::QemuServer::qemu_volume_snapshot($vmid, $device, $storecfg, $volid, $snapname);
 }
 
-- 
2.20.1





^ permalink raw reply	[flat|nested] 12+ messages in thread

* [pve-devel] [PATCH v2 manager 6/6] ui: snapshot: show task viewer for progress log
  2021-02-08 11:15 [pve-devel] [PATCH v2 common 1/6] extract PVE::Format from PVE::CLIFormatter for reuse Stefan Reiter
                   ` (3 preceding siblings ...)
  2021-02-08 11:15 ` [pve-devel] [PATCH v2 qemu-server 5/6] savevm: show information about drives during snapshot Stefan Reiter
@ 2021-02-08 11:15 ` Stefan Reiter
  2021-02-11 17:19   ` [pve-devel] applied: " Thomas Lamprecht
  2021-02-08 14:03 ` [pve-devel] applied: [PATCH v2 common 1/6] extract PVE::Format from PVE::CLIFormatter for reuse Thomas Lamprecht
  5 siblings, 1 reply; 12+ messages in thread
From: Stefan Reiter @ 2021-02-08 11:15 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---

v2:
* always show task viewer, since with patch 5 we always print something to the
  task log - I'm honestly fine with whatever here, might as well apply v1 of
  this or go with Fabians idea and use 'vmstate' as well...

 www/manager6/window/Snapshot.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/www/manager6/window/Snapshot.js b/www/manager6/window/Snapshot.js
index 2fa97041..426be7cc 100644
--- a/www/manager6/window/Snapshot.js
+++ b/www/manager6/window/Snapshot.js
@@ -139,7 +139,7 @@ Ext.define('PVE.window.Snapshot', {
 	if (me.isCreate) {
 	    subject = (me.type === 'qemu' ? 'VM' : 'CT') + me.vmid + ' ' + gettext('Snapshot');
 	    me.method = 'POST';
-	    me.showProgress = true;
+	    me.showTaskViewer = true;
 	} else {
 	    subject = `${gettext('Snapshot')} ${me.snapname}`;
 	    me.url += `/${me.snapname}/config`;
-- 
2.20.1





^ permalink raw reply	[flat|nested] 12+ messages in thread

* [pve-devel] applied: [PATCH v2 common 1/6] extract PVE::Format from PVE::CLIFormatter for reuse
  2021-02-08 11:15 [pve-devel] [PATCH v2 common 1/6] extract PVE::Format from PVE::CLIFormatter for reuse Stefan Reiter
                   ` (4 preceding siblings ...)
  2021-02-08 11:15 ` [pve-devel] [PATCH v2 manager 6/6] ui: snapshot: show task viewer for progress log Stefan Reiter
@ 2021-02-08 14:03 ` Thomas Lamprecht
  5 siblings, 0 replies; 12+ messages in thread
From: Thomas Lamprecht @ 2021-02-08 14:03 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stefan Reiter

On 08.02.21 12:15, Stefan Reiter wrote:
> and add some tests
> 
> Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
> ---
>  src/Makefile            |  1 +
>  src/PVE/CLIFormatter.pm | 81 ++++++-----------------------------------
>  src/PVE/Format.pm       | 77 +++++++++++++++++++++++++++++++++++++++
>  test/format_test.pl     | 29 ++++++++++++++-
>  4 files changed, 117 insertions(+), 71 deletions(-)
>  create mode 100644 src/PVE/Format.pm
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 12+ messages in thread

* [pve-devel] applied:  [PATCH v2 common 2/6] format: handle undef, 0, and decimals in render_duration
  2021-02-08 11:15 ` [pve-devel] [PATCH v2 common 2/6] format: handle undef, 0, and decimals in render_duration Stefan Reiter
@ 2021-02-08 14:04   ` Thomas Lamprecht
  0 siblings, 0 replies; 12+ messages in thread
From: Thomas Lamprecht @ 2021-02-08 14:04 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stefan Reiter

On 08.02.21 12:15, Stefan Reiter wrote:
> Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
> ---
> 
> This might be a "breaking" change for some situations, but I believe this should
> be more correct in the long run... If this is not wanted, we must do a ceil() or
> similar on the value passed in from patch 4/6, otherwise it will not print a
> time value for the first iteration.
> 
>  src/PVE/Format.pm   | 6 ++++--
>  test/format_test.pl | 6 ++++--
>  2 files changed, 8 insertions(+), 4 deletions(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 12+ messages in thread

* [pve-devel] applied: [PATCH v2 qemu-server 3/6] vzdump: use renderers from Tools instead of duplicating code
  2021-02-08 11:15 ` [pve-devel] [PATCH v2 qemu-server 3/6] vzdump: use renderers from Tools instead of duplicating code Stefan Reiter
@ 2021-02-11 16:17   ` Thomas Lamprecht
  0 siblings, 0 replies; 12+ messages in thread
From: Thomas Lamprecht @ 2021-02-11 16:17 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stefan Reiter

On 08.02.21 12:15, Stefan Reiter wrote:
> ...taking card not to lose the custom precision for byte conversion.
> 
> Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
> ---
> 
> v2:
> * add precision parameter to render_bytes
> 
> now needs a dependency bump on common
> 
>  PVE/VZDump/QemuServer.pm | 64 ++++++++--------------------------------
>  1 file changed, 13 insertions(+), 51 deletions(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 12+ messages in thread

* [pve-devel] applied: [PATCH v2 qemu-server 4/6] savevm: periodically print progress
  2021-02-08 11:15 ` [pve-devel] [PATCH v2 qemu-server 4/6] savevm: periodically print progress Stefan Reiter
@ 2021-02-11 16:19   ` Thomas Lamprecht
  0 siblings, 0 replies; 12+ messages in thread
From: Thomas Lamprecht @ 2021-02-11 16:19 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stefan Reiter

On 08.02.21 12:15, Stefan Reiter wrote:
> Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
> ---
> 
> v2:
> * rename helper
> * return tuple
> * use 'total-time'
> * improve messages
> 
>  PVE/QemuConfig.pm | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
>

applied, thanks!

made some adaptions though:
* switch to lower reporting interval (1/10 Hz) after 1 minute
* log used state storage




^ permalink raw reply	[flat|nested] 12+ messages in thread

* [pve-devel] applied: [PATCH v2 qemu-server 5/6] savevm: show information about drives during snapshot
  2021-02-08 11:15 ` [pve-devel] [PATCH v2 qemu-server 5/6] savevm: show information about drives during snapshot Stefan Reiter
@ 2021-02-11 16:19   ` Thomas Lamprecht
  0 siblings, 0 replies; 12+ messages in thread
From: Thomas Lamprecht @ 2021-02-11 16:19 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stefan Reiter

On 08.02.21 12:15, Stefan Reiter wrote:
> Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
> ---
> 
> v2:
> * use $device
> 
>  PVE/QemuConfig.pm | 2 ++
>  1 file changed, 2 insertions(+)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 12+ messages in thread

* [pve-devel] applied: [PATCH v2 manager 6/6] ui: snapshot: show task viewer for progress log
  2021-02-08 11:15 ` [pve-devel] [PATCH v2 manager 6/6] ui: snapshot: show task viewer for progress log Stefan Reiter
@ 2021-02-11 17:19   ` Thomas Lamprecht
  0 siblings, 0 replies; 12+ messages in thread
From: Thomas Lamprecht @ 2021-02-11 17:19 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stefan Reiter

On 08.02.21 12:15, Stefan Reiter wrote:
> Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
> ---
> 
> v2:
> * always show task viewer, since with patch 5 we always print something to the
>   task log - I'm honestly fine with whatever here, might as well apply v1 of
>   this or go with Fabians idea and use 'vmstate' as well...
> 
>  www/manager6/window/Snapshot.js | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-02-11 17:19 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-08 11:15 [pve-devel] [PATCH v2 common 1/6] extract PVE::Format from PVE::CLIFormatter for reuse Stefan Reiter
2021-02-08 11:15 ` [pve-devel] [PATCH v2 common 2/6] format: handle undef, 0, and decimals in render_duration Stefan Reiter
2021-02-08 14:04   ` [pve-devel] applied: " Thomas Lamprecht
2021-02-08 11:15 ` [pve-devel] [PATCH v2 qemu-server 3/6] vzdump: use renderers from Tools instead of duplicating code Stefan Reiter
2021-02-11 16:17   ` [pve-devel] applied: " Thomas Lamprecht
2021-02-08 11:15 ` [pve-devel] [PATCH v2 qemu-server 4/6] savevm: periodically print progress Stefan Reiter
2021-02-11 16:19   ` [pve-devel] applied: " Thomas Lamprecht
2021-02-08 11:15 ` [pve-devel] [PATCH v2 qemu-server 5/6] savevm: show information about drives during snapshot Stefan Reiter
2021-02-11 16:19   ` [pve-devel] applied: " Thomas Lamprecht
2021-02-08 11:15 ` [pve-devel] [PATCH v2 manager 6/6] ui: snapshot: show task viewer for progress log Stefan Reiter
2021-02-11 17:19   ` [pve-devel] applied: " Thomas Lamprecht
2021-02-08 14:03 ` [pve-devel] applied: [PATCH v2 common 1/6] extract PVE::Format from PVE::CLIFormatter for reuse Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal