Change to zfs storage handling in 9.0.11 - activate_storage function not in use anymore?

Afternoon_ususal

New Member
Nov 11, 2025
1
0
1
Hi
Until recently i used an early return 1 in the activate_storage function (within /usr/share/perl5/PVE/Storage/ZFSPoolPlugin.pm) to prevent ZFS pools from automatically re-importing after being exported manually with zpool export data-pool.
This worked great until including PVE 9.0.9. However after upgrading 9.0.11, manually exported pools (that are enabled in Datacenter > Storage) are now automatically re-imported about 10 seconds after export, (default PVE behavior I’m trying to avoid). I checked the code and added a test lines to see if the activate_storage function is even called during the import, but it appears it isn't anymore. I couldn't find any relevant changes to /usr/share/perl5/PVE/Storage/ZFSPoolPlugin.pm in the recent git history, ether.

Was the automatic zfs import logic moved somewhere else recently? if so where is it now?

This happens consistently across multiple systems after updating to 9.0.11. When I disable the pool under Datacenter > Storage, the auto-import stops (so the import is done by proxmox itself and not zfs or base debian), but this isn't a viable solution for my setup.

Desired behavior / goal: ZFS pools that have been manually exported using a zpool export command should remain exported, even if they are still enabled in Datacenter > Storage and proxmox sees the disks (no automatic re-import by Proxmox)

The function in question including my two modifications
/usr/share/perl5/PVE/Storage/ZFSPoolPlugin.pm
Code:
sub activate_storage {
    my ($class, $storeid, $scfg, $cache) = @_;

    # Note: $scfg->{pool} can include dataset <pool>/<dataset>
    my $dataset = $scfg->{pool};
    my $pool = ($dataset =~ s!/.*$!!r);
   
    exec("touch /tmp/activate_storage_called.txt")        # added to see if function was called - in 9.0.9 a file is created but no file is created in 9.0.11

    return 1;                                         # early return to prevent automatic zpool import - worked until 9.0.9

    my $pool_imported = sub {
        my @param = ('-o', 'name', '-H', $pool);
        my $res = eval { $class->zfs_request($scfg, undef, 'zpool_list', @param) };
        warn "$@\n" if $@;

        return defined($res) && $res =~ m/$pool/;
    };

    if (!$pool_imported->()) {
        # import can only be done if not yet imported!
        my @param = ('-d', '/dev/disk/by-id/', '-o', 'cachefile=none', $pool);
        eval { $class->zfs_request($scfg, undef, 'zpool_import', @param) };
        if (my $err = $@) {
            # just could've raced with another import, so recheck if it is imported
            die "could not activate storage '$storeid', $err\n" if !$pool_imported->();
        }
    }
    eval { $class->zfs_request($scfg, undef, 'mount', '-a') };
    die "could not activate storage '$storeid', $@\n" if $@;
    return 1;
}

Thanks in advance!
 
Last edited: