5
0
mirror of git://git.proxmox.com/git/pve-storage.git synced 2024-12-23 17:34:34 +03:00

Disks: instantiate import unit for created zpool

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>
This commit is contained in:
Stoiko Ivanov 2020-09-16 14:14:19 +02:00 committed by Thomas Lamprecht
parent 59fdc2b71e
commit f720f6c440

View 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',