Skip to content

Commit

Permalink
gwcli: fix the erasure pool profile's display info
Browse files Browse the repository at this point in the history
Show the pool profile instead of size/min_size.

Signed-off-by: Xiubo Li <[email protected]>
  • Loading branch information
lxbsz committed Jul 23, 2021
1 parent b1a608a commit 9d558ff
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions gwcli/ceph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 9d558ff

Please sign in to comment.