Merge pull request #18089 from liewegas/wip-localpool-min-size

mgr/localpool: default to 3x; allow min_size adjustment

Reviewed-by: John Spray <john.spray@redhat.com>
This commit is contained in:
Sage Weil 2017-10-04 08:26:07 -05:00 committed by GitHub
commit e462f6cc8a
2 changed files with 15 additions and 1 deletions

View File

@ -25,6 +25,7 @@ The *localpool* module understands the following options:
* **pg_num** (default: `128`): number of PGs to create for each pool
* **num_rep** (default: `3`): number of replicas for each pool.
(Currently, pools are always replicated.)
* **min_size** (default: none): value to set min_size to (unchanged from Ceph's default if this option is not set)
* **prefix** (default: `by-$subtreetype-`): prefix for the pool name.
These options are set via the config-key interface. For example, to

View File

@ -18,7 +18,8 @@ class Module(MgrModule):
subtree_type = self.get_config('subtree') or 'rack'
failure_domain = self.get_config('failure_domain') or 'host'
pg_num = self.get_config('pg_num') or '128'
num_rep = self.get_config('num_rep') or '2'
num_rep = self.get_config('num_rep') or '3'
min_size = self.get_config('min_size')
prefix = self.get_config('prefix') or 'by-' + subtree_type + '-'
osdmap = self.get("osd_map")
@ -53,6 +54,7 @@ class Module(MgrModule):
"format": "json",
"pool": pool_name,
'rule': pool_name,
'erasure_code_profile': pool_name,
"pool_type": 'replicated',
'pg_num': str(pg_num),
}), "")
@ -68,6 +70,17 @@ class Module(MgrModule):
}), "")
r, outb, outs = result.wait()
if min_size:
result = CommandResult("")
self.send_command(result, "mon", "", json.dumps({
"prefix": "osd pool set",
"format": "json",
"pool": pool_name,
'var': 'min_size',
"val": str(min_size),
}), "")
r, outb, outs = result.wait()
# TODO remove pools for hosts that don't exist?
def serve(self):