]> git.proxmox.com Git - pve-storage.git/commitdiff
Diskmanage: save OSD information for individual partitions
authorFabian Ebner <f.ebner@proxmox.com>
Tue, 26 Jan 2021 11:45:26 +0000 (12:45 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 6 Feb 2021 12:52:20 +0000 (13:52 +0100)
in preparation to including partitions for get_disks()

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
PVE/Diskmanage.pm

index d2e3f73dc83f5fc0ee4243f0d6006591eb9b8dc1..7c07e52c7cc46d9d0d62f5357670fc093bb51822 100644 (file)
@@ -650,7 +650,11 @@ sub get_disks {
                $bluestore = 1 if $ceph_volume->{bluestore};
                $osdencrypted = 1 if $ceph_volume->{encrypted};
            }
-           return 1;
+
+           my $result = { %{$ceph_volume} };
+           $result->{journals} = delete $result->{journal}
+               if $result->{journal};
+           return $result;
        };
 
        my $partitions = {};
@@ -658,14 +662,16 @@ sub get_disks {
        dir_glob_foreach("$sysdir", "$dev.+", sub {
            my ($part) = @_;
 
+           $partitions->{$part} = $collect_ceph_info->("$partpath/$part");
+           my $lvm_based_osd = defined($partitions->{$part});
+
            $partitions->{$part}->{devpath} = "$partpath/$part";
            $partitions->{$part}->{gpt} = $data->{gpt};
            $partitions->{$part}->{size} =
                get_sysdir_size("$sysdir/$part") // 0;
            $partitions->{$part}->{used} =
                $determine_usage->("$partpath/$part", "$sysdir/$part", 1);
-
-           my $lvm_based_osd = $collect_ceph_info->("$partpath/$part");
+           $partitions->{$part}->{osdid} //= -1;
 
            # Avoid counting twice (e.g. partition on which the LVM for the
            # DB OSD resides is present in the $journalhash)
@@ -676,6 +682,7 @@ sub get_disks {
            if (my $mp = $mounted->{"$partpath/$part"}) {
                if ($mp =~ m|^/var/lib/ceph/osd/ceph-(\d+)$|) {
                    $osdid = $1;
+                   $partitions->{$part}->{osdid} = $osdid;
                }
            }
 
@@ -684,6 +691,11 @@ sub get_disks {
                $db_count++ if $journal_part == 2;
                $wal_count++ if $journal_part == 3;
                $bluestore = 1 if $journal_part == 4;
+
+               $partitions->{$part}->{journals} = 1 if $journal_part == 1;
+               $partitions->{$part}->{db} = 1 if $journal_part == 2;
+               $partitions->{$part}->{wal} = 1 if $journal_part == 3;
+               $partitions->{$part}->{bluestore} = 1 if $journal_part == 4;
            }
        });