public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Aaron Lauterer <a.lauterer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager] ui: osd: warn if removal could be problematic
Date: Fri,  4 Feb 2022 10:50:06 +0100	[thread overview]
Message-ID: <20220204095006.127477-1-a.lauterer@proxmox.com> (raw)

If an OSD is removed during the wrong conditions, it could lead to
blocked IO or worst case data loss.

Check against global flags that limit the capabilities of Ceph to heal
itself (norebalance, norecover, noout) and if there are degraded
objects.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
---

Those are the things to check for that came to mind. If someone thinks
that we should definitely check for more, I am happy to send a v2.

I am also open to suggestions on how to phrase the warnings better.

I opted for separate hints to be able to show detailed hints so the
users have an idea how to act on the warning and to keep the logic
behind them simple.

 www/manager6/ceph/OSD.js | 41 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/www/manager6/ceph/OSD.js b/www/manager6/ceph/OSD.js
index e126f8d0..7ab11b9e 100644
--- a/www/manager6/ceph/OSD.js
+++ b/www/manager6/ceph/OSD.js
@@ -178,6 +178,20 @@ Ext.define('PVE.CephRemoveOsd', {
 	    labelWidth: 130,
 	    fieldLabel: gettext('Cleanup Disks'),
 	},
+	{
+	    xtype: 'displayfield',
+	    name: 'osd-flag-hint',
+	    userCls: 'pmx-hint',
+	    value: gettext('Global flags that limit the self healing of Ceph are enabled.'),
+	    hidden: true,
+	},
+	{
+	    xtype: 'displayfield',
+	    name: 'degraded-objects-hint',
+	    userCls: 'pmx-hint',
+	    value: gettext('Objects are degraded. Consider waiting until the cluster is healthy.'),
+	    hidden: true,
+	},
     ],
     initComponent: function() {
         let me = this;
@@ -193,6 +207,33 @@ Ext.define('PVE.CephRemoveOsd', {
 
 	me.title = gettext('Destroy') + ': Ceph OSD osd.' + me.osdid.toString();
 
+	Proxmox.Utils.API2Request({
+	    url: `/cluster/ceph/flags`,
+	    method: 'GET',
+	    failure: response => Ext.Msg.alert(gettext('Error'), response.htmlStatus),
+	    success: function({ result: { data } }) {
+		let flags = Array.from(
+		    data.filter(v => v.value),
+		    v => v.name,
+		).filter(v => ['norebalance', 'norecover', 'noout'].includes(v));
+
+		if (flags.length) {
+		    me.down('field[name=osd-flag-hint]').setHidden(false);
+		}
+	    },
+	});
+
+	Proxmox.Utils.API2Request({
+	    url: `/cluster/ceph/status`,
+	    method: 'GET',
+	    failure: response => Ext.Msg.alert(gettext('Error'), response.htmlStatus),
+	    success: function({ result: { data } }) {
+		if (Object.keys(data.pgmap).includes('degraded_objects')) {
+		    me.down('field[name=degraded-objects-hint]').setHidden(false);
+		}
+	    },
+	});
+
         Ext.applyIf(me, {
 	    url: "/nodes/" + me.nodename + "/ceph/osd/" + me.osdid.toString(),
         });
-- 
2.30.2





             reply	other threads:[~2022-02-04  9:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-04  9:50 Aaron Lauterer [this message]
2022-02-04 16:42 ` 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=20220204095006.127477-1-a.lauterer@proxmox.com \
    --to=a.lauterer@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 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