* [pve-devel] applied: [PATCH manager 1/3] api/services: improve essential service check, allow reload and start
@ 2020-07-24 13:25 Thomas Lamprecht
2020-07-24 13:25 ` [pve-devel] applied: [PATCH manager 2/3] api/services: fallback to restart in reload Thomas Lamprecht
2020-07-24 13:25 ` [pve-devel] applied: [PATCH manager 3/3] ui: node/services: use safer reload as restart command Thomas Lamprecht
0 siblings, 2 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2020-07-24 13:25 UTC (permalink / raw)
To: pve-devel
reload is actually preferred, and even if most of the time this even
won't reach the API, allowing to start them is still definitively
fine!
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
PVE/API2/Services.pm | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/PVE/API2/Services.pm b/PVE/API2/Services.pm
index a504dcd5..e5b3c3da 100644
--- a/PVE/API2/Services.pm
+++ b/PVE/API2/Services.pm
@@ -34,6 +34,11 @@ my $service_name_list = [
'ksmtuned',
'systemd-timesyncd',
];
+my $essential_services = {
+ pveproxy => 1,
+ pvedaemon => 1,
+ 'pve-cluster' => 1,
+};
# since postfix package 3.1.0-3.1 the postfix unit is only here to
# manage subinstances, of which the default is called "-".
@@ -92,17 +97,12 @@ my $service_cmd = sub {
my $initd_cmd;
- die "unknown service command '$cmd'\n"
- if $cmd !~ m/^(start|stop|restart|reload)$/;
+ die "unknown service command '$cmd'\n" if $cmd !~ m/^(start|stop|restart|reload|try-reload-or-restart)$/;
- if ($service eq 'pvecluster' || $service eq 'pvedaemon' || $service eq 'pveproxy') {
- if ($cmd eq 'restart') {
- # OK
- } else {
- die "invalid service cmd '$service $cmd': ERROR";
- }
+ if ($essential_services->{$service} && $cmd eq 'stop') {
+ die "invalid service cmd '$service $cmd': refusing to stop essential service!\n";
}
-
+
PVE::Tools::run_command(['systemctl', $cmd, $service]);
};
--
2.20.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pve-devel] applied: [PATCH manager 2/3] api/services: fallback to restart in reload
2020-07-24 13:25 [pve-devel] applied: [PATCH manager 1/3] api/services: improve essential service check, allow reload and start Thomas Lamprecht
@ 2020-07-24 13:25 ` Thomas Lamprecht
2020-07-24 13:25 ` [pve-devel] applied: [PATCH manager 3/3] ui: node/services: use safer reload as restart command Thomas Lamprecht
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2020-07-24 13:25 UTC (permalink / raw)
To: pve-devel
And document that it is preferred
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
PVE/API2/Services.pm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/PVE/API2/Services.pm b/PVE/API2/Services.pm
index e5b3c3da..df9606f4 100644
--- a/PVE/API2/Services.pm
+++ b/PVE/API2/Services.pm
@@ -319,7 +319,7 @@ __PACKAGE__->register_method ({
name => 'service_restart',
path => '{service}/restart',
method => 'POST',
- description => "Restart service.",
+ description => "Hard restart service. Use reload if you want to reduce interruptions.",
permissions => {
check => ['perm', '/nodes/{node}', [ 'Sys.Modify' ]],
},
@@ -355,7 +355,7 @@ __PACKAGE__->register_method ({
name => 'service_reload',
path => '{service}/reload',
method => 'POST',
- description => "Reload service.",
+ description => "Reload service. Falls back to restart if service cannot be reloaded.",
permissions => {
check => ['perm', '/nodes/{node}', [ 'Sys.Modify' ]],
},
@@ -381,7 +381,7 @@ __PACKAGE__->register_method ({
my $upid = shift;
syslog('info', "reloading service $param->{service}: $upid\n");
- $service_cmd->($param->{service}, 'reload');
+ $service_cmd->($param->{service}, 'try-reload-or-restart');
};
--
2.20.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pve-devel] applied: [PATCH manager 3/3] ui: node/services: use safer reload as restart command
2020-07-24 13:25 [pve-devel] applied: [PATCH manager 1/3] api/services: improve essential service check, allow reload and start Thomas Lamprecht
2020-07-24 13:25 ` [pve-devel] applied: [PATCH manager 2/3] api/services: fallback to restart in reload Thomas Lamprecht
@ 2020-07-24 13:25 ` Thomas Lamprecht
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2020-07-24 13:25 UTC (permalink / raw)
To: pve-devel
avoids service interruptions
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
www/manager6/node/Config.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/www/manager6/node/Config.js b/www/manager6/node/Config.js
index be09615f..ef3ac32c 100644
--- a/www/manager6/node/Config.js
+++ b/www/manager6/node/Config.js
@@ -159,6 +159,7 @@ Ext.define('PVE.node.Config', {
iconCls: 'fa fa-cogs',
itemId: 'services',
expandedOnInit: true,
+ restartCommand: 'reload', // avoid disruptions
startOnlyServices: {
'pveproxy': true,
'pvedaemon': true,
--
2.20.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-24 13:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-24 13:25 [pve-devel] applied: [PATCH manager 1/3] api/services: improve essential service check, allow reload and start Thomas Lamprecht
2020-07-24 13:25 ` [pve-devel] applied: [PATCH manager 2/3] api/services: fallback to restart in reload Thomas Lamprecht
2020-07-24 13:25 ` [pve-devel] applied: [PATCH manager 3/3] ui: node/services: use safer reload as restart command Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox