[pve-devel] [PATCH qemu-server v2] Display volume size in log when doing a volume backup

Emmanuel Kasper e.kasper at proxmox.com
Tue Dec 20 11:33:01 CET 2016


Output before this patch
INFO: include disk 'scsi0' 'file=pve4tank:vm-402-disk-1'

Output after this patch:
INFO: include disk 'scsi0' 'file=pve4tank:vm-402-disk-1' 64G

we're mainly intersted by the volume size here, it was requested in #351
---
changes since V1:
 * only display the volume size if available, not the whole volume
 options (iothread, etc ...)
 PVE/VZDump/QemuServer.pm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/PVE/VZDump/QemuServer.pm b/PVE/VZDump/QemuServer.pm
index 6a58a79..da3ee06 100644
--- a/PVE/VZDump/QemuServer.pm
+++ b/PVE/VZDump/QemuServer.pm
@@ -12,6 +12,7 @@ use PVE::Tools;
 use PVE::Storage::Plugin;
 use PVE::Storage;
 use PVE::QemuServer;
+use PVE::JSONSchema;
 use IO::File;
 use IPC::Open3;
 
@@ -75,7 +76,12 @@ sub prepare {
 	} elsif ($drive->{iothread}) {
 	    die "disk '$ds' '$volid' (iothread=on) can't use backup feature currently. Please set backup=no for this drive";
 	} else {
-	    $self->loginfo("include disk '$ds' '$volid'");
+	    my $log = "include disk '$ds' '$volid'";
+	   if (defined $drive->{size}) {
+		my $readable_size = PVE::JSONSchema::format_size($drive->{size});
+		$log .= " $readable_size";
+	   }
+	    $self->loginfo($log);
 	}
 
 	my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid, 1);
-- 
2.1.4





More information about the pve-devel mailing list