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:
committed by
Thomas Lamprecht
parent
dcd8f3a3dd
commit
e99bc248d4
@ -212,6 +212,8 @@ __PACKAGE__->register_method ({
|
||||
my $mountunitpath = "/etc/systemd/system/$mountunitname";
|
||||
|
||||
PVE::Diskmanage::locked_disk_action(sub {
|
||||
PVE::Diskmanage::assert_disk_unused($dev);
|
||||
|
||||
# create partition
|
||||
my $cmd = [$SGDISK, '-n1', '-t1:8300', $dev];
|
||||
print "# ", join(' ', @$cmd), "\n";
|
||||
|
||||
Reference in New Issue
Block a user