From 7c2a554b9747683e1eae488862cca9513e5e7b52 Mon Sep 17 00:00:00 2001 From: Friedrich Weber Date: Fri, 31 Oct 2025 11:36:10 +0100 Subject: [PATCH] storage: activate/map volumes: verify and pass hints to plugin Plugin methods {activate,map}_volume accept an optional hints parameter. Make PVE::Storage::{activate,map}_volumes also accept hints, verify they are consistent with the schema, and pass them down to the plugin when activating the volumes. Signed-off-by: Friedrich Weber Link: https://lore.proxmox.com/20251031103709.60233-4-f.weber@proxmox.com --- src/PVE/Storage.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm index 8da38a7..6e87bac 100755 --- a/src/PVE/Storage.pm +++ b/src/PVE/Storage.pm @@ -1122,7 +1122,9 @@ sub vdisk_create_base { } sub map_volume { - my ($cfg, $volid, $snapname) = @_; + my ($cfg, $volid, $snapname, $hints) = @_; + + PVE::Storage::Plugin::verify_hints($hints); my ($storeid, $volname) = parse_volume_id($volid); @@ -1130,7 +1132,7 @@ sub map_volume { my $plugin = PVE::Storage::Plugin->lookup($scfg->{type}); - return $plugin->map_volume($storeid, $scfg, $volname, $snapname); + return $plugin->map_volume($storeid, $scfg, $volname, $snapname, $hints); } sub unmap_volume { @@ -1386,10 +1388,12 @@ sub deactivate_storage { } sub activate_volumes { - my ($cfg, $vollist, $snapname) = @_; + my ($cfg, $vollist, $snapname, $hints) = @_; return if !($vollist && scalar(@$vollist)); + PVE::Storage::Plugin::verify_hints($hints); + my $storagehash = {}; foreach my $volid (@$vollist) { my ($storeid, undef) = parse_volume_id($volid); @@ -1404,7 +1408,7 @@ sub activate_volumes { my ($storeid, $volname) = parse_volume_id($volid); my $scfg = storage_config($cfg, $storeid); my $plugin = PVE::Storage::Plugin->lookup($scfg->{type}); - $plugin->activate_volume($storeid, $scfg, $volname, $snapname, $cache); + $plugin->activate_volume($storeid, $scfg, $volname, $snapname, $cache, $hints); } }