From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 05C966B396 for ; Tue, 26 Jan 2021 12:45:42 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4BD8615A97 for ; Tue, 26 Jan 2021 12:45:40 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 4CF3A15982 for ; Tue, 26 Jan 2021 12:45:36 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 15A6D4610E for ; Tue, 26 Jan 2021 12:45:36 +0100 (CET) From: Fabian Ebner To: pve-devel@lists.proxmox.com Date: Tue, 26 Jan 2021 12:45:26 +0100 Message-Id: <20210126114530.8753-11-f.ebner@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210126114530.8753-1-f.ebner@proxmox.com> References: <20210126114530.8753-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.006 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [diskmanage.pm] Subject: [pve-devel] [PATCH storage 10/14] Diskmanage: save OSD information for individual partitions X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jan 2021 11:45:42 -0000 in preparation to including partitions for get_disks() Signed-off-by: Fabian Ebner --- PVE/Diskmanage.pm | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/PVE/Diskmanage.pm b/PVE/Diskmanage.pm index ee04419..195b706 100644 --- a/PVE/Diskmanage.pm +++ b/PVE/Diskmanage.pm @@ -651,7 +651,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 = {}; @@ -659,14 +663,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) @@ -677,6 +683,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; } } @@ -685,6 +692,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; } }); -- 2.20.1