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 <f.weber@proxmox.com>
Link: https://lore.proxmox.com/20251031103709.60233-4-f.weber@proxmox.com
This commit is contained in:
committed by
Thomas Lamprecht
parent
8818ff0d1d
commit
7c2a554b97
@ -1122,7 +1122,9 @@ sub vdisk_create_base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub map_volume {
|
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);
|
my ($storeid, $volname) = parse_volume_id($volid);
|
||||||
|
|
||||||
@ -1130,7 +1132,7 @@ sub map_volume {
|
|||||||
|
|
||||||
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
|
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 {
|
sub unmap_volume {
|
||||||
@ -1386,10 +1388,12 @@ sub deactivate_storage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub activate_volumes {
|
sub activate_volumes {
|
||||||
my ($cfg, $vollist, $snapname) = @_;
|
my ($cfg, $vollist, $snapname, $hints) = @_;
|
||||||
|
|
||||||
return if !($vollist && scalar(@$vollist));
|
return if !($vollist && scalar(@$vollist));
|
||||||
|
|
||||||
|
PVE::Storage::Plugin::verify_hints($hints);
|
||||||
|
|
||||||
my $storagehash = {};
|
my $storagehash = {};
|
||||||
foreach my $volid (@$vollist) {
|
foreach my $volid (@$vollist) {
|
||||||
my ($storeid, undef) = parse_volume_id($volid);
|
my ($storeid, undef) = parse_volume_id($volid);
|
||||||
@ -1404,7 +1408,7 @@ sub activate_volumes {
|
|||||||
my ($storeid, $volname) = parse_volume_id($volid);
|
my ($storeid, $volname) = parse_volume_id($volid);
|
||||||
my $scfg = storage_config($cfg, $storeid);
|
my $scfg = storage_config($cfg, $storeid);
|
||||||
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user