]> git.proxmox.com Git - pve-container.git/commitdiff
get_replicatable_volumes: add additional tests
authorDietmar Maurer <dietmar@proxmox.com>
Tue, 13 Jun 2017 09:22:01 +0000 (11:22 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 13 Jun 2017 09:22:01 +0000 (11:22 +0200)
- skip volumes on shared storage
- die if $mptype ne 'volume'
- skip volumes if we do not 'own' them

src/PVE/LXC/Config.pm

index 3156b6cbca5eb895a6fd64eb95720464a5431596..4ac5c95f30f63e6867be85d3f76abe17cb8661f6 100644 (file)
@@ -1256,6 +1256,21 @@ sub get_replicatable_volumes {
 
        return if !$volid;
 
+       my $mptype = $mountpoint->{type};
+       die "unable to replicate mountpoint type '$mptype'\n"
+           if $mptype ne 'volume';
+
+       my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid, $noerr);
+       return if !$storeid;
+
+       my $scfg = storage_config($storecfg, $storeid);
+       return if $scfg->{shared};
+
+       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 && defined($mountpoint->{replicate}) && !$mountpoint->{replicate};
 
        if (!PVE::Storage::volume_has_feature($storecfg, 'replicate', $volid)) {