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 450EE78059 for ; Mon, 25 Oct 2021 16:02:13 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 12CC823F44 for ; Mon, 25 Oct 2021 16:01:43 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (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 1DE7223EE0 for ; Mon, 25 Oct 2021 16:01:41 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id A5BEF45F94 for ; Mon, 25 Oct 2021 16:01:40 +0200 (CEST) From: Dominik Csapak To: pve-devel@lists.proxmox.com Date: Mon, 25 Oct 2021 16:01:28 +0200 Message-Id: <20211025140139.2015470-3-d.csapak@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211025140139.2015470-1-d.csapak@proxmox.com> References: <20211025140139.2015470-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.277 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH manager v2 01/11] api: ceph-mds: get mds state when multple ceph filesystems exist 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: Mon, 25 Oct 2021 14:02:13 -0000 by iterating over all of them and saving the name to the active ones this fixes the issue that an mds that is assigned to not the first fs in the list gets wrongly shown as offline Signed-off-by: Dominik Csapak --- PVE/Ceph/Services.pm | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/PVE/Ceph/Services.pm b/PVE/Ceph/Services.pm index ad41dbe4..e8cc23dc 100644 --- a/PVE/Ceph/Services.pm +++ b/PVE/Ceph/Services.pm @@ -181,13 +181,14 @@ sub get_cluster_mds_state { } my $add_state = sub { - my ($mds) = @_; + my ($mds, $fsname) = @_; my $state = {}; $state->{addr} = $mds->{addr}; $state->{rank} = $mds->{rank}; $state->{standby_replay} = $mds->{standby_replay} ? 1 : 0; $state->{state} = $mds->{state}; + $state->{fs_name} = $fsname; $mds_state->{$mds->{name}} = $state; }; @@ -200,13 +201,14 @@ sub get_cluster_mds_state { $add_state->($mds); } - my $fs_info = $fsmap->{filesystems}->[0]; - my $active_mds = $fs_info->{mdsmap}->{info}; + for my $fs_info (@{$fsmap->{filesystems}}) { + my $active_mds = $fs_info->{mdsmap}->{info}; - # normally there's only one active MDS, but we can have multiple active for - # different ranks (e.g., different cephs path hierarchy). So just add all. - foreach my $mds (values %$active_mds) { - $add_state->($mds); + # normally there's only one active MDS, but we can have multiple active for + # different ranks (e.g., different cephs path hierarchy). So just add all. + foreach my $mds (values %$active_mds) { + $add_state->($mds, $fs_info->{mdsmap}->{fs_name}); + } } return $mds_state; -- 2.30.2