]> git.proxmox.com Git - pve-storage.git/commitdiff
Disks: instantiate import unit for created zpool
authorStoiko Ivanov <s.ivanov@proxmox.com>
Wed, 16 Sep 2020 12:14:19 +0000 (14:14 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 29 Sep 2020 16:52:32 +0000 (18:52 +0200)
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>
PVE/API2/Disks/ZFS.pm

index 7a633a7cced967dd7b38605aa34254c79aadc772..66b26e965e6ac751643e72d3600d84905adcac06 100644 (file)
@@ -5,6 +5,7 @@ use warnings;
 
 use PVE::Diskmanage;
 use PVE::JSONSchema qw(get_standard_option);
+use PVE::Systemd;
 use PVE::API2::Storage::Config;
 use PVE::Storage;
 use PVE::Tools qw(run_command lock_file trim);
@@ -393,6 +394,11 @@ __PACKAGE__->register_method ({
                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',