]> git.proxmox.com Git - pve-storage.git/commit - PVE/API2/Disks/LVMThin.pm
disks: die if storage name is already in use
authorAaron Lauterer <a.lauterer@proxmox.com>
Fri, 19 Aug 2022 15:01:20 +0000 (17:01 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Tue, 13 Sep 2022 08:05:16 +0000 (10:05 +0200)
commit55553bd4322bef1966d6822aaec96e4321ee77bc
treee43a945b6dcf12b160ad841840439966aaff3c4c
parent4de6002558a6c7f9366fd61c7cecb31a6de78721
disks: die if storage name is already in use

If a storage of that type and name already exists (LVM, zpool, ...) but
we do not have a Proxmox VE Storage config for it, it is possible that
the creation will fail midway due to checks done by the underlying
storage layer itself. This in turn can lead to disks that are already
partitioned. Users would need to clean this up themselves.

By adding checks early on, not only checking against the PVE storage
config, but against the actual storage type itself, we can die early
enough, before we touch any disk.

For ZFS, the logic to gather pool data is moved into its own function to
be called from the index API endpoint and the check in the create
endpoint.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
PVE/API2/Disks/Directory.pm
PVE/API2/Disks/LVM.pm
PVE/API2/Disks/LVMThin.pm
PVE/API2/Disks/ZFS.pm