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.laute...@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



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

Reply via email to