]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/Storage.pm
Include all snapshots when migrate storage zfs to zfs.
[pve-storage.git] / PVE / Storage.pm
index d26499d883858973d7854e93f3a4c115172978dd..a2487730ba0dab7d72ea8cc8fb0802840d4da86a 100755 (executable)
@@ -22,6 +22,7 @@ use PVE::RPCEnvironment;
 use PVE::Storage::Plugin;
 use PVE::Storage::DirPlugin;
 use PVE::Storage::LVMPlugin;
+use PVE::Storage::LvmThinPlugin;
 use PVE::Storage::NFSPlugin;
 use PVE::Storage::ISCSIPlugin;
 use PVE::Storage::RBDPlugin;
@@ -35,6 +36,7 @@ use PVE::Storage::DRBDPlugin;
 # load and initialize all plugins
 PVE::Storage::DirPlugin->register();
 PVE::Storage::LVMPlugin->register();
+PVE::Storage::LvmThinPlugin->register();
 PVE::Storage::NFSPlugin->register();
 PVE::Storage::ISCSIPlugin->register();
 PVE::Storage::RBDPlugin->register();
@@ -474,7 +476,7 @@ sub storage_migrate {
                }
 
                my $cmd = ['/usr/bin/rsync', '--progress', '--sparse', '--whole-file',
-                          $src, "root\@${target_host}:$dst"];
+                          $src, "[root\@${target_host}]:$dst"];
 
                my $percent = -1;
 
@@ -510,7 +512,7 @@ sub storage_migrate {
 
            my $snap = "zfs snapshot $zfspath\@__migration__";
 
-           my $send = "zfs send -v $zfspath\@__migration__ \| ssh root\@$target_host zfs recv $zfspath";
+           my $send = "zfs send -Rpv $zfspath\@__migration__ \| ssh root\@$target_host zfs recv $zfspath";
 
            my $destroy_target = "ssh root\@$target_host zfs destroy $zfspath\@__migration__";
            run_command($snap);
@@ -1234,4 +1236,38 @@ sub complete_content_type {
     return [qw(rootdir images vztmpl iso backup)];
 }
 
+sub complete_volume {
+    my ($cmdname, $pname, $cvalue) = @_;
+
+    my $cfg = config();
+
+    my $storage_list = complete_storage_enabled();
+
+    if ($cvalue =~ m/^([^:]+):/) {
+       $storage_list = [ $1 ];
+    } else {
+       if (scalar(@$storage_list) > 1) {
+           # only list storage IDs to avoid large listings
+           my $res = [];
+           foreach my $storeid (@$storage_list) {
+               # Hack: simply return 2 artificial values, so that
+               # completions does not finish
+               push @$res, "$storeid:volname", "$storeid:...";
+           }
+           return $res;
+       }
+    }
+
+    my $res = [];
+    foreach my $storeid (@$storage_list) {
+       my $vollist = PVE::Storage::volume_list($cfg, $storeid);
+
+       foreach my $item (@$vollist) {
+           push @$res, $item->{volid};
+       }
+    }
+
+    return $res;
+}
+
 1;