From 9624923f19dc649a8f182f28e9580a3045964d9e Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 2 Oct 2017 17:11:38 -0500 Subject: [PATCH 1/3] mgr/localpool: default to 3x Signed-off-by: Sage Weil --- src/pybind/mgr/localpool/module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pybind/mgr/localpool/module.py b/src/pybind/mgr/localpool/module.py index 18e19bbd374..c2072e9bc5b 100644 --- a/src/pybind/mgr/localpool/module.py +++ b/src/pybind/mgr/localpool/module.py @@ -18,7 +18,7 @@ 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' prefix = self.get_config('prefix') or 'by-' + subtree_type + '-' osdmap = self.get("osd_map") From af72a8932c60a52aad76f1cc94bfbb31048215cc Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 2 Oct 2017 17:11:46 -0500 Subject: [PATCH 2/3] mgr/localpool: optionally adjust min_size too Signed-off-by: Sage Weil --- 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 e0f31cefadf..5779b7cf175 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 c2072e9bc5b..fac3d1c7f6c 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): From 7623513935525498640defa2064c291fd69a2b76 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 4 Oct 2017 08:25:38 -0500 Subject: [PATCH 3/3] mgr/localpool: fix rule selection The 'osd pool create' arg parsing is broken; the rule name for 'ceph osd pool create $name $numpgs replicated $rulename' is passed via the erasure_code_profile param. Too many req=false options without a way to disambiguate them. Work around it by passing both 'rule' and 'erasure_code_profile' keys, so that if/when the hack in OSDMonitor.cc is removed it will still work. Blech. Signed-off-by: Sage Weil --- src/pybind/mgr/localpool/module.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pybind/mgr/localpool/module.py b/src/pybind/mgr/localpool/module.py index fac3d1c7f6c..0abdbfbc741 100644 --- a/src/pybind/mgr/localpool/module.py +++ b/src/pybind/mgr/localpool/module.py @@ -54,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), }), "")