Diskmanage: save OSD information for individual partitions

in preparation to including partitions for get_disks()

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fabian Ebner
2021-01-26 12:45:26 +01:00
committed by Thomas Lamprecht
parent 41f93eceb2
commit 6a1919b137

View File

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