[pve-devel] [PATCH container 3/4] Log storage_migrate output

Fabian Ebner f.ebner at proxmox.com
Wed Jul 29 11:44:17 CEST 2020


and make it more clear where an error within storage_migrate came from.

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 src/PVE/LXC/Migrate.pm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/PVE/LXC/Migrate.pm b/src/PVE/LXC/Migrate.pm
index e482657..90d74b4 100644
--- a/src/PVE/LXC/Migrate.pm
+++ b/src/PVE/LXC/Migrate.pm
@@ -292,7 +292,14 @@ sub phase1 {
 	    'with_snapshots' => $volhash->{$volid}->{snapshots},
 	};
 
-	PVE::Storage::storage_migrate($self->{storecfg}, $volid, $self->{ssh_info}, $sid, $storage_migrate_opts);
+	my $logfunc = sub { $self->log('info', $_[0]); };
+	eval {
+	    PVE::Storage::storage_migrate($self->{storecfg}, $volid, $self->{ssh_info},
+					  $sid, $storage_migrate_opts, $logfunc);
+	};
+	if (my $err = $@) {
+	    die "storage migration for '$volid' to storage '$sid' failed - $err\n";
+	}
     }
 
     my $conffile = PVE::LXC::Config->config_file($vmid);
-- 
2.20.1






More information about the pve-devel mailing list