api: disks: create: re-check disk after fork/lock

Because then it might not be unused anymore. If there really is a
race, this prevents e.g. sgdisk creating a partition on a device
already in use by LVM or LVM destroying a partitioned device.

For ZFS, also get the latest udev info once inside the worker.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fabian Ebner
2021-09-28 13:39:41 +02:00
committed by Thomas Lamprecht
parent dcd8f3a3dd
commit e99bc248d4
4 changed files with 13 additions and 3 deletions

View File

@ -154,6 +154,8 @@ __PACKAGE__->register_method ({
my $worker = sub {
PVE::Diskmanage::locked_disk_action(sub {
PVE::Diskmanage::assert_disk_unused($dev);
PVE::Storage::LVMPlugin::lvm_create_volume_group($dev, $name);
if ($param->{add_storage}) {