implement offline migration on zfs
Signed-off-by: Wolfgang Link <w.link@proxmox.com>
This commit is contained in:
committed by
Dietmar Maurer
parent
26beadeb47
commit
3d621977f4
@ -492,6 +492,35 @@ sub storage_migrate {
|
|||||||
} else {
|
} else {
|
||||||
die "$errstr - target type '$tcfg->{type}' not implemented\n";
|
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 ( undef, $volname) = parse_volname($cfg, $volid);
|
||||||
|
|
||||||
|
my $zfspath = "$scfg->{pool}\/$volname";
|
||||||
|
|
||||||
|
my $snap = "zfs snapshot $zfspath\@__migration__";
|
||||||
|
|
||||||
|
my $send = "zfs send -v $zfspath\@__migration__ \| ssh root\@$target_host zfs recv $zfspath";
|
||||||
|
|
||||||
|
my $destroy_target = "ssh root\@$target_host zfs destroy $zfspath\@__migration__";
|
||||||
|
run_command($snap);
|
||||||
|
eval{
|
||||||
|
run_command($send);
|
||||||
|
};
|
||||||
|
my $err;
|
||||||
|
if ($err = $@){
|
||||||
|
run_command("zfs destroy $zfspath\@__migration__");
|
||||||
|
die $err;
|
||||||
|
}
|
||||||
|
run_command($destroy_target);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
die "$errstr - target type $tcfg->{type} is not valid\n";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
die "$errstr - source type '$scfg->{type}' not implemented\n";
|
die "$errstr - source type '$scfg->{type}' not implemented\n";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user