[pve-devel] [PATCH qemu-server 1/2] rescan update_disksize: be more verbose

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Jul 5 15:36:42 CEST 2018


Else an user has no idea what, or if something happened.

Gets printed to tty when using qm rescan or to tasklog for the case
where we do a rescan after restoring a backup.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 PVE/QemuServer.pm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 5829e4c..90bf745 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -5539,6 +5539,8 @@ sub update_disksize {
 
     my $changes;
 
+    my $print = sub { print "VM $vmid: $_[0]\n"; };
+
     # used and unused disks
     my $referenced = {};
 
@@ -5569,6 +5571,7 @@ sub update_disksize {
 	    if ($new ne $conf->{$opt}) {
 		$changes = 1;
 		$conf->{$opt} = $new;
+		$print->("update disk '$opt' information.");
 	    }
 	}
     }
@@ -5579,6 +5582,7 @@ sub update_disksize {
 	my $volid = $conf->{$opt};
 	my $path = $volid_hash->{$volid}->{path} if $volid_hash->{$volid};
 	if ($referenced->{$volid} || ($path && $referencedpath->{$path})) {
+	    $print->("remove entry '$opt', its volume '$volid' is in use.");
 	    $changes = 1;
 	    delete $conf->{$opt};
 	}
@@ -5594,7 +5598,8 @@ sub update_disksize {
 	next if !$path; # just to be sure
 	next if $referencedpath->{$path};
 	$changes = 1;
-	PVE::QemuConfig->add_unused_volume($conf, $volid);
+	my $key = PVE::QemuConfig->add_unused_volume($conf, $volid);
+	$print->("add unreferenced volume '$volid' as '$key' to config.");
 	$referencedpath->{$path} = 1; # avoid to add more than once (aliases)
     }
 
@@ -5617,6 +5622,8 @@ sub rescan {
     my $updatefn =  sub {
 	my ($vmid) = @_;
 
+	print "rescan volumes of VM $vmid...\n";
+
 	my $conf = PVE::QemuConfig->load_config($vmid);
 
 	PVE::QemuConfig->check_lock($conf);
-- 
2.18.0





More information about the pve-devel mailing list