From 9d558ffd7696cd0b853f612f0007e93251004736 Mon Sep 17 00:00:00 2001 From: Xiubo Li Date: Thu, 22 Jul 2021 21:16:53 +0800 Subject: [PATCH] gwcli: fix the erasure pool profile's display info Show the pool profile instead of size/min_size. Signed-off-by: Xiubo Li --- gwcli/ceph.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/gwcli/ceph.py b/gwcli/ceph.py index de68588f..df12dd02 100644 --- a/gwcli/ceph.py +++ b/gwcli/ceph.py @@ -4,7 +4,7 @@ from gwcli.utils import console_message, os_cmd import ceph_iscsi_config.settings as settings -from ceph_iscsi_config.utils import human_size +from ceph_iscsi_config.utils import human_size, run_shell_cmd class CephGroup(UIGroup): @@ -288,11 +288,18 @@ class RadosPool(UINode): def __init__(self, parent, pool_name, pool_md): UINode.__init__(self, pool_name, parent) self.pool_md = pool_md + k = 'N' + m = 'N' + if pool_md['type'] == 3: + result, err = run_shell_cmd( + "ceph osd erasure-code-profile get {profile} --format json". + format(profile=pool_md['erasure_code_profile'])) + k = json.loads(result)['k'] + m = json.loads(result)['m'] + pool_type = {1: ("x{}".format(self.pool_md['size']), 'replicated'), - 3: ("{}+{}".format(self.pool_md['min_size'], - self.pool_md['size'] - self.pool_md['min_size']), - "erasure")} + 3: ("{}+{}".format(k, m), "erasure")} self.desc, self.type = pool_type[self.pool_md['type']] def _calc_overcommit(self):