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 A2476710E8 for ; Mon, 17 May 2021 16:21:43 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9405C2CEE9 for ; Mon, 17 May 2021 16:21:13 +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 id 812A52CED9 for ; Mon, 17 May 2021 16:21:08 +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 43F68465B5 for ; Mon, 17 May 2021 16:21:08 +0200 (CEST) To: Thomas Lamprecht , Proxmox VE development discussion References: <20210517090324.63391-1-l.stechauner@proxmox.com> <310011e6-083d-e241-80cc-17024a77db31@proxmox.com> From: Lorenz Stechauner Message-ID: <500231a8-ae07-3d96-9db3-62809ee3bf93@proxmox.com> Date: Mon, 17 May 2021 16:21:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <310011e6-083d-e241-80cc-17024a77db31@proxmox.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-SPAM-LEVEL: Spam detection results: 0 AWL 0.398 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment NICE_REPLY_A -0.001 Looks like a legit reply (A) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH v2 container] fix #3421: allow custom storage plugins to support rootfs 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: Mon, 17 May 2021 14:21:43 -0000 On 5/17/21 3:41 PM, Thomas Lamprecht wrote: > On 17.05.21 11:03, Lorenz Stechauner wrote: >> it is now necessary for storages to support the 'rootdir' content >> in order to create/start containers on them. all native storage >> plugins already report the rootdir content correctly. >> >> Signed-off-by: Lorenz Stechauner >> --- > I'm missing the description of changes from v1 -> v2 here... Sorry, forgot to include. Changes v1 -> v2: - Added a commit message which explains the need of content type 'rootdir' - code style - new behavior should now be the same as old behavior (regarding native storage plugins) - updated error messages >> src/PVE/LXC.pm | 30 ++++++++++++------------------ >> 1 file changed, 12 insertions(+), 18 deletions(-) >> >> diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm >> index 7e6f378..75e1c20 100644 >> --- a/src/PVE/LXC.pm >> +++ b/src/PVE/LXC.pm >> @@ -1682,15 +1682,16 @@ sub __mountpoint_mount { >> } >> }; >> my $use_loopdev = 0; >> - if ($scfg->{path}) { >> - $mounted_dev = run_with_loopdev($domount, $path, $readonly); >> - $use_loopdev = 1; >> - } elsif ($scfg->{type} eq 'drbd' || $scfg->{type} eq 'lvm' || >> - $scfg->{type} eq 'rbd' || $scfg->{type} eq 'lvmthin') { >> - $mounted_dev = $path; >> - &$domount($path); >> + if ($scfg->{content}->{rootdir}) { >> + if ($scfg->{path}) { >> + $mounted_dev = run_with_loopdev($domount, $path, $readonly); >> + $use_loopdev = 1; >> + } else { >> + $mounted_dev = $path; >> + &$domount($path); >> + } >> } else { >> - die "unsupported storage type '$scfg->{type}'\n"; >> + die "storage type '$scfg->{type}' does not support containers\n"; >> } >> return wantarray ? ($path, $use_loopdev, $mounted_dev) : $path; >> } else { >> @@ -1871,7 +1872,7 @@ sub alloc_disk { >> >> eval { >> my $do_format = 0; >> - if ($scfg->{type} eq 'dir' || $scfg->{type} eq 'nfs' || $scfg->{type} eq 'cifs' ) { >> + if ($scfg->{content}->{rootdir} && $scfg->{path}) { >> if ($size_kb > 0) { >> $volid = PVE::Storage::vdisk_alloc($storecfg, $storage, $vmid, 'raw', >> undef, $size_kb); >> @@ -1882,21 +1883,14 @@ sub alloc_disk { >> $needs_chown = 1; >> } >> } elsif ($scfg->{type} eq 'zfspool') { >> - >> $volid = PVE::Storage::vdisk_alloc($storecfg, $storage, $vmid, 'subvol', >> undef, $size_kb); >> $needs_chown = 1; >> - } elsif ($scfg->{type} eq 'drbd' || $scfg->{type} eq 'lvm' || $scfg->{type} eq 'lvmthin') { >> - >> - $volid = PVE::Storage::vdisk_alloc($storecfg, $storage, $vmid, 'raw', undef, $size_kb); >> - $do_format = 1; >> - >> - } elsif ($scfg->{type} eq 'rbd') { >> - >> + } elsif ($scfg->{content}->{rootdir}) { >> $volid = PVE::Storage::vdisk_alloc($storecfg, $storage, $vmid, 'raw', undef, $size_kb); >> $do_format = 1; >> } else { >> - die "unable to create containers on storage type '$scfg->{type}'\n"; >> + die "storage type '$scfg->{type}' does not supoort containers\n"; >> } >> format_disk($storecfg, $volid, $rootuid, $rootgid) if $do_format; >> }; >>