add storage_has_feature() helper function

Which looks up whether a storage supports a given feature in its
'plugindata'. This is intentionally kept simple and not implemented
as a plugin method for now. Should it ever become more complex
requiring plugins to override the default implementation, it can
later be changed to a method.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Link: https://lore.proxmox.com/20250404133204.239783-3-f.ebner@proxmox.com
This commit is contained in:
Fiona Ebner
2025-04-04 15:31:37 +02:00
committed by Thomas Lamprecht
parent 7c62215e48
commit 0066560da4
2 changed files with 18 additions and 0 deletions

View File

@ -213,6 +213,14 @@ sub storage_check_enabled {
return storage_check_node($cfg, $storeid, $node, $noerr);
}
sub storage_has_feature {
my ($cfg, $storeid, $feature) = @_;
my $scfg = storage_config($cfg, $storeid);
return PVE::Storage::Plugin::storage_has_feature($scfg->{type}, $feature);
}
# storage_can_replicate:
# return true if storage supports replication
# (volumes allocated with vdisk_alloc() has replication feature)