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 9E30C98615 for ; Thu, 11 May 2023 10:27:49 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 75DA81DEAE for ; Thu, 11 May 2023 10:27:19 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (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 for ; Thu, 11 May 2023 10:27:18 +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 1A6A3417C6; Thu, 11 May 2023 10:27:18 +0200 (CEST) Date: Thu, 11 May 2023 10:27:17 +0200 (CEST) From: =?UTF-8?Q?Fabian_Gr=C3=BCnbichler?= To: Proxmox VE development discussion Cc: Konstantin Filippov Message-ID: <1785581048.4184.1683793637397@webmail.proxmox.com> In-Reply-To: References: <20230510000830.1851-1-frank030366@hotmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal X-Mailer: Open-Xchange Mailer v7.10.6-Rev39 X-Originating-Client: open-xchange-appsuite X-SPAM-LEVEL: Spam detection results: 0 AWL 0.074 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: Re: [pve-devel] [PATCH pve-container 1/1] Adding new mount point type named 'zfs' to let configure a ZFS dataset as mount point for LXC container X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 May 2023 08:27:49 -0000 > As we know, ProxMox have only three possible "categories" of mount points: ProxMox storage provider supplied, block device and bind mount. I've prepared a little patch for pve-container package which adds a fourth "category" named "zfs" - so with this patch it's possible to add such ZFS dataset into container config in a form "mpN: /,". This new type can be useful in some cases - for instance when we need to mount ZFS dataset in the container but need to keep this dataset not mounted on the host. nit: for single patches, there is no need to add a coverletter. also, please include relevant information in the commit message! introducing a new mountpoint type is definitely not the right approach. could you give a reason why you want to hide the container contents from the host? this could be implemented in pve-container (e.g., by mounting the ZFS dataset corresponding to a PVE-managed volume like we mount block devices or raw images, instead of relying on the fact that they are already mounted and bind mounting them.. we already do the same for ZFS snapshots in __mountpoint_mount, for example) and in pve-storage (e.g., by having a flag there that controls mounting, or skipping mounting if mountpoint=none or legacy) without the need for any other special handling. careful checks to see whether we rely on ZFS-backed mountpoints already being mounted anywhere else would still be needed (move volume might be one place, for example). > Konstantin Filippov via pve-devel hat am 10.05.2023 02:08 CEST geschrieben: > Signed-off-by: Konstantin Filippov > --- > src/PVE/LXC.pm | 4 ++++ > src/PVE/LXC/Config.pm | 3 ++- > 2 files changed, 6 insertions(+), 1 deletion(-) > > diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm > index d138161..30cf48d 100644 > --- a/src/PVE/LXC.pm > +++ b/src/PVE/LXC.pm > @@ -1839,6 +1839,10 @@ sub __mountpoint_mount { > my ($devpath) = (Cwd::realpath($volid) =~ /^(.*)$/s); # realpath() taints > PVE::Tools::run_command(['mount', @extra_opts, $volid, $mount_path]) if $mount_path; > return wantarray ? ($volid, 0, $devpath) : $volid; > + } elsif ($type eq 'zfs') { > + push @extra_opts, '-o', 'ro' if $readonly; > + PVE::Tools::run_command(['mount.zfs', @extra_opts, $volid, $mount_path]) if $mount_path; > + return wantarray ? ($volid, 0, undef) : $volid > } elsif ($type eq 'bind') { > die "directory '$volid' does not exist\n" if ! -d $volid; > bindmount($volid, $parentfd, $last_dir//$rootdir, $mount_path, $readonly, @extra_opts) if $mount_path; > diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm > index ac9db94..056ec98 100644 > --- a/src/PVE/LXC/Config.pm > +++ b/src/PVE/LXC/Config.pm > @@ -1557,7 +1557,8 @@ sub classify_mountpoint { > return 'device' if $vol =~ m!^/dev/!; > return 'bind'; > } > - return 'volume'; > + return 'volume' if $vol =~ m!:.*(vm|subvol)-[0-9]*-disk-[0-9]*!; > + return 'zfs'; > } > > my $__is_volume_in_use = sub { > -- > 2.30.2