5
0
mirror of git://git.proxmox.com/git/pve-storage.git synced 2025-01-10 01:18:05 +03:00

btrfs: do not reuse DirPlugins activate_storage directrly

as then the btrfs assertion would happen after we already created
subdirectories on some path, leaving those left-over..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2021-06-24 11:15:28 +02:00
parent f6abd82a6d
commit f449cddc79

View File

@ -112,8 +112,21 @@ my sub assert_btrfs($) {
sub activate_storage {
my ($class, $storeid, $scfg, $cache) = @_;
PVE::Storage::DirPlugin::activate_storage($class, $storeid, $scfg, $cache);
assert_btrfs($scfg->{path});
my $path = $scfg->{path};
if (!defined($scfg->{mkdir}) || $scfg->{mkdir}) {
mkpath $path;
}
my $mp = PVE::Storage::DirPlugin::parse_is_mountpoint($scfg);
if (defined($mp) && !path_is_mounted($mp, $cache->{mountdata})) {
die "unable to activate storage '$storeid' - directory is expected to be a mount point but"
." is not mounted: '$mp'\n";
}
assert_btrfs($path); # only assert this stuff now, ensures $path is there and better UX
$class->SUPER::activate_storage($storeid, $scfg, $cache);
}
sub status {