mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-07-17 11:46:49 +00:00
ui: osd: mon: mds: warn if stop/destroy actions are problematic
Check if stopping of a service (OSD, MON, MDS) will be problematic for Ceph. The warning still allows the user to proceed. Ceph also has a check if the destruction of a MON is okay, so let's use it. Instead of the common OK button, label it with `Stop OSD` and so forth to hopefully reduce the "click OK by habit" incidents. This will not catch it every time as Ceph can need a few moments after a change to establish its current status. For example, stopping one of 3 MONs and then right away destroying one of the last two running MONs will most likely not trigger the warning. Doing so after a few seconds should show the warning though. Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
This commit is contained in:
parent
d9415cc4f7
commit
6242a6009d
@ -527,23 +527,60 @@ Ext.define('PVE.node.CephOsdTree', {
|
|||||||
let me = this;
|
let me = this;
|
||||||
let vm = this.getViewModel();
|
let vm = this.getViewModel();
|
||||||
let cmd = comp.cmd || comp;
|
let cmd = comp.cmd || comp;
|
||||||
Proxmox.Utils.API2Request({
|
|
||||||
url: "/nodes/" + vm.get('osdhost') + "/ceph/" + cmd,
|
let doRequest = function() {
|
||||||
params: { service: "osd." + vm.get('osdid') },
|
Proxmox.Utils.API2Request({
|
||||||
waitMsgTarget: me.getView(),
|
url: `/nodes/${vm.get('osdhost')}/ceph/${cmd}`,
|
||||||
method: 'POST',
|
params: { service: "osd." + vm.get('osdid') },
|
||||||
success: function(response, options) {
|
waitMsgTarget: me.getView(),
|
||||||
let upid = response.result.data;
|
method: 'POST',
|
||||||
let win = Ext.create('Proxmox.window.TaskProgress', {
|
success: function(response, options) {
|
||||||
upid: upid,
|
let upid = response.result.data;
|
||||||
taskDone: () => { me.reload(); },
|
let win = Ext.create('Proxmox.window.TaskProgress', {
|
||||||
});
|
upid: upid,
|
||||||
win.show();
|
taskDone: () => { me.reload(); },
|
||||||
},
|
});
|
||||||
failure: function(response, opts) {
|
win.show();
|
||||||
Ext.Msg.alert(gettext('Error'), response.htmlStatus);
|
},
|
||||||
},
|
failure: function(response, opts) {
|
||||||
});
|
Ext.Msg.alert(gettext('Error'), response.htmlStatus);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
if (cmd === "stop") {
|
||||||
|
Proxmox.Utils.API2Request({
|
||||||
|
url: `/nodes/${vm.get('osdhost')}/ceph/cmd-safety`,
|
||||||
|
params: {
|
||||||
|
service: 'osd',
|
||||||
|
id: vm.get('osdid'),
|
||||||
|
action: 'stop',
|
||||||
|
},
|
||||||
|
waitMsgTarget: me.getView(),
|
||||||
|
method: 'GET',
|
||||||
|
success: function({ result: { data } }) {
|
||||||
|
if (!data.safe) {
|
||||||
|
Ext.Msg.show({
|
||||||
|
title: gettext('Warning'),
|
||||||
|
message: data.status,
|
||||||
|
icon: Ext.Msg.WARNING,
|
||||||
|
buttons: Ext.Msg.OKCANCEL,
|
||||||
|
buttonText: { ok: gettext('Stop OSD') },
|
||||||
|
fn: function(selection) {
|
||||||
|
if (selection === 'ok') {
|
||||||
|
doRequest();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
doRequest();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
failure: response => Ext.Msg.alert(gettext('Error'), response.htmlStatus),
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
doRequest();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
set_selection_status: function(tp, selection) {
|
set_selection_status: function(tp, selection) {
|
||||||
|
@ -148,19 +148,57 @@ Ext.define('PVE.node.CephServiceController', {
|
|||||||
Ext.Msg.alert(gettext('Error'), "entry has no host");
|
Ext.Msg.alert(gettext('Error'), "entry has no host");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Proxmox.Utils.API2Request({
|
let doRequest = function() {
|
||||||
url: `/nodes/${rec.data.host}/ceph/${cmd}`,
|
Proxmox.Utils.API2Request({
|
||||||
method: 'POST',
|
url: `/nodes/${rec.data.host}/ceph/${cmd}`,
|
||||||
params: { service: view.type + '.' + rec.data.name },
|
method: 'POST',
|
||||||
success: function(response, options) {
|
params: { service: view.type + '.' + rec.data.name },
|
||||||
Ext.create('Proxmox.window.TaskProgress', {
|
success: function(response, options) {
|
||||||
autoShow: true,
|
Ext.create('Proxmox.window.TaskProgress', {
|
||||||
upid: response.result.data,
|
autoShow: true,
|
||||||
taskDone: () => view.rstore.load(),
|
upid: response.result.data,
|
||||||
});
|
taskDone: () => view.rstore.load(),
|
||||||
},
|
});
|
||||||
failure: (response, _opts) => Ext.Msg.alert(gettext('Error'), response.htmlStatus),
|
},
|
||||||
});
|
failure: (response, _opts) => Ext.Msg.alert(gettext('Error'), response.htmlStatus),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
if (cmd === "stop" && ['mon', 'mds'].includes(view.type)) {
|
||||||
|
Proxmox.Utils.API2Request({
|
||||||
|
url: `/nodes/${rec.data.host}/ceph/cmd-safety`,
|
||||||
|
params: {
|
||||||
|
service: view.type,
|
||||||
|
id: rec.data.name,
|
||||||
|
action: 'stop',
|
||||||
|
},
|
||||||
|
method: 'GET',
|
||||||
|
success: function({ result: { data } }) {
|
||||||
|
let stopText = {
|
||||||
|
mon: gettext('Stop MON'),
|
||||||
|
mds: gettext('Stop MDS'),
|
||||||
|
};
|
||||||
|
if (!data.safe) {
|
||||||
|
Ext.Msg.show({
|
||||||
|
title: gettext('Warning'),
|
||||||
|
message: data.status,
|
||||||
|
icon: Ext.Msg.WARNING,
|
||||||
|
buttons: Ext.Msg.OKCANCEL,
|
||||||
|
buttonText: { ok: stopText[view.type] },
|
||||||
|
fn: function(selection) {
|
||||||
|
if (selection === 'ok') {
|
||||||
|
doRequest();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
doRequest();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
failure: (response, _opts) => Ext.Msg.alert(gettext('Error'), response.htmlStatus),
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
doRequest();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onChangeService: function(button) {
|
onChangeService: function(button) {
|
||||||
let me = this;
|
let me = this;
|
||||||
@ -273,6 +311,46 @@ Ext.define('PVE.node.CephServiceList', {
|
|||||||
taskDone: () => view.rstore.load(),
|
taskDone: () => view.rstore.load(),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
handler: function(btn, event, rec) {
|
||||||
|
let me = this;
|
||||||
|
let view = me.up('grid');
|
||||||
|
let doRequest = function() {
|
||||||
|
Proxmox.button.StdRemoveButton.prototype.handler.call(me, btn, event, rec);
|
||||||
|
};
|
||||||
|
if (view.type === 'mon') {
|
||||||
|
Proxmox.Utils.API2Request({
|
||||||
|
url: `/nodes/${rec.data.host}/ceph/cmd-safety`,
|
||||||
|
params: {
|
||||||
|
service: view.type,
|
||||||
|
id: rec.data.name,
|
||||||
|
action: 'destroy',
|
||||||
|
},
|
||||||
|
method: 'GET',
|
||||||
|
success: function({ result: { data } }) {
|
||||||
|
if (!data.safe) {
|
||||||
|
Ext.Msg.show({
|
||||||
|
title: gettext('Warning'),
|
||||||
|
message: data.status,
|
||||||
|
icon: Ext.Msg.WARNING,
|
||||||
|
buttons: Ext.Msg.OKCANCEL,
|
||||||
|
buttonText: { ok: gettext('Destroy MON') },
|
||||||
|
fn: function(selection) {
|
||||||
|
if (selection === 'ok') {
|
||||||
|
doRequest();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
doRequest();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
failure: (response, _opts) => Ext.Msg.alert(gettext('Error'), response.htmlStatus),
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
doRequest();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
'-',
|
'-',
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user