[pve-devel] [PATCH pve-storage] fix for storage migrate

Wolfgang Link w.link at proxmox.com
Wed Jun 8 13:42:53 CEST 2016


remove the sparse parameter from dd.
This destroy the lvm volume.

also remove the free_disk this will later be done.
---
 PVE/Storage.pm | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index 2952b05..bb35b32 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -558,15 +558,17 @@ sub storage_migrate {
 			  $target_volname, int($size/1024)]);
 
 	    eval {
-		run_command([["dd", "if=$src"],
-			     ["/usr/bin/ssh", "root\@${target_host}", "-C",
+		if ($tcfg->{type} eq 'lvmthin') {
+		    run_command([["dd", "if=$src"],["/usr/bin/ssh", "root\@${target_host}", "-C",
 			      "dd", 'conv=sparse', "of=$dst"]]);
+		} else {
+		    run_command([["dd", "if=$src"],["/usr/bin/ssh", "root\@${target_host}", "-C",
+			      "dd", "of=$dst"]]);
+		}
 	    };
 	    if (my $err = $@) {
 		run_command(['/usr/bin/ssh', "root\@${target_host}",
 			 'pvesm', 'free', $target_volid]);
-	    } else {
-		vdisk_free($cfg, $volid);
 	    }
 	} else {
 	    die "$errstr - migrate from source type '$scfg->{type}' to '$tcfg->{type}' not implemented\n";
-- 
2.1.4




More information about the pve-devel mailing list