Signed-off-by: Wolfgang Link <w.l...@proxmox.com> --- PVE/Storage.pm | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
diff --git a/PVE/Storage.pm b/PVE/Storage.pm index e46bc77..6fe0953 100755 --- a/PVE/Storage.pm +++ b/PVE/Storage.pm @@ -490,6 +490,35 @@ sub storage_migrate { } else { die "$errstr - target type '$tcfg->{type}' not implemented\n"; } + } elsif ($scfg->{type} eq 'zfspool') { + + if($tcfg->{type} eq 'zfspool'){ + + die "$errstr - pool on target has not same name as source!"if $tcfg->{pool} ne $scfg->{pool}; + + my $zfspath = $volid ; + $zfspath =~ /(vm\-\d+\-disk\-\d+)/; + $zfspath = "$scfg->{pool}\/$1"; + + my $snap = "zfs snapshot $zfspath\@mig"; + + my $send = "zfs send -v $zfspath\@mig \| ssh root\@$target_host zfs recv $zfspath"; + + my $destroy_target = "ssh root\@$target_host zfs destroy $zfspath\@mig"; + run_command($snap); + eval{ + run_command($send); + }; + my $err; + if ($err = $@){ + run_command("zfs destroy $zfspath\@mig"); + die $err; + } + run_command($destroy_target); + + } else { + die "$errstr - target type $tcfg->{type} is not valid\n"; + } } else { die "$errstr - source type '$scfg->{type}' not implemented\n"; } -- 1.7.10.4 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel