From fcbec6545be3b3e4b08e902b26f5daedf3cf4871 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Thu, 31 Jan 2013 08:14:55 +0100 Subject: [PATCH] fix path_to_volume_id to work with base volumes and clones --- PVE/Storage.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/PVE/Storage.pm b/PVE/Storage.pm index 0dd2345..78a14f9 100755 --- a/PVE/Storage.pm +++ b/PVE/Storage.pm @@ -303,7 +303,15 @@ sub path_to_volume_id { if ($path =~ m!^$imagedir/(\d+)/([^/\s]+)$!) { my $vmid = $1; my $name = $2; - return ('images', "$sid:$vmid/$name"); + + my $vollist = $plugin->list_images($sid, $scfg, $vmid); + foreach my $info (@$vollist) { + my ($storeid, $volname) = parse_volume_id($info->{volid}); + my $volpath = $plugin->path($scfg, $volname, $storeid); + if ($volpath eq $path) { + return ('images', $info->{volid}); + } + } } elsif ($path =~ m!^$isodir/([^/]+\.[Ii][Ss][Oo])$!) { my $name = $1; return ('iso', "$sid:iso/$name"); -- 2.39.5