From 8eeba9bc9b8da445aab56bcc593d70afc0dc4f33 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Tue, 9 Jul 2019 14:35:53 -0400 Subject: [PATCH] Make Ceph commands time out if needed --- node-daemon/pvcd/Daemon.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/node-daemon/pvcd/Daemon.py b/node-daemon/pvcd/Daemon.py index 0f2add40..cd3e85cc 100644 --- a/node-daemon/pvcd/Daemon.py +++ b/node-daemon/pvcd/Daemon.py @@ -898,7 +898,7 @@ def update_zookeeper(): # Get Ceph cluster health (for local printing) if debug: print("Get Ceph cluster health (for local printing)") - retcode, stdout, stderr = common.run_os_command('ceph health') + retcode, stdout, stderr = common.run_os_command('ceph --connect-timeout=1 health') ceph_health = stdout.rstrip() if 'HEALTH_OK' in ceph_health: ceph_health_colour = logger.fmt_green @@ -912,7 +912,7 @@ def update_zookeeper(): if debug: print("Set ceph health information in zookeeper (primary only)") # Get status info - retcode, stdout, stderr = common.run_os_command('ceph status') + retcode, stdout, stderr = common.run_os_command('ceph --connect-timeout=1 status') ceph_status = stdout try: zkhandler.writedata(zk_conn, { @@ -977,7 +977,7 @@ def update_zookeeper(): print("Get data from Ceph OSDs") # Parse the dump data osd_dump = dict() - retcode, stdout, stderr = common.run_os_command('ceph osd dump --format json') + retcode, stdout, stderr = common.run_os_command('ceph --connect-timeout=1 osd dump --format json') osd_dump_raw = json.loads(stdout)['osds'] if debug: print("Loop through OSD dump") @@ -995,7 +995,7 @@ def update_zookeeper(): if debug: print("Parse the OSD df data") osd_df = dict() - retcode, stdout, stderr = common.run_os_command('ceph osd df --format json') + retcode, stdout, stderr = common.run_os_command('ceph --connect-timeout=1 osd df --format json') try: osd_df_raw = json.loads(stdout)['nodes'] except: @@ -1018,7 +1018,7 @@ def update_zookeeper(): if debug: print("Parse the OSD status data") osd_status = dict() - retcode, stdout, stderr = common.run_os_command('ceph osd status') + retcode, stdout, stderr = common.run_os_command('ceph --connect-timeout=1 osd status') if debug: print("Loop through OSD status data") for line in stderr.split('\n'):