[PATCH pve-storage v1 13/54] storage: update code style in function path_to_volume_id

Max R. Carrara
2026-04-22T11:14:17Z

Also rename the initially parsed storeid from `$sid` to
`$parsed_storeid`.

Signed-off-by: Max R. Carrara <m.carrara@proxmox.com>
---
src/PVE/Storage.pm | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm
index ef2e7887..70844602 100755
--- a/src/PVE/Storage.pm
+++ b/src/PVE/Storage.pm
@@ -696,9 +696,9 @@ sub path_to_volume_id {

my $ids = $cfg->{ids};

- my ($sid, $volname) = parse_volume_id($path, 1);
- if ($sid) {
- if (my $scfg = $ids->{$sid}) {
+ my ($parsed_storeid, $volname) = parse_volume_id($path, 1);
+ if ($parsed_storeid) {
+ if (my $scfg = $ids->{$parsed_storeid}) {
if ($scfg->{path}) {
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
my ($vtype, $name, $vmid) = $plugin->parse_volname($volname);
@@ -712,7 +712,7 @@ sub path_to_volume_id {
# for example when nfs storage is not mounted
$path = abs_path($path) || $path;

- foreach my $sid (keys %$ids) {
+ for my $sid (keys $ids->%*) {
my $scfg = $ids->{$sid};
next if !$scfg->{path};
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
@@ -728,7 +728,7 @@ sub path_to_volume_id {
my $name = $2;

my $vollist = $plugin->list_images($sid, $scfg, $vmid);
- foreach my $info (@$vollist) {
+ for my $info ($vollist->@*) {
my ($storeid, $volname) = parse_volume_id($info->{volid});
my $volpath = $plugin->path($scfg, $volname, $storeid);
if ($volpath eq $path) {
--
2.47.3