Use a common interface for find_free_diskname

We can use 'list_images' to get the desired volume IDs in
'find_free_diskname' for most plugins. For the two LVM plugins, 'list_images'
potentially skips untagged volumes, so we keep the custom version. For the
RBD plugin, 'list_images' is much more costly than the custom version, so we
keep the custom version.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fabian Ebner
2019-12-11 10:25:49 +01:00
committed by Thomas Lamprecht
parent a573f66a2e
commit a44c0147bc
7 changed files with 30 additions and 50 deletions

View File

@ -294,7 +294,7 @@ sub alloc_image {
my $volname = $name;
$volname = $class->zfs_find_free_diskname($storeid, $scfg, $vmid, $fmt) if !$volname;
$volname = $class->find_free_diskname($storeid, $scfg, $vmid, $fmt) if !$volname;
$class->zfs_create_zvol($scfg, $volname, $size);