[pve-devel] [PATCH pve-manager master v2 1/2] fix #6652: ceph: osd: enable autoactivation for OSD LVs on creation

Max R. Carrara m.carrara at proxmox.com
Wed Aug 13 15:40:25 CEST 2025


... by adding an inline helper sub for `lvcreate` instead of using the
LVM storage plugin's helper sub.

Autoactivation is required for LVs used by Ceph OSDs, as Ceph
otherwise doesn't activate them by itself.

This is a regression from f296ffc4e4d in pve-storage [0].

[0]: https://git.proxmox.com/?p=pve-storage.git;a=commitdiff;h=f296ffc4e4d64b574c3001dc7cc6af3da1406441

Fixes: #6652
Signed-off-by: Max R. Carrara <m.carrara at proxmox.com>
---
 PVE/API2/Ceph/OSD.pm | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/PVE/API2/Ceph/OSD.pm b/PVE/API2/Ceph/OSD.pm
index 23e187ce..0f850415 100644
--- a/PVE/API2/Ceph/OSD.pm
+++ b/PVE/API2/Ceph/OSD.pm
@@ -423,6 +423,29 @@ __PACKAGE__->register_method({
         # See FIXME below
         my @udev_trigger_devs = ();
 
+        # $size is in kibibytes
+        my $osd_lvcreate = sub {
+            my ($vg, $lv, $size) = @_;
+
+            my $cmd = [
+                '/sbin/lvcreate',
+                '-aly',
+                '-Wy',
+                '--yes',
+                '--size',
+                $size . "k",
+                '--name',
+                $lv,
+                # explicitly enable autoactivation, because Ceph never explicitly
+                # activates LVs by itself
+                '--setautoactivation',
+                'y',
+                $vg,
+            ];
+
+            run_command($cmd, errmsg => "lvcreate '$vg/$lv' error");
+        };
+
         my $create_part_or_lv = sub {
             my ($dev, $size, $type) = @_;
 
@@ -443,7 +466,7 @@ __PACKAGE__->register_method({
                 my $lv = $type . "-" . UUID::uuid();
 
                 PVE::Storage::LVMPlugin::lvm_create_volume_group($dev->{devpath}, $vg);
-                PVE::Storage::LVMPlugin::lvcreate($vg, $lv, "${size}k");
+                $osd_lvcreate->($lv, $vg, $size);
 
                 if (PVE::Diskmanage::is_partition($dev->{devpath})) {
                     eval { PVE::Diskmanage::change_parttype($dev->{devpath}, '8E00'); };
@@ -475,7 +498,7 @@ __PACKAGE__->register_method({
 
                 my $lv = $type . "-" . UUID::uuid();
 
-                PVE::Storage::LVMPlugin::lvcreate($vg, $lv, "${size}k");
+                $osd_lvcreate->($vg, $lv, $size);
 
                 return "$vg/$lv";
 
-- 
2.47.2





More information about the pve-devel mailing list