From cf6f90c5e1e17a1f44f6ed80422b5f1c543362ca Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 2 Oct 2017 17:11:46 -0500 Subject: [PATCH] mgr/localpool: optionally adjust min_size too Signed-off-by: Sage Weil (cherry picked from commit af72a8932c60a52aad76f1cc94bfbb31048215cc) --- doc/mgr/localpool.rst | 1 + src/pybind/mgr/localpool/module.py | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/doc/mgr/localpool.rst b/doc/mgr/localpool.rst index e0f31cefadfa8..5779b7cf175b7 100644 --- a/doc/mgr/localpool.rst +++ b/doc/mgr/localpool.rst @@ -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 diff --git a/src/pybind/mgr/localpool/module.py b/src/pybind/mgr/localpool/module.py index c2072e9bc5b4d..fac3d1c7f6c71 100644 --- a/src/pybind/mgr/localpool/module.py +++ b/src/pybind/mgr/localpool/module.py @@ -19,6 +19,7 @@ class Module(MgrModule): 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 '3' + min_size = self.get_config('min_size') prefix = self.get_config('prefix') or 'by-' + subtree_type + '-' osdmap = self.get("osd_map") @@ -68,6 +69,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): -- 2.39.5