From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 1BDA41FF0E4 for ; Tue, 28 Jul 2026 15:51:04 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 8D86421323; Tue, 28 Jul 2026 15:51:03 +0200 (CEST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 28 Jul 2026 15:50:58 +0200 Message-Id: To: "Wolfgang Bumiller" From: "Max R. Carrara" Subject: Re: [PATCH pve-storage v1 38/54] test: list volumes: document behavior wrt. undeclared content types X-Mailer: aerc 0.18.2-0-ge037c095a049 References: <20260422111322.257380-1-m.carrara@proxmox.com> <20260422111322.257380-39-m.carrara@proxmox.com> In-Reply-To: X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1785246622163 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.027 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_LOW -0.7 Sender listed at https://www.dnswl.org/, low trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: 7NUYTAUYEBWES2SPLJAUX3NAC6PZUHEV X-Message-ID-Hash: 7NUYTAUYEBWES2SPLJAUX3NAC6PZUHEV X-MailFrom: m.carrara@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: pve-devel@lists.proxmox.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Thu Jul 2, 2026 at 2:46 PM CEST, Wolfgang Bumiller wrote: > On Wed, Apr 22, 2026 at 01:13:04PM +0200, Max R. Carrara wrote: > > Any content types / volume types that are passed to > > `PVE::Storage::Plugin->list_volumes()` are still taken into account by > > the method, even if the passed storage config does not declare them in > > its `content` key. In other words, the `content` property is ignored > > when listing volumes through `list_volumes()`. > > > > Or to express this more explicitly, consider a directory storage with > > `path` set to `/mnt/example` and `content` set to `iso,vztmpl`. Now, > > if there are files in `/mnt/example/snippets` for some reason and the > > `list_volumes()` method is called with `['snippets']` for the volume > > type list parameter, then the volume info hashes for the files in > > `/mnt/example/snippets` are included in the output. > > > > Document this through a test case. > > Did you find any rationale for this? Because I think the better solution > here would be for list_volumes() to just either return nothing or die in > this case (but dying could have some unwanted effects in the rest of the > code base, so an empty list is safer). I have not really found any use case, no. I wasn't really sure whether changing this behaviour would cause any breakage or not, henve why I decided to just document it. I'm also in favour of returning an empty list in such a case though; will check this in more detail in v2. > > > > > Signed-off-by: Max R. Carrara > > --- > > src/test/list_volumes_test.pm | 109 ++++++++++++++++++++++++++++++++++ > > 1 file changed, 109 insertions(+) > > > > diff --git a/src/test/list_volumes_test.pm b/src/test/list_volumes_test= .pm > > index ca3bbac7..455fb227 100644 > > --- a/src/test/list_volumes_test.pm > > +++ b/src/test/list_volumes_test.pm > > @@ -909,6 +909,115 @@ my $test_param_list =3D [ > > }, > > ], > > }, > > + { > > + description =3D> > > + "VMID: none, volume info is still returned for content typ= es that are not declared", > > + storeid =3D> $DEFAULT_STOREID, > > + scfg =3D> { > > + type =3D> 'dir', > > + path =3D> $DEFAULT_STORAGE_PATH, > > + shared =3D> 0, > > + content =3D> {}, # note how no content types are declared = here > > + }, > > + vmid =3D> undef, > > + vtypes =3D> ['images', 'rootdir', 'vztmpl', 'iso', 'backup', '= snippets', 'import'], > > + cases =3D> [ > > + { > > + file =3D> "$DEFAULT_STORAGE_PATH/images/16110/vm-16110= -disk-0.qcow2", > > + expected =3D> { > > + content =3D> 'images', > > + ctime =3D> $DEFAULT_CTIME, > > + format =3D> 'qcow2', > > + parent =3D> undef, > > + size =3D> $DEFAULT_SIZE, > > + used =3D> $DEFAULT_USED, > > + vmid =3D> '16110', > > + volid =3D> 'local:16110/vm-16110-disk-0.qcow2', > > + }, > > + }, > > + { > > + file =3D> "$DEFAULT_STORAGE_PATH/images/1234/vm-1234-d= isk-0.qcow2", > > + parent =3D> '../ssss/base-4321-disk-0.qcow2', > > + expected =3D> { > > + content =3D> 'images', > > + ctime =3D> $DEFAULT_CTIME, > > + format =3D> 'qcow2', > > + parent =3D> '../ssss/base-4321-disk-0.qcow2', > > + size =3D> $DEFAULT_SIZE, > > + used =3D> $DEFAULT_USED, > > + vmid =3D> '1234', > > + volid =3D> 'local:1234/vm-1234-disk-0.qcow2', > > + }, > > + }, > > + { > > + file =3D> "$DEFAULT_STORAGE_PATH/images/16112/vm-16112= -disk-0.raw", > > + expected =3D> { > > + content =3D> 'rootdir', > > + ctime =3D> $DEFAULT_CTIME, > > + format =3D> 'raw', > > + parent =3D> undef, > > + size =3D> $DEFAULT_SIZE, > > + used =3D> $DEFAULT_USED, > > + vmid =3D> '16112', > > + volid =3D> 'local:16112/vm-16112-disk-0.raw', > > + }, > > + }, > > + { > > + file =3D> > > + "$DEFAULT_STORAGE_PATH/template/cache/alpine-3.10-= default_20190626_amd64.tar.xz", > > + expected =3D> { > > + content =3D> 'vztmpl', > > + ctime =3D> $DEFAULT_CTIME, > > + format =3D> 'txz', > > + size =3D> $DEFAULT_SIZE, > > + volid =3D> 'local:vztmpl/alpine-3.10-default_20190= 626_amd64.tar.xz', > > + }, > > + }, > > + { > > + file =3D> "$DEFAULT_STORAGE_PATH/template/iso/archlinu= x-2020.02.01-x86_64.iso", > > + expected =3D> { > > + content =3D> 'iso', > > + ctime =3D> $DEFAULT_CTIME, > > + format =3D> 'iso', > > + size =3D> $DEFAULT_SIZE, > > + volid =3D> 'local:iso/archlinux-2020.02.01-x86_64.= iso', > > + }, > > + }, > > + { > > + file =3D> > > + "$DEFAULT_STORAGE_PATH/dump/vzdump-lxc-16112-2020_= 03_30-21_39_30.tar.lzo", > > + expected =3D> { > > + content =3D> 'backup', > > + ctime =3D> 1585604370, > > + format =3D> 'tar.lzo', > > + size =3D> $DEFAULT_SIZE, > > + subtype =3D> 'lxc', > > + vmid =3D> '16112', > > + volid =3D> 'local:backup/vzdump-lxc-16112-2020_03_= 30-21_39_30.tar.lzo', > > + }, > > + }, > > + { > > + file =3D> "$DEFAULT_STORAGE_PATH/snippets/hookscript.p= l", > > + expected =3D> { > > + content =3D> 'snippets', > > + ctime =3D> $DEFAULT_CTIME, > > + format =3D> 'snippet', > > + size =3D> $DEFAULT_SIZE, > > + volid =3D> 'local:snippets/hookscript.pl', > > + }, > > + }, > > + { > > + file =3D> "$DEFAULT_STORAGE_PATH/import/import.ova", > > + expected =3D> { > > + content =3D> 'import', > > + ctime =3D> $DEFAULT_CTIME, > > + format =3D> 'ova', > > + size =3D> $DEFAULT_SIZE, > > + volid =3D> 'local:import/import.ova', > > + }, > > + }, > > + ], > > + }, > > ]; > > > > # provide static vmlist for tests > > -- > > 2.47.3 > > > > > > > > > >