]> git.proxmox.com Git - pve-cluster.git/commitdiff
pvecm updatecerts: time out after 30 seconds
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 2 Jul 2018 14:29:40 +0000 (16:29 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 3 Jul 2018 11:52:16 +0000 (13:52 +0200)
We call this in pve-cluster.service as ExecStartPost. We prefix it
with '-' to tell systemd that it should ignore non-zero exit codes,
but if the command hangs (e.g., on IO) systemd kills it after a
timeout (90 seconds default) which then doesn't get ignored and the
unit will also be put in failure state and stopped.
We specifically do not want this to happen, so wrap the updatecerts
call in run_with_timeout and give it a maximum of 30 seconds to
finish.

Reviewed-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
data/PVE/CLI/pvecm.pm

index 3f0ac128c22888801c947bf494edfd71eb33086c..4a6e3731613eb17ce02d3a840ae51220cdb464be 100755 (executable)
@@ -290,7 +290,9 @@ __PACKAGE__->register_method ({
     code => sub {
        my ($param) = @_;
 
-       PVE::Cluster::updatecerts_and_ssh($param->@{qw(force silent)});
+       PVE::Tools::run_with_timeout(30, sub {
+           PVE::Cluster::updatecerts_and_ssh($param->@{qw(force silent)});
+       });
 
        return undef;
     }});