mirror of
git://git.proxmox.com/git/qemu-server.git
synced 2025-01-06 13:17:56 +03:00
get_replicatable_volumes: move checks to top
those checks do not depend on anything we do in the sub, so we can do them at the beginning. Also respect the $noerr flag (do not raise exceptions in that case).
This commit is contained in:
parent
3097a06bca
commit
a6cb40f786
@ -71,13 +71,16 @@ sub get_replicatable_volumes {
|
||||
my $test_volid = sub {
|
||||
my ($volid, $attr) = @_;
|
||||
|
||||
return if $attr->{cdrom};
|
||||
|
||||
return if !$cleanup && !$attr->{replicate};
|
||||
|
||||
if ($volid =~ m|^/|) {
|
||||
return if !$attr->{replicate};
|
||||
return if $cleanup || $noerr;
|
||||
die "unable to replicate local file/device '$volid'\n";
|
||||
}
|
||||
|
||||
return if $attr->{cdrom};
|
||||
|
||||
my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid, $noerr);
|
||||
return if !$storeid;
|
||||
|
||||
@ -87,9 +90,10 @@ sub get_replicatable_volumes {
|
||||
my ($path, $owner, $vtype) = PVE::Storage::path($storecfg, $volid);
|
||||
return if !$owner || ($owner != $vmid);
|
||||
|
||||
die "unable to replicate volume '$volid', type '$vtype'\n" if $vtype ne 'images';
|
||||
|
||||
return if !$cleanup && !$attr->{replicate};
|
||||
if ($vtype ne 'images') {
|
||||
return if $cleanup || $noerr;
|
||||
die "unable to replicate volume '$volid', type '$vtype'\n";
|
||||
}
|
||||
|
||||
if (!PVE::Storage::volume_has_feature($storecfg, 'replicate', $volid)) {
|
||||
return if $cleanup || $noerr;
|
||||
|
Loading…
Reference in New Issue
Block a user