get_replicatable_volumes: fix CDROM and local file/device handling

This commit is contained in:
Dietmar Maurer 2017-06-14 07:01:36 +02:00
parent 6f249d9400
commit 4ab3bcc82a

View File

@ -71,6 +71,13 @@ sub get_replicatable_volumes {
my $test_volid = sub { my $test_volid = sub {
my ($volid, $attr) = @_; my ($volid, $attr) = @_;
if ($volid =~ m|^/|) {
return if !$attr->{replicate};
die "unable to replicate local file/device '$volid'\n";
}
return if $attr->{cdrom};
my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid, $noerr); my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid, $noerr);
return if !$storeid; return if !$storeid;
@ -80,8 +87,6 @@ sub get_replicatable_volumes {
my ($path, $owner, $vtype) = PVE::Storage::path($storecfg, $volid); my ($path, $owner, $vtype) = PVE::Storage::path($storecfg, $volid);
return if !$owner || ($owner != $vmid); return if !$owner || ($owner != $vmid);
return if $attr->{cdrom};
die "unable to replicate volume '$volid', type '$vtype'\n" if $vtype ne 'images'; die "unable to replicate volume '$volid', type '$vtype'\n" if $vtype ne 'images';
return if !$cleanup && !$attr->{replicate}; return if !$cleanup && !$attr->{replicate};