X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=PVE%2FAPI2%2FDisks.pm;h=25c9ded4eb7a273beaf0631cb8af92e40ce36742;hb=ecfe25058bb02eaa362ce65ca258f4e3bd7f5ae8;hp=6c20931d5d4cecca85c937005c076e50f9779981;hpb=2829e6a85326cc8263232cbca730e3e7cdc13b69;p=pve-storage.git diff --git a/PVE/API2/Disks.pm b/PVE/API2/Disks.pm index 6c20931..25c9ded 100644 --- a/PVE/API2/Disks.pm +++ b/PVE/API2/Disks.pm @@ -9,6 +9,7 @@ use HTTP::Status qw(:constants); use PVE::Diskmanage; use PVE::JSONSchema qw(get_standard_option); use PVE::SafeSyslog; +use PVE::Tools qw(run_command); use PVE::API2::Disks::Directory; use PVE::API2::Disks::LVM; @@ -259,6 +260,7 @@ __PACKAGE__->register_method ({ my $authuser = $rpcenv->get_user(); + die "$disk is a partition\n" if PVE::Diskmanage::is_partition($disk); die "disk $disk already in use\n" if PVE::Diskmanage::disk_is_used($disk); my $worker = sub { PVE::Diskmanage::init_disk($disk, $param->{uuid}); @@ -302,7 +304,15 @@ __PACKAGE__->register_method ({ my $rpcenv = PVE::RPCEnvironment::get(); my $authuser = $rpcenv->get_user(); - my $worker = sub { PVE::Diskmanage::wipe_blockdev($disk); }; + my $worker = sub { + PVE::Diskmanage::wipe_blockdev($disk); + + # FIXME: Remove once we depend on systemd >= v249. + # Work around udev bug https://github.com/systemd/systemd/issues/18525 to ensure the + # udev database is updated. + eval { run_command(['udevadm', 'trigger', $disk]); }; + warn $@ if $@; + }; my $basename = basename($disk); # avoid '/' in the ID