public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH v2 storage 1/2] rbd plugin: status: drop outdated fallback
@ 2025-05-14  9:36 Fiona Ebner
  2025-05-14  9:36 ` [pve-devel] [PATCH v2 storage 2/2] rbd plugin: status: use actual storage usage as basis for calculation Fiona Ebner
  0 siblings, 1 reply; 3+ messages in thread
From: Fiona Ebner @ 2025-05-14  9:36 UTC (permalink / raw)
  To: pve-devel

As commit e79ab52 ("Fix #2346: rbd storage shows wrong %-usage")
mentions, Ceph provides a 'stored' field since version 14.2.2 as an
approximation of the actually stored amount of user data. The commit
forgot to update the accompanying comment however.

The 'bytes_used' field refers to the raw usage without factoring out
replication (default: 3). The 'max_avail' value is after factoring out
replication, so using 'bytes_used' in the same calculation would lead
to very confusing results.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---

No changes in v2.

 src/PVE/Storage/RBDPlugin.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/Storage/RBDPlugin.pm b/src/PVE/Storage/RBDPlugin.pm
index 73bc97e..154fa00 100644
--- a/src/PVE/Storage/RBDPlugin.pm
+++ b/src/PVE/Storage/RBDPlugin.pm
@@ -702,9 +702,9 @@ sub status {
     }
 
     # max_avail -> max available space for data w/o replication in the pool
-    # bytes_used -> data w/o replication in the pool
+    # stored -> amount of user data w/o replication in the pool
     my $free = $d->{stats}->{max_avail};
-    my $used = $d->{stats}->{stored} // $d->{stats}->{bytes_used};
+    my $used = $d->{stats}->{stored};
     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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] [PATCH v2 storage 2/2] rbd plugin: status: use actual storage usage as basis for calculation
  2025-05-14  9:36 [pve-devel] [PATCH v2 storage 1/2] rbd plugin: status: drop outdated fallback Fiona Ebner
@ 2025-05-14  9:36 ` Fiona Ebner
  2025-05-22 14:32   ` Fiona Ebner
  0 siblings, 1 reply; 3+ messages in thread
From: Fiona Ebner @ 2025-05-14  9:36 UTC (permalink / raw)
  To: pve-devel

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pve-devel] [PATCH v2 storage 2/2] rbd plugin: status: use actual storage usage as basis for calculation
  2025-05-14  9:36 ` [pve-devel] [PATCH v2 storage 2/2] rbd plugin: status: use actual storage usage as basis for calculation Fiona Ebner
@ 2025-05-22 14:32   ` Fiona Ebner
  0 siblings, 0 replies; 3+ messages in thread
From: Fiona Ebner @ 2025-05-22 14:32 UTC (permalink / raw)
  To: pve-devel

Am 14.05.25 um 11:36 schrieb Fiona Ebner:
> 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.

Referencing this reply to v1 here so it doesn't get overlooked:
https://lore.proxmox.com/pve-devel/525845252.15003.1747220844735@webmail.proxmox.com/


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-05-22 14:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-14  9:36 [pve-devel] [PATCH v2 storage 1/2] rbd plugin: status: drop outdated fallback Fiona Ebner
2025-05-14  9:36 ` [pve-devel] [PATCH v2 storage 2/2] rbd plugin: status: use actual storage usage as basis for calculation Fiona Ebner
2025-05-22 14:32   ` Fiona Ebner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal