all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager] fix #5293: ceph status: fix division-by-zero when calculating usage
Date: Tue, 12 Mar 2024 10:13:46 +0100	[thread overview]
Message-ID: <20240312091410.72956-1-c.heiss@proxmox.com> (raw)

Fixes #5293 [0]. This happens when no OSDs are created yet and thus the
total space is 0, which leads to a division-by-zero.

Add a simple check if the total space is greater than 0.

[0] https://bugzilla.proxmox.com/show_bug.cgi?id=5293

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
 www/manager6/ceph/Status.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/www/manager6/ceph/Status.js b/www/manager6/ceph/Status.js
index 32be91ac7..72b3c990d 100644
--- a/www/manager6/ceph/Status.js
+++ b/www/manager6/ceph/Status.js
@@ -346,7 +346,8 @@ Ext.define('PVE.node.CephStatus', {
 	);
 
 	// update the usage widget
-	me.down('#space').updateValue(used/total, text);
+	const usage = total > 0 ? used / total : 0;
+	me.down('#space').updateValue(usage, text);
 
 	let readiops = pgmap.read_op_per_sec;
 	let writeiops = pgmap.write_op_per_sec;
-- 
2.43.1





             reply	other threads:[~2024-03-12  9:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-12  9:13 Christoph Heiss [this message]
2024-03-19 17:18 ` [pve-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240312091410.72956-1-c.heiss@proxmox.com \
    --to=c.heiss@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal