]> git.proxmox.com Git - pve-container.git/blobdiff - src/PVE/LXC/Config.pm
use full module path for storage_config
[pve-container.git] / src / PVE / LXC / Config.pm
index 3156b6cbca5eb895a6fd64eb95720464a5431596..e76d55888c097afff8051febb8d47fa4a3b50bda 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 = PVE::Storage::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)) {
@@ -1279,6 +1294,13 @@ sub get_replicatable_volumes {
         });
     }
 
+    # add 'unusedX' volumes to volhash
+    foreach my $key (keys %$conf) {
+       if ($key =~ m/^unused/) {
+           $test_volid->($conf->{$key}, { type => 'volume', replicate => 1 });
+       }
+    }
+
     return $volhash;
 }