From 1b4f4eb02b9ad8bcdf1229a3fc71190bc799c365 Mon Sep 17 00:00:00 2001 From: David Lee Date: Tue, 23 May 2017 13:34:20 +0800 Subject: [PATCH] Add timeout for 'ceph health' command Signed-off-by: David Lee --- kvmagent/kvmagent/plugins/ha_plugin.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kvmagent/kvmagent/plugins/ha_plugin.py b/kvmagent/kvmagent/plugins/ha_plugin.py index a8cbea4cae..8480c13972 100755 --- a/kvmagent/kvmagent/plugins/ha_plugin.py +++ b/kvmagent/kvmagent/plugins/ha_plugin.py @@ -117,7 +117,12 @@ def setup_ceph_self_fencer(self, req): self.run_ceph_fencer = True def ceph_in_error_stat(): - healthStatus = shell.call('ceph health') + healthStatus = shell.ShellCmd('timeout %s ceph health' % cmd.storageCheckerTimeout) + healthStatus(False) + + if healthStatus.return_code != 0: + return True + return healthStatus.startswith('HEALTH_ERR') def heartbeat_file_exists():