Discussion:
[pve-devel] [PATCH manager 0/3] ceph gui: add restart buttons
Dominik Csapak
2018-11-23 10:46:42 UTC
Permalink
to make maintenance easier, add restart buttons for monitors and osds

this series is written with thomas cephfs/mds patches applied,
but i think they should apply cleanly nonetheless on master

Dominik Csapak (3):
ceph: add service restart api call
gui: add osd restart button
gui: add ceph monitor restart button

PVE/API2/Ceph.pm | 50 ++++++++++++++++++++++++++++++++++++++++++++
www/manager6/ceph/Monitor.js | 11 +++++++++-
www/manager6/ceph/OSD.js | 10 ++++++++-
3 files changed, 69 insertions(+), 2 deletions(-)
--
2.11.0
Dominik Csapak
2018-11-23 10:46:45 UTC
Permalink
Signed-off-by: Dominik Csapak <***@proxmox.com>
---
www/manager6/ceph/Monitor.js | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/www/manager6/ceph/Monitor.js b/www/manager6/ceph/Monitor.js
index 8093ed0a..a3a18a83 100644
--- a/www/manager6/ceph/Monitor.js
+++ b/www/manager6/ceph/Monitor.js
@@ -123,6 +123,15 @@ Ext.define('PVE.node.CephMonList', {
}
});

+ var restart_btn = new Proxmox.button.Button({
+ text: gettext('Restart'),
+ selModel: sm,
+ disabled: true,
+ handler: function(){
+ service_cmd("restart");
+ }
+ });
+
var create_btn = new Ext.Button({
text: gettext('Create'),
handler: function(){
@@ -164,7 +173,7 @@ Ext.define('PVE.node.CephMonList', {
Ext.apply(me, {
store: store,
selModel: sm,
- tbar: [ start_btn, stop_btn, create_btn, remove_btn ],
+ tbar: [ start_btn, stop_btn, restart_btn, '-', create_btn, remove_btn ],
columns: [
{
header: gettext('Name'),
--
2.11.0
Dominik Csapak
2018-11-23 10:46:43 UTC
Permalink
like start/stop but for restart, this makes maintenance a bit easier

Signed-off-by: Dominik Csapak <***@proxmox.com>
---
PVE/API2/Ceph.pm | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)

diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index 0fc95ab0..374d83b4 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -1448,6 +1448,56 @@ __PACKAGE__->register_method ({
}});

__PACKAGE__->register_method ({
+ name => 'restart',
+ path => 'restart',
+ method => 'POST',
+ description => "Restart ceph services.",
+ proxyto => 'node',
+ protected => 1,
+ permissions => {
+ check => ['perm', '/', [ 'Sys.Modify' ]],
+ },
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ node => get_standard_option('pve-node'),
+ service => {
+ description => 'Ceph service name.',
+ type => 'string',
+ optional => 1,
+ pattern => '(mon|mds|osd|mgr)\.[A-Za-z0-9\-]{1,32}',
+ },
+ },
+ },
+ returns => { type => 'string' },
+ code => sub {
+ my ($param) = @_;
+
+ my $rpcenv = PVE::RPCEnvironment::get();
+
+ my $authuser = $rpcenv->get_user();
+
+ PVE::CephTools::check_ceph_inited();
+
+ my $cfg = PVE::CephTools::parse_ceph_config();
+ scalar(keys %$cfg) || die "no configuration\n";
+
+ my $worker = sub {
+ my $upid = shift;
+
+ my $cmd = ['restart'];
+ if ($param->{service}) {
+ push @$cmd, $param->{service};
+ }
+
+ PVE::CephTools::ceph_service_cmd(@$cmd);
+ };
+
+ return $rpcenv->fork_worker('srvrestart', $param->{service} || 'ceph',
+ $authuser, $worker);
+ }});
+
+__PACKAGE__->register_method ({
name => 'status',
path => 'status',
method => 'GET',
--
2.11.0
Dominik Csapak
2018-11-23 10:46:44 UTC
Permalink
Signed-off-by: Dominik Csapak <***@proxmox.com>
---
www/manager6/ceph/OSD.js | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/www/manager6/ceph/OSD.js b/www/manager6/ceph/OSD.js
index 8fe7e794..144fab7e 100644
--- a/www/manager6/ceph/OSD.js
+++ b/www/manager6/ceph/OSD.js
@@ -363,6 +363,12 @@ Ext.define('PVE.node.CephOsdTree', {
handler: function(){ service_cmd('stop'); }
});

+ var restart_btn = new Ext.Button({
+ text: gettext('Restart'),
+ disabled: true,
+ handler: function(){ service_cmd('restart'); }
+ });
+
var osd_out_btn = new Ext.Button({
text: 'Out',
disabled: true,
@@ -428,6 +434,7 @@ Ext.define('PVE.node.CephOsdTree', {
if (!rec) {
start_btn.setDisabled(true);
stop_btn.setDisabled(true);
+ restart_btn.setDisabled(true);
remove_btn.setDisabled(true);
osd_out_btn.setDisabled(true);
osd_in_btn.setDisabled(true);
@@ -438,6 +445,7 @@ Ext.define('PVE.node.CephOsdTree', {

start_btn.setDisabled(!(isOsd && (rec.data.status !== 'up')));
stop_btn.setDisabled(!(isOsd && (rec.data.status !== 'down')));
+ restart_btn.setDisabled(!(isOsd && (rec.data.status !== 'down')));
remove_btn.setDisabled(!(isOsd && (rec.data.status === 'down')));

osd_out_btn.setDisabled(!(isOsd && rec.data['in']));
@@ -454,7 +462,7 @@ Ext.define('PVE.node.CephOsdTree', {
});

Ext.apply(me, {
- tbar: [ create_btn, reload_btn, noout_btn, '->', osd_label, start_btn, stop_btn, osd_out_btn, osd_in_btn, remove_btn ],
+ tbar: [ create_btn, reload_btn, noout_btn, '->', osd_label, start_btn, stop_btn, restart_btn, osd_out_btn, osd_in_btn, remove_btn ],
rootVisible: false,
useArrows: true,
fields: ['name', 'type', 'status', 'host', 'in', 'id' ,
--
2.11.0
Thomas Lamprecht
2018-11-23 11:42:04 UTC
Permalink
Post by Dominik Csapak
to make maintenance easier, add restart buttons for monitors and osds
this series is written with thomas cephfs/mds patches applied,
but i think they should apply cleanly nonetheless on master
ceph: add service restart api call
gui: add osd restart button
gui: add ceph monitor restart button
PVE/API2/Ceph.pm | 50 ++++++++++++++++++++++++++++++++++++++++++++
www/manager6/ceph/Monitor.js | 11 +++++++++-
www/manager6/ceph/OSD.js | 10 ++++++++-
3 files changed, 69 insertions(+), 2 deletions(-)
applied, thanks! Added a followup documenting what the defaults for the service
param actually is.

Loading...