When creating a new ZFS storage, also instantiate an import-unit for the pool.
This should help mitigate the case where some pools don't get imported during
boot, because they are not listed in an existing zpool.cache file.
This patch needs the corresponding addition of 'zfs-import@.service' in
the zfsonlinux repository.
Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
use PVE::Diskmanage;
use PVE::JSONSchema qw(get_standard_option);
use PVE::Diskmanage;
use PVE::JSONSchema qw(get_standard_option);
use PVE::API2::Storage::Config;
use PVE::Storage;
use PVE::Tools qw(run_command lock_file trim);
use PVE::API2::Storage::Config;
use PVE::Storage;
use PVE::Tools qw(run_command lock_file trim);
print "# ", join(' ', @$cmd), "\n";
run_command($cmd);
print "# ", join(' ', @$cmd), "\n";
run_command($cmd);
+ my $importunit = 'zfs-import@'. PVE::Systemd::escape_unit($name, undef) . '.service';
+ $cmd = ['systemctl', 'enable', $importunit];
+ print "# ", join(' ', @$cmd), "\n";
+ run_command($cmd);
+
if ($param->{add_storage}) {
my $storage_params = {
type => 'zfspool',
if ($param->{add_storage}) {
my $storage_params = {
type => 'zfspool',