diff --git a/PVE/API2/Disks.pm b/PVE/API2/Disks.pm index 6c20931..96c19fd 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; @@ -302,7 +303,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 diff --git a/PVE/API2/Disks/Directory.pm b/PVE/API2/Disks/Directory.pm index 0068db6..1285274 100644 --- a/PVE/API2/Disks/Directory.pm +++ b/PVE/API2/Disks/Directory.pm @@ -266,6 +266,12 @@ __PACKAGE__->register_method ({ $write_ini->($ini, $mountunitpath); + # 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 and the $uuid_path symlink is actually created! + eval { run_command(['udevadm', 'trigger', $part]); }; + warn $@ if $@; + run_command(['systemctl', 'daemon-reload']); run_command(['systemctl', 'enable', $mountunitname]); run_command(['systemctl', 'start', $mountunitname]); diff --git a/PVE/API2/Disks/LVM.pm b/PVE/API2/Disks/LVM.pm index 2c216c0..eb8f5c0 100644 --- a/PVE/API2/Disks/LVM.pm +++ b/PVE/API2/Disks/LVM.pm @@ -7,7 +7,7 @@ use PVE::Storage::LVMPlugin; use PVE::Diskmanage; use PVE::JSONSchema qw(get_standard_option); use PVE::API2::Storage::Config; -use PVE::Tools qw(lock_file); +use PVE::Tools qw(lock_file run_command); use PVE::RPCEnvironment; use PVE::RESTHandler; @@ -158,6 +158,12 @@ __PACKAGE__->register_method ({ PVE::Storage::LVMPlugin::lvm_create_volume_group($dev, $name); + # 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', $dev]); }; + warn $@ if $@; + if ($param->{add_storage}) { my $storage_params = { type => 'lvm', diff --git a/PVE/API2/Disks/LVMThin.pm b/PVE/API2/Disks/LVMThin.pm index 81d91a6..2fd8484 100644 --- a/PVE/API2/Disks/LVMThin.pm +++ b/PVE/API2/Disks/LVMThin.pm @@ -132,6 +132,12 @@ __PACKAGE__->register_method ({ $name ]); + # 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', $dev]); }; + warn $@ if $@; + if ($param->{add_storage}) { my $storage_params = { type => 'lvmthin', diff --git a/PVE/API2/Disks/ZFS.pm b/PVE/API2/Disks/ZFS.pm index 885b93c..1534631 100644 --- a/PVE/API2/Disks/ZFS.pm +++ b/PVE/API2/Disks/ZFS.pm @@ -406,6 +406,12 @@ __PACKAGE__->register_method ({ run_command($cmd); } + # 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', $devs->@*]); }; + warn $@ if $@; + if ($param->{add_storage}) { my $storage_params = { type => 'zfspool',