drive: volume in-use check: fix fallback path comparison

When checking whether a volume is still referenced by a snapshot, the volid
itself is first checked. When the volid is different, we fall back to comparing
the path.

As the first value to be compared is a volume's path, the second value better be
a volume's path too, and not a snapshot's path.

See also 77019edfe0 for historical context.

The error that led me here:
* had a VM with ZFS over iSCSI storage with an exsiting snapshot
* add new unused drive
* try to remove the unsued drive
* fails, because ZFS (not Pool!) Plugin does not support snapshot paths.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fabian Ebner 2021-04-15 12:10:57 +02:00 committed by Thomas Lamprecht
parent 04fac98acc
commit a0d8d8592a

View File

@ -590,7 +590,7 @@ sub is_volume_in_use {
next if !$storeid;
my $scfg = PVE::Storage::storage_config($storecfg, $storeid, 1);
next if !$scfg;
return 1 if $path eq PVE::Storage::path($storecfg, $drive->{file}, $snapname);
return 1 if $path eq PVE::Storage::path($storecfg, $drive->{file});
}
}
}