]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/API2/Disks/LVM.pm
api: disk: work around udev bug to ensure its database is updated
[pve-storage.git] / PVE / API2 / Disks / LVM.pm
index 2c216c0f6baeb7d20c3f841a1cd137d944b25c35..eb8f5c0d07856e72b5a1c514674294e04eca9251 100644 (file)
@@ -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',