public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Max R. Carrara" <m.carrara@proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Wolfgang Bumiller <w.bumiller@proxmox.com>
Subject: [PATCH pve-storage v3 05/51] plugin api: replace subdir helper methods with standalone functions
Date: Tue, 17 Nov 2026 21:38:37 +0100	[thread overview]
Message-ID: <20261117203953.913035-6-m.carrara@proxmox.com> (raw)
In-Reply-To: <20261117203953.913035-1-m.carrara@proxmox.com>

Replace the `get_vtype_subdirs()` and `get_subdir()` helpers in
PVE::Storage::Plugin with standalone helper subroutines
`plugin_get_default_vtype_subdirs()` and `plugin_get_vtype_subdir()`
in PVE::Storage::Common.

This is mostly to prevent third-party plugins from relying on these
helpers as if they were part of the storage plugin API; the signature
of `get_subdir()` in particular looks as if it belongs to an API
method, even though it is only used as a helper in PVE::Storage,
PVE::Storage::Plugin, and PVE::Storage::BTRFSPlugin.

Therefore, make it explicit that these subroutines are really just
helpers by replacing them with slightly altered versions in
PVE::Storage::Common. Add docstrings for these replacements as well.

Replace all occurrences of `get_vtype_subdirs()` and `get_subdir()`
across the repository with their newly introduced counterparts
`plugin_get_default_vtype_subdirs()` and `plugin_get_vtype_subdir()`,
where possible. In places where a replacement would be *technically*
API-breaking, add a FIXME comment for the next APIAGE reset instead.

Additionally, note that PVE::Storage::ESXiPlugin is the only plugin
that explicitly overrides `get_subdir()`, treating it as if it were an
API method, but because that plugin is not filesystem-based (in the
sense that it does not declare the `path` property in its options),
calling `get_subdir()` would throw an exception anyhow. Also, it
should be mentioned that all methods that could call into
`get_subdir()` have been overridden inside ESXiPlugin, too.

Therefore, the override of `get_subdir()` in PVE::Storage::ESXiPlugin
is superfluous, so remove it.

Signed-off-by: Max R. Carrara <m.carrara@proxmox.com>
---
 src/PVE/Storage.pm                  | 15 +++++++++
 src/PVE/Storage/BTRFSPlugin.pm      | 16 +++++----
 src/PVE/Storage/Common.pm           | 51 +++++++++++++++++++++++++++++
 src/PVE/Storage/ESXiPlugin.pm       |  6 ----
 src/PVE/Storage/Plugin.pm           | 47 +++++++++++++-------------
 src/test/get_subdir_test.pm         | 12 ++++---
 src/test/parse_volname_test.pm      |  6 +++-
 src/test/path_to_volume_id_test.pm  |  6 +++-
 src/test/run_volume_access_tests.pl |  5 ++-
 9 files changed, 121 insertions(+), 43 deletions(-)

diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm
index 9b8c5284..083bc322 100755
--- a/src/PVE/Storage.pm
+++ b/src/PVE/Storage.pm
@@ -530,59 +530,71 @@ sub get_image_dir {
     my ($cfg, $storeid, $vmid) = @_;
 
     my $scfg = storage_config($cfg, $storeid);
     my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
 
+    # FIXME: Call plugin_get_vtype_subdir() instead of $plugin->get_subdir()
+    # on the next APIAGE reset.
     my $path = $plugin->get_subdir($scfg, 'images');
 
     return $vmid ? "$path/$vmid" : $path;
 }
 
 sub get_private_dir {
     my ($cfg, $storeid, $vmid) = @_;
 
     my $scfg = storage_config($cfg, $storeid);
     my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
 
+    # FIXME: Call plugin_get_vtype_subdir() instead of $plugin->get_subdir()
+    # on the next APIAGE reset.
     my $path = $plugin->get_subdir($scfg, 'rootdir');
 
     return $vmid ? "$path/$vmid" : $path;
 }
 
 sub get_iso_dir {
     my ($cfg, $storeid) = @_;
 
     my $scfg = storage_config($cfg, $storeid);
     my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
 
+    # FIXME: Call plugin_get_vtype_subdir() instead of $plugin->get_subdir()
+    # on the next APIAGE reset.
     return $plugin->get_subdir($scfg, 'iso');
 }
 
 sub get_import_dir {
     my ($cfg, $storeid) = @_;
 
     my $scfg = storage_config($cfg, $storeid);
     my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
 
+    # FIXME: Call plugin_get_vtype_subdir() instead of $plugin->get_subdir()
+    # on the next APIAGE reset.
     return $plugin->get_subdir($scfg, 'import');
 }
 
 sub get_vztmpl_dir {
     my ($cfg, $storeid) = @_;
 
     my $scfg = storage_config($cfg, $storeid);
     my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
 
+    # FIXME: Call plugin_get_vtype_subdir() instead of $plugin->get_subdir()
+    # on the next APIAGE reset.
     return $plugin->get_subdir($scfg, 'vztmpl');
 }
 
 sub get_backup_dir {
     my ($cfg, $storeid) = @_;
 
     my $scfg = storage_config($cfg, $storeid);
     my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
 
+    # FIXME: Call plugin_get_vtype_subdir() instead of $plugin->get_subdir()
+    # on the next APIAGE reset.
     return $plugin->get_subdir($scfg, 'backup');
 }
 
 # library implementation
 
@@ -726,10 +738,13 @@ sub path_to_volume_id {
 
     foreach my $sid (keys %$ids) {
         my $scfg = $ids->{$sid};
         next if !$scfg->{path};
         my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
+
+        # FIXME: Call plugin_get_vtype_subdir() instead of $plugin->get_subdir()
+        # on the next APIAGE reset.
         my $imagedir = $plugin->get_subdir($scfg, 'images');
         my $isodir = $plugin->get_subdir($scfg, 'iso');
         my $tmpldir = $plugin->get_subdir($scfg, 'vztmpl');
         my $backupdir = $plugin->get_subdir($scfg, 'backup');
         my $snippetsdir = $plugin->get_subdir($scfg, 'snippets');
diff --git a/src/PVE/Storage/BTRFSPlugin.pm b/src/PVE/Storage/BTRFSPlugin.pm
index 72cb39b7..1c81b7b8 100644
--- a/src/PVE/Storage/BTRFSPlugin.pm
+++ b/src/PVE/Storage/BTRFSPlugin.pm
@@ -11,11 +11,13 @@ use File::Path qw(mkpath);
 use IO::Dir;
 use POSIX qw(EEXIST);
 
 use PVE::Tools qw(run_command dir_glob_foreach);
 
-use PVE::Storage::Common;
+use PVE::Storage::Common qw(
+    plugin_get_vtype_subdir
+);
 use PVE::Storage::DirPlugin;
 
 use constant {
     BTRFS_FIRST_FREE_OBJECTID => 256,
     FS_NOCOW_FL => 0x00800000,
@@ -203,11 +205,11 @@ sub raw_file_to_subvol($) {
 sub filesystem_path {
     my ($class, $scfg, $volname, $snapname) = @_;
 
     my ($vtype, $name, $vmid, undef, undef, $isBase, $format) = $class->parse_volname($volname);
 
-    my $path = $class->get_subdir($scfg, $vtype);
+    my $path = plugin_get_vtype_subdir($scfg, $vtype);
 
     my $is_guest_volume = PVE::Storage::Common::is_guest_vtype($vtype);
     $path .= "/$vmid" if $is_guest_volume;
 
     if ($is_guest_volume && defined($format) && $format eq 'raw') {
@@ -310,11 +312,11 @@ sub clone_image {
     # or a subvolume, we forward to the DirPlugin
     if ($format ne 'raw' && $format ne 'subvol') {
         return PVE::Storage::DirPlugin::clone_image(@_);
     }
 
-    my $imagedir = $class->get_subdir($scfg, 'images');
+    my $imagedir = plugin_get_vtype_subdir($scfg, 'images');
     $imagedir .= "/$vmid";
     mkpath $imagedir;
 
     my $path = $class->filesystem_path($scfg, $volname);
     my $newname = $class->find_free_diskname($storeid, $scfg, $vmid, $format, 1);
@@ -343,11 +345,11 @@ sub alloc_image {
         return $class->SUPER::alloc_image($storeid, $scfg, $vmid, $fmt, $name, $size);
     }
 
     # From Plugin.pm:
 
-    my $imagedir = $class->get_subdir($scfg, 'images') . "/$vmid";
+    my $imagedir = plugin_get_vtype_subdir($scfg, 'images') . "/$vmid";
 
     mkpath $imagedir;
 
     $name = $class->find_free_diskname($storeid, $scfg, $vmid, $fmt, 1) if !$name;
 
@@ -661,11 +663,11 @@ sub volume_has_feature {
     return undef;
 }
 
 sub list_images {
     my ($class, $storeid, $scfg, $vmid, $vollist, $cache) = @_;
-    my $imagedir = $class->get_subdir($scfg, 'images');
+    my $imagedir = plugin_get_vtype_subdir($scfg, 'images');
 
     my $res = [];
 
     # Copied from Plugin.pm, with file_size_info calls adapted:
     foreach my $fn (<$imagedir/[0-9][0-9]*/*>) {
@@ -862,11 +864,11 @@ sub volume_import {
     if (!defined($base_snapshot) && -e $destination) {
         die "volume $volname already exists\n" if !$allow_rename;
         $volname = $class->find_free_diskname($storeid, $scfg, $vmid, $volume_format, 1);
     }
 
-    my $imagedir = $class->get_subdir($scfg, $vtype);
+    my $imagedir = plugin_get_vtype_subdir($scfg, $vtype);
     $imagedir .= "/$vmid" if PVE::Storage::Common::is_guest_vtype($vtype);
 
     my $tmppath = "$imagedir/recv.$vmid.tmp";
     mkdir($imagedir); # FIXME: if $scfg->{mkdir};
     if (!mkdir($tmppath)) {
@@ -994,11 +996,11 @@ sub rename_volume {
     $target_volname = $class->find_free_diskname($storeid, $scfg, $target_vmid, $format, 1)
         if !$target_volname;
     $target_volname = $class->volname_for_format($target_volname, $format, 0);
     $target_volname = "$target_vmid/$target_volname";
 
-    my $basedir = $class->get_subdir($scfg, 'images');
+    my $basedir = plugin_get_vtype_subdir($scfg, 'images');
 
     mkpath "${basedir}/${target_vmid}";
     my $source_dir = raw_name_to_dir($source_volname);
     my $target_dir = raw_name_to_dir($target_volname);
 
diff --git a/src/PVE/Storage/Common.pm b/src/PVE/Storage/Common.pm
index a784163e..58f2adfa 100644
--- a/src/PVE/Storage/Common.pm
+++ b/src/PVE/Storage/Common.pm
@@ -21,10 +21,13 @@ our @EXPORT_OK = qw(
     qemu_img_create
     qemu_img_create_qcow2_backed
     qemu_img_info
     qemu_img_measure
     qemu_img_resize
+
+    plugin_get_default_vtype_subdirs
+    plugin_get_vtype_subdir
 );
 
 use constant {
     FALLOC_FL_KEEP_SIZE => 0x01, # see linux/falloc.h
     FALLOC_FL_PUNCH_HOLE => 0x02, # see linux/falloc.h
@@ -125,10 +128,21 @@ my $GENERIC_VTYPE = {
     'vm-vol' => 'images',
     'vm-state' => 'images',
     'ct-vol' => 'rootdir',
 };
 
+# TODO: vtype split: (possibly) adapt default directories during migration period
+my $DEFAULT_VTYPE_SUBDIRS = {
+    images => 'images',
+    rootdir => 'private',
+    iso => 'template/iso',
+    vztmpl => 'template/cache',
+    backup => 'dump',
+    snippets => 'snippets',
+    import => 'import',
+};
+
 =head1 FUNCTIONS
 
 =cut
 
 =head3 generic_vtype
@@ -379,6 +393,43 @@ sub qemu_img_resize {
         $timeout = PVE::RPCEnvironment->is_worker() ? 60 * 60 : 10;
     }
     run_command($cmd, timeout => $timeout);
 }
 
+=head3 plugin_get_default_vtype_subdirs
+
+    my $vtype_subdirs = plugin_get_default_vtype_subdirs()
+
+Returns a hashref containing the default sub-directories for every volume type.
+
+=cut
+
+sub plugin_get_default_vtype_subdirs : prototype() () {
+    return { $DEFAULT_VTYPE_SUBDIRS->%* }; # shallow copy to prevent changes to defaults
+}
+
+=head3 plugin_get_vtype_subdir
+
+    my $subdir = plugin_get_vtype_subdir($scfg, $vtype)
+
+Returns the sub-directory for the volume type C<$vtype> of a given storage
+configuration C<$scfg> as an absolute path.
+
+Raises an exception if the storage config has no C<path> attribute or
+if the given C<$vtype> does not exist.
+
+=cut
+
+sub plugin_get_vtype_subdir : prototype($$) ($scfg, $vtype) {
+    my $path = $scfg->{path};
+
+    die "storage definition has no path\n" if !$path;
+
+    $vtype = 'images' if is_guest_vtype($vtype);
+    die "unknown vtype '$vtype'\n" if !exists($DEFAULT_VTYPE_SUBDIRS->{$vtype});
+
+    my $subdir = $scfg->{"content-dirs"}->{$vtype} // $DEFAULT_VTYPE_SUBDIRS->{$vtype};
+
+    return "$path/$subdir";
+}
+
 1;
diff --git a/src/PVE/Storage/ESXiPlugin.pm b/src/PVE/Storage/ESXiPlugin.pm
index 4c237f76..485e9422 100644
--- a/src/PVE/Storage/ESXiPlugin.pm
+++ b/src/PVE/Storage/ESXiPlugin.pm
@@ -624,16 +624,10 @@ sub volume_has_feature {
     return undef if defined($snapname) || $volname =~ /\.vmx$/;
     return 1 if $feature eq 'copy';
     return undef;
 }
 
-sub get_subdir {
-    my ($class, $scfg, $vtype) = @_;
-
-    die "no subdirectories available for storage $class\n";
-}
-
 package PVE::Storage::ESXiPlugin::Manifest;
 
 use strict;
 use warnings;
 
diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index 5f25ec51..febef741 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -13,11 +13,14 @@ use File::stat qw();
 
 use PVE::Tools qw(run_command);
 use PVE::JSONSchema qw(get_standard_option register_standard_option);
 use PVE::Cluster qw(cfs_register_file);
 
-use PVE::Storage::Common;
+use PVE::Storage::Common qw(
+    plugin_get_default_vtype_subdirs
+    plugin_get_vtype_subdir
+);
 
 use JSON;
 
 use base qw(PVE::SectionConfig);
 
@@ -1006,37 +1009,20 @@ sub volname_with_format {
 
     return $name if !$correct_fmt_ext;
     return "$name.$correct_fmt_ext";
 }
 
-my $vtype_subdirs = {
-    images => 'images',
-    rootdir => 'private',
-    iso => 'template/iso',
-    vztmpl => 'template/cache',
-    backup => 'dump',
-    snippets => 'snippets',
-    import => 'import',
-};
-
+# FIXME: remove on the next APIAGE reset.
 sub get_vtype_subdirs {
-    return $vtype_subdirs;
+    return plugin_get_default_vtype_subdirs();
 }
 
+# FIXME: remove on the next APIAGE reset.
 sub get_subdir {
     my ($class, $scfg, $vtype) = @_;
 
-    my $path = $scfg->{path};
-
-    die "storage definition has no path\n" if !$path;
-
-    $vtype = 'images' if PVE::Storage::Common::is_guest_vtype($vtype);
-    die "unknown vtype '$vtype'\n" if !exists($vtype_subdirs->{$vtype});
-
-    my $subdir = $scfg->{"content-dirs"}->{$vtype} // $vtype_subdirs->{$vtype};
-
-    return "$path/$subdir";
+    return plugin_get_vtype_subdir($scfg, $vtype);
 }
 
 my sub get_snap_name {
     my ($class, $volname, $snapname) = @_;
     die "missing snapname\n" if !$snapname;
@@ -1057,10 +1043,12 @@ sub filesystem_path {
     # Note: qcow2/qed has internal snapshot, so path is always
     # the same (with or without snapshot => same file).
     die "can't snapshot this image format\n"
         if defined($snapname) && $format !~ m/^(qcow2|qed)$/;
 
+    # FIXME: Call plugin_get_vtype_subdir() instead of $plugin->get_subdir()
+    # on the next APIAGE reset.
     my $dir = $class->get_subdir($scfg, $vtype);
 
     $dir .= "/$vmid" if PVE::Storage::Common::is_guest_vtype($vtype);
 
     my $path = "$dir/$name";
@@ -1188,10 +1176,12 @@ sub clone_image {
 
     die "this storage type does not support clone_image on subvolumes\n" if $format eq 'subvol';
 
     die "clone_image only works on base images\n" if !$isBase;
 
+    # FIXME: Call plugin_get_vtype_subdir() instead of $plugin->get_subdir()
+    # on the next APIAGE reset.
     my $imagedir = $class->get_subdir($scfg, 'images');
     $imagedir .= "/$vmid";
 
     mkpath $imagedir;
 
@@ -1221,10 +1211,12 @@ sub clone_image {
 }
 
 sub alloc_image {
     my ($class, $storeid, $scfg, $vmid, $fmt, $name, $size) = @_;
 
+    # FIXME: Call plugin_get_vtype_subdir() instead of $plugin->get_subdir()
+    # on the next APIAGE reset.
     my $imagedir = $class->get_subdir($scfg, 'images');
     $imagedir .= "/$vmid";
 
     mkpath $imagedir;
 
@@ -1799,10 +1791,12 @@ sub volume_has_feature {
 }
 
 sub list_images {
     my ($class, $storeid, $scfg, $vmid, $vollist, $cache) = @_;
 
+    # FIXME: Call plugin_get_vtype_subdir() instead of $plugin->get_subdir()
+    # on the next APIAGE reset.
     my $imagedir = $class->get_subdir($scfg, 'images');
 
     my $format_info = $class->get_formats($scfg, $storeid);
     my $fmts = join('|', sort keys $format_info->{valid}->%*);
 
@@ -1950,10 +1944,12 @@ sub list_volumes {
         my $data;
 
         if ($type eq 'images' || $type eq 'rootdir') {
             $data = $class->list_images($storeid, $scfg, $vmid);
         } elsif ($scfg->{path}) {
+            # FIXME: Call plugin_get_vtype_subdir() instead of
+            # $plugin->get_subdir() on the next APIAGE reset.
             my $path = $class->get_subdir($scfg, $type);
 
             if ($type eq 'iso' && !defined($vmid)) {
                 $data = get_subdir_files($storeid, $path, 'iso');
             } elsif ($type eq 'vztmpl' && !defined($vmid)) {
@@ -2145,10 +2141,12 @@ sub activate_storage {
     }
 
     my $try_create_subdir = sub {
         my ($vtype) = @_;
 
+        # FIXME: Call plugin_get_vtype_subdir() instead of $plugin->get_subdir()
+        # on the next APIAGE reset.
         my $subdir = $class->get_subdir($scfg, $vtype);
 
         File::Path::make_path($subdir, { error => \my $errors });
         if (defined($errors) && scalar($errors->@*)) {
             my $msg = "failed to create content directory '$subdir' for content '$vtype'";
@@ -2184,24 +2182,27 @@ sub activate_storage {
     if (
         (!defined($scfg->{'create-subdirs'}) || $scfg->{'create-subdirs'})
         # FIXME The mkdir option is deprecated. Remove with PVE 9?
         && (!defined($scfg->{mkdir}) || $scfg->{mkdir})
     ) {
-        for my $vtype (sort keys %$vtype_subdirs) {
+        my $vtype_subdirs = plugin_get_default_vtype_subdirs();
+        for my $vtype (sort keys $vtype_subdirs->%*) {
             # OpenVZMigrate uses backup (dump) dir
             if (
                 defined($dir_vtypes->{$vtype})
                 || ($vtype eq 'backup' && defined($scfg->{content}->{'rootdir'}))
             ) {
                 $try_create_subdir->($vtype);
             }
         }
     }
 
     # check that content dirs are pairwise inequal
     my $resolved_subdirs = {};
     for my $vtype (sort keys $dir_vtypes->%*) {
+        # FIXME: Call plugin_get_vtype_subdir() instead of $plugin->get_subdir()
+        # on the next APIAGE reset.
         my $subdir = $class->get_subdir($scfg, $vtype);
         my $abs_subdir = abs_path($subdir);
         next if !defined($abs_subdir);
 
         die "storage '$storeid' uses directory $abs_subdir for multiple content types\n"
diff --git a/src/test/get_subdir_test.pm b/src/test/get_subdir_test.pm
index 9f7e2266..02d377d5 100644
--- a/src/test/get_subdir_test.pm
+++ b/src/test/get_subdir_test.pm
@@ -3,20 +3,24 @@ package PVE::Storage::TestGetSubdir;
 use strict;
 use warnings;
 
 use lib qw(..);
 
+use PVE::Storage::Common qw(
+    plugin_get_default_vtype_subdirs
+    plugin_get_vtype_subdir
+);
 use PVE::Storage::Plugin;
 use Test::More;
 
 my $scfg_with_path = { path => '/some/path' };
-my $vtype_subdirs = PVE::Storage::Plugin::get_vtype_subdirs();
+my $vtype_subdirs = plugin_get_default_vtype_subdirs();
 
 # each test is comprised of the following array keys:
 # [0] => storage config; positive with path key
 # [1] => storage type;  see $vtype_subdirs
-# [2] => expected return from get_subdir
+# [2] => expected return from plugin_get_vtype_subdir
 my $tests = [
     # failed matches
     [$scfg_with_path, 'none', "unknown vtype 'none'\n"],
     [{}, 'iso', "storage definition has no path\n"],
 ];
@@ -50,14 +54,14 @@ plan tests => scalar @$tests;
 
 foreach my $tt (@$tests) {
     my ($scfg, $type, $expected) = @$tt;
 
     my $got;
-    eval { $got = PVE::Storage::Plugin->get_subdir($scfg, $type) };
+    eval { $got = plugin_get_vtype_subdir($scfg, $type) };
     $got = $@ if $@;
 
-    is($got, $expected, "get_subdir for $type") || diag(explain($got));
+    is($got, $expected, "plugin_get_vtype_subdir for $type") || diag(explain($got));
 }
 
 done_testing();
 
 1;
diff --git a/src/test/parse_volname_test.pm b/src/test/parse_volname_test.pm
index 5eb7f55c..a3b4d568 100644
--- a/src/test/parse_volname_test.pm
+++ b/src/test/parse_volname_test.pm
@@ -4,10 +4,13 @@ use strict;
 use warnings;
 
 use lib qw(..);
 
 use PVE::Storage;
+use PVE::Storage::Common qw(
+    plugin_get_default_vtype_subdirs
+);
 use Test::More;
 
 my $vmid = 1234;
 
 {
@@ -593,11 +596,12 @@ push $tests->@*,
 # run through test case array
 #
 plan tests => scalar @$tests + 1;
 
 my $seen_vtype;
-my $vtype_subdirs = { map { $_ => 1 } keys %{ PVE::Storage::Plugin::get_vtype_subdirs() } };
+my $vtype_subdirs =
+    { map { $_ => 1 } keys %{ plugin_get_default_vtype_subdirs() } };
 
 foreach my $t (@$tests) {
     my $description = $t->{description};
     my $volname = $t->{volname};
     my $expected = $t->{expected};
diff --git a/src/test/path_to_volume_id_test.pm b/src/test/path_to_volume_id_test.pm
index ff162b1d..03753c38 100644
--- a/src/test/path_to_volume_id_test.pm
+++ b/src/test/path_to_volume_id_test.pm
@@ -4,10 +4,13 @@ use strict;
 use warnings;
 
 use lib qw(..);
 
 use PVE::Storage;
+use PVE::Storage::Common qw(
+    plugin_get_default_vtype_subdirs
+);
 
 use Test::More;
 
 use Cwd;
 use File::Basename;
@@ -235,11 +238,12 @@ my @tests = (
 );
 
 plan tests => scalar @tests + 1;
 
 my $seen_vtype;
-my $vtype_subdirs = { map { $_ => 1 } keys %{ PVE::Storage::Plugin::get_vtype_subdirs() } };
+my $vtype_subdirs =
+    { map { $_ => 1 } keys %{ plugin_get_default_vtype_subdirs() } };
 
 foreach my $tt (@tests) {
     my $file = $tt->{volname};
     my $expected = $tt->{expected};
     my $description = $tt->{description};
diff --git a/src/test/run_volume_access_tests.pl b/src/test/run_volume_access_tests.pl
index 12d5544e..2de57a26 100755
--- a/src/test/run_volume_access_tests.pl
+++ b/src/test/run_volume_access_tests.pl
@@ -11,10 +11,13 @@ use Test::More;
 use lib ('.', '..');
 
 use PVE::API2::Storage::PruneBackups;
 use PVE::RPCEnvironment;
 use PVE::Storage;
+use PVE::Storage::Common qw(
+    plugin_get_default_vtype_subdirs
+);
 use PVE::Storage::Plugin;
 use PVE::Tools;
 
 my $storage_dir = tempdir(CLEANUP => 1);
 
@@ -68,11 +71,11 @@ $pve_cluster_module->mock(
 );
 
 my $rpcenv = PVE::RPCEnvironment->init('pub');
 $rpcenv->init_request();
 
-my @types = sort (keys PVE::Storage::Plugin::get_vtype_subdirs()->%*, qw(vm-vol vm-state ct-vol));
+my @types = sort (keys plugin_get_default_vtype_subdirs()->%*, qw(vm-vol vm-state ct-vol));
 my $all_types = { map { $_ => 1 } @types };
 
 my @tests = (
     {
         volid => 'dir:backup/vzdump-qemu-100-2025_07_29-13_00_55.vma',
-- 
2.47.3





  parent reply	other threads:[~2026-11-17 20:41 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 20:38 [PATCH manager/storage v3 00/51] Fix #2884: Implement Subdirectory Scanning for Dir-Based Storage Types Max R. Carrara
2026-11-17 20:38 ` [PATCH pve-storage v3 01/51] test: plugin tests: run tests with at most 4 jobs Max R. Carrara
2026-11-17 20:38 ` [PATCH pve-storage v3 02/51] plugin, common: remove superfluous use of =pod command paragraph Max R. Carrara
2026-11-17 20:38 ` [PATCH pve-storage v3 03/51] common: use Exporter module for PVE::Storage::Common Max R. Carrara
2026-11-17 20:38 ` [PATCH pve-storage v3 04/51] plugin: make get_subdir_files a proper subroutine and update style Max R. Carrara
2026-11-17 20:38 ` Max R. Carrara [this message]
2026-11-17 20:38 ` [PATCH pve-storage v3 06/51] common: prevent autovivification in plugin_get_vtype_subdir helper Max R. Carrara
2026-11-17 20:38 ` [PATCH pve-storage v3 07/51] plugin: break up if-elsif chain into separate if-blocks Max R. Carrara
2026-11-17 20:38 ` [PATCH pve-storage v3 08/51] plugin: adapt get_subdir_files helper of list_volumes API method Max R. Carrara
2026-11-17 20:38 ` [PATCH pve-storage v3 09/51] plugin: update code style of list_volumes plugin " Max R. Carrara
2026-11-17 20:38 ` [PATCH pve-storage v3 10/51] plugin: use closure for obtaining raw volume data in list_volumes Max R. Carrara
2026-11-17 20:38 ` [PATCH pve-storage v3 11/51] plugin: use closure for inner loop logic " Max R. Carrara
2026-11-17 20:38 ` [PATCH pve-storage v3 12/51] storage: update code style in function path_to_volume_id Max R. Carrara
2026-11-17 20:38 ` [PATCH pve-storage v3 13/51] storage: break up if-elsif chain in path_to_volume_id Max R. Carrara
2026-11-17 20:38 ` [PATCH pve-storage v3 14/51] storage: heave vtype file path parsing logic inside loop into helper Max R. Carrara
2026-11-17 20:38 ` [PATCH pve-storage v3 15/51] storage: clean up code that was moved into helper in path_to_volume_id Max R. Carrara
2026-11-17 20:38 ` [PATCH pve-storage v3 16/51] api: status: move content type assert for up-/downloads into helper Max R. Carrara
2026-11-17 20:38 ` [PATCH pve-storage v3 17/51] api: status: use get_subdir helper method to get content directory Max R. Carrara
2026-11-17 20:38 ` [PATCH pve-storage v3 18/51] api: status: move up-/download file path parsing code into helper Max R. Carrara
2026-11-17 20:38 ` [PATCH pve-storage v3 19/51] api: status: simplify file content assertion logic for up-/download Max R. Carrara
2026-11-17 20:38 ` [PATCH pve-storage v3 20/51] test: guest import: add tests for PVE::GuestImport Max R. Carrara
2026-11-17 20:38 ` [PATCH pve-storage v3 21/51] tree-wide: introduce parsing module and replace usages of ISO_EXT_RE_0 Max R. Carrara
2026-11-17 20:38 ` [PATCH pve-storage v3 22/51] common: test: set up parser testing code, add tests for 'iso' vtype Max R. Carrara
2026-11-17 20:38 ` [PATCH pve-storage v3 23/51] tree-wide: replace usages of VZTMPL_EXT_RE_1 with parsing functions Max R. Carrara
2026-11-17 20:38 ` [PATCH pve-storage v3 24/51] tree-wide: replace usages of BACKUP_EXT_RE_2 " Max R. Carrara
2026-11-17 20:38 ` [PATCH pve-storage v3 25/51] tree-wide: replace usages of inline regexes for snippets with parsers Max R. Carrara
2026-11-17 20:38 ` [PATCH pve-storage v3 26/51] tree-wide: partially replace usages of regexes for 'import' vtype Max R. Carrara
2026-11-17 20:38 ` [PATCH pve-storage v3 27/51] tree-wide: replace remaining " Max R. Carrara
2026-11-17 20:39 ` [PATCH pve-storage v3 28/51] tree-wide: simplify recently refactored parsing logic Max R. Carrara
2026-11-17 20:39 ` [PATCH pve-storage v3 29/51] test: list volumes: reorganize and modernize test running code Max R. Carrara
2026-11-17 20:39 ` [PATCH pve-storage v3 30/51] test: list volumes: fix broken test checking for vmlist modifications Max R. Carrara
2026-11-17 20:39 ` [PATCH pve-storage v3 31/51] test: list volumes: introduce new format for test cases Max R. Carrara
2026-11-17 20:39 ` [PATCH pve-storage v3 32/51] test: list volumes: remove legacy code and migrate cases to new format Max R. Carrara
2026-11-17 20:39 ` [PATCH pve-storage v3 33/51] plugin: do not return volumes of undeclared content types anymore Max R. Carrara
2026-11-17 20:39 ` [PATCH pve-storage v3 34/51] plugin: correct comment in get_subdir_files helper Max R. Carrara
2026-11-17 20:39 ` [PATCH pve-storage v3 35/51] test: parse volname: modernize code Max R. Carrara
2026-11-17 20:39 ` [PATCH pve-storage v3 36/51] test: parse volname: adapt tests regarding 'import' volume type Max R. Carrara
2026-11-17 20:39 ` [PATCH pve-storage v3 37/51] test: parse volname: move VM disk test creation into separate block Max R. Carrara
2026-11-17 20:39 ` [PATCH pve-storage v3 38/51] test: parse volname: move backup file test creation into sep. block Max R. Carrara
2026-11-17 20:39 ` [PATCH pve-storage v3 39/51] test: parse volname: parameterize test case creation for some vtypes Max R. Carrara
2026-11-17 20:39 ` [PATCH pve-storage v3 40/51] test: volume id: modernize code Max R. Carrara
2026-11-17 20:39 ` [PATCH pve-storage v3 41/51] test: volume id: rename 'volname' test case parameter to 'file' Max R. Carrara
2026-11-17 20:39 ` [PATCH pve-storage v3 42/51] test: filesystem path: modernize code Max R. Carrara
2026-11-17 20:39 ` [PATCH pve-storage v3 43/51] plugin: list content directories without globbing Max R. Carrara
2026-11-18  9:12 ` [PATCH pve-storage v3 44/51] fix #2884: implement nested subdir scanning and support 'iso' vtype Max R. Carrara
2026-11-18  9:14 ` [PATCH pve-storage v3 45/51] fix #2884: support nested subdir scanning for 'vztmpl' volume type Max R. Carrara
2026-11-18  9:14   ` [PATCH pve-storage v3 46/51] fix #2884: support nested subdir scanning for 'snippets' vtype Max R. Carrara
2026-11-18  9:14   ` [PATCH pve-storage v3 47/51] test: add more tests for 'import' vtype & guard against nested subdirs Max R. Carrara
2026-11-18  9:14   ` [PATCH pve-storage v3 48/51] test: add tests guarding against subdir scanning for vtypes Max R. Carrara
2026-11-18  9:14   ` [PATCH pve-storage v3 49/51] storage: resolve images in content dir overrides ending with a slash Max R. Carrara
2026-11-18  9:14   ` [PATCH pve-storage v3 50/51] bump the storage plugin API version Max R. Carrara
2026-11-18  9:14   ` [PATCH pve-manager v3 51/51] fix #2884: ui: storage: add field for 'max-scan-depth' property Max R. Carrara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261117203953.913035-6-m.carrara@proxmox.com \
    --to=m.carrara@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=w.bumiller@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal