From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 5B37562431; Wed, 16 Sep 2020 14:14:36 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 5766F23B0A; Wed, 16 Sep 2020 14:14:36 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 6FB6323AF7; Wed, 16 Sep 2020 14:14:35 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 275FD453D6; Wed, 16 Sep 2020 14:14:35 +0200 (CEST) From: Stoiko Ivanov To: pve-devel@lists.proxmox.com, pbs-devel@lists.proxmox.com Date: Wed, 16 Sep 2020 14:14:19 +0200 Message-Id: <20200916121419.3997-4-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200916121419.3997-1-s.ivanov@proxmox.com> References: <20200916121419.3997-1-s.ivanov@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.015 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [zfs.pm] Subject: [pbs-devel] [RFC storage 1/1] Disks: instantiate import unit for created zpool X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Sep 2020 12:14:36 -0000 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 Signed-off-by: Stoiko Ivanov --- PVE/API2/Disks/ZFS.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PVE/API2/Disks/ZFS.pm b/PVE/API2/Disks/ZFS.pm index 7a633a7..66b26e9 100644 --- a/PVE/API2/Disks/ZFS.pm +++ b/PVE/API2/Disks/ZFS.pm @@ -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', -- 2.20.1