Display volume size in log when doing a volume backup

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
This commit is contained in:
Emmanuel Kasper 2016-12-20 11:33:01 +01:00 committed by Dietmar Maurer
parent 3a65f4c9de
commit 0db93c2d8a

View File

@ -12,6 +12,7 @@ use PVE::Tools;
use PVE::Storage::Plugin; use PVE::Storage::Plugin;
use PVE::Storage; use PVE::Storage;
use PVE::QemuServer; use PVE::QemuServer;
use PVE::JSONSchema;
use IO::File; use IO::File;
use IPC::Open3; use IPC::Open3;
@ -75,7 +76,12 @@ sub prepare {
} elsif ($drive->{iothread}) { } elsif ($drive->{iothread}) {
die "disk '$ds' '$volid' (iothread=on) can't use backup feature currently. Please set backup=no for this drive"; die "disk '$ds' '$volid' (iothread=on) can't use backup feature currently. Please set backup=no for this drive";
} else { } 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); my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid, 1);