[pve-devel] [PATCH v2 qemu-server 26/28] sync_disks: be more verbose if storage_migrate fails

Fabian Ebner f.ebner at proxmox.com
Mon Feb 24 13:44:16 CET 2020


If storage_migrate dies, the error message might not include the
volume ID or the target storage ID, but those might be good to know.

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 PVE/QemuMigrate.pm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index 2fec0f4..e7d9c98 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -487,8 +487,13 @@ sub sync_disks {
 		    'allow_rename' => !$local_volumes->{$volid}->{is_vmstate},
 		};
 
-		my $new_volid = PVE::Storage::storage_migrate($self->{storecfg}, $volid,
-				    $self->{ssh_info}, $targetsid, $storage_migrate_opts);
+		my $new_volid = eval {
+		    PVE::Storage::storage_migrate($self->{storecfg}, $volid,
+			$self->{ssh_info}, $targetsid, $storage_migrate_opts);
+		};
+		if (my $err = $@) {
+		    die "storage migration for '$volid' to storage '$targetsid' failed - $err\n";
+		}
 
 		$self->{volume_map}->{$volid} = $new_volid if $volid ne $new_volid;
 		$self->log('info', "volume '$volid' is '$new_volid' on the target\n");
-- 
2.20.1





More information about the pve-devel mailing list