From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <pve-devel-bounces@lists.proxmox.com> Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 65B811FF17C for <inbox@lore.proxmox.com>; Wed, 14 May 2025 11:36:43 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 2A8E2253F; Wed, 14 May 2025 11:37:04 +0200 (CEST) From: Fiona Ebner <f.ebner@proxmox.com> To: pve-devel@lists.proxmox.com Date: Wed, 14 May 2025 11:36:58 +0200 Message-Id: <20250514093658.21308-2-f.ebner@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250514093658.21308-1-f.ebner@proxmox.com> References: <20250514093658.21308-1-f.ebner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.036 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. 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 v2 storage 2/2] rbd plugin: status: use actual storage usage as basis for calculation X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com> List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe> List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/> List-Post: <mailto:pve-devel@lists.proxmox.com> List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help> List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe> Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com> As reported in the enterprise support, the usage percentage presented by Proxmox VE can be quite different from what Ceph itself shows when compression is used on the pool. The reason is that Proxmox VE used the 'stored' value as a basis for the calculation which is the amount of logically stored user data, i.e. before compression. In the context of presenting storage usage, this is not the best choice and e.g. in the ZFS plugin 'used' is preferred over 'logicalused'. Switch to using 'bytes_used' as the basis for the calculation to better match expectations. Signed-off-by: Fiona Ebner <f.ebner@proxmox.com> --- New approach in v2, use actual storage usage as the basis for calculation. src/PVE/Storage/RBDPlugin.pm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/PVE/Storage/RBDPlugin.pm b/src/PVE/Storage/RBDPlugin.pm index 154fa00..8bb5a26 100644 --- a/src/PVE/Storage/RBDPlugin.pm +++ b/src/PVE/Storage/RBDPlugin.pm @@ -690,7 +690,7 @@ sub status { my ($class, $storeid, $scfg, $cache) = @_; my $rados = $librados_connect->($scfg, $storeid); - my $df = $rados->mon_command({ prefix => 'df', format => 'json' }); + my $df = $rados->mon_command({ prefix => 'df', detail => 'detail', format => 'json'}); my $pool = $scfg->{'data-pool'} // $scfg->{pool} // 'rbd'; @@ -701,10 +701,16 @@ sub status { return; } - # max_avail -> max available space for data w/o replication in the pool - # stored -> amount of user data w/o replication in the pool + # max_avail -> max available space for data with replication factored out + # avail_raw -> max available space for data before factoring out replication + # bytes_used -> actual used space before factoring out replication + # Note: the values with replication factored out are more interesting from a user perspective, + # so need to calculate actual usage with replication factored out. + + my $replication = ($d->{stats}->{avail_raw} / $d->{stats}->{max_avail}); + my $free = $d->{stats}->{max_avail}; - my $used = $d->{stats}->{stored}; + my $used = $d->{stats}->{bytes_used} / $replication; my $total = $used + $free; my $active = 1; -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel