From 7c669e6a5cc48958285a83796f1e4df5fa59926d Mon Sep 17 00:00:00 2001 From: "Zhaowangx.Liang" Date: Thu, 23 Mar 2017 13:53:38 +0800 Subject: [PATCH] modify the method for get the value of cur_space Signed-off-by: Zhaowangx.Liang --- benchmarking/mod/benchmark.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/benchmarking/mod/benchmark.py b/benchmarking/mod/benchmark.py index 4d87a28..828a162 100644 --- a/benchmarking/mod/benchmark.py +++ b/benchmarking/mod/benchmark.py @@ -388,12 +388,18 @@ def check_fio_pgrep(self, nodes, fio_node_num = 1, check_type="jobnum"): def check_rbd_init_completed(self, planed_space, pool_name="rbd"): user = self.cluster["user"] controller = self.cluster["head"] - stdout, stderr = common.pdsh(user, [controller], "ceph df | grep %s | awk '{print $3}'" % pool_name, option = "check_return") + stdout, stderr = common.pdsh(user, [controller], "ceph df -f json", option="check_return") res = common.format_pdsh_return(stdout) - if controller not in res: + distPool = None + if controller in res: + for pool in res[controller]["pools"]: + if pool["name"] == pool_name: + distPool = pool + break + if not distPool: common.printout("ERROR","cannot get ceph space, seems to be a dead error") #sys.exit() - cur_space = common.size_to_Kbytes(res[controller]) + cur_space = distPool["stats"]["kb_used"] planned_space = common.size_to_Kbytes(planed_space) common.printout("WARNING","Ceph cluster used data occupied: %s KB, planned_space: %s KB " % (cur_space, planned_space)) if cur_space < planned_space: