From 7fc7a7d167d5297003f622492abf734cf2a24ca3 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 3 Jan 2019 00:20:13 +0800 Subject: [PATCH] osd/OSDMap: set pg_autoscale_mode with setting from conf * update build_simple_optioned() to set pg_autoscale_mode with the setting read from conf, otherwise it will be a random value in heap. * update cli test accordingly, otherwise we will have /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/cli/osdmaptool/create-racks.t: failed --- /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/cli/osdmaptool/create-racks.t +++ /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/cli/osdmaptool/create-racks.t.err @@ -796,7 +796,7 @@ nearfull_ratio 0 min_compat_client jewel - pool 1 'rbd' replicated size 3 min_size 2 crush_rule 0 object_hash rjenkins pg_num 15296 pgp_num 15296 last_change 0 flags hashpspool stripe_width 0 application rbd + pool 1 'rbd' replicated size 3 min_size 2 crush_rule 0 object_hash rjenkins pg_num 15296 pgp_num 15296 autoscale_mode ??? last_change 0 flags hashpspool stripe_width 0 application rbd Signed-off-by: Kefu Chai --- src/osd/OSDMap.cc | 3 +++ src/test/cli/osdmaptool/clobber.t | 4 ++-- src/test/cli/osdmaptool/create-print.t | 4 ++-- src/test/cli/osdmaptool/create-racks.t | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index afde1d058d2..3ca1181275d 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -3868,6 +3868,9 @@ int OSDMap::build_simple_optioned(CephContext *cct, epoch_t e, uuid_d &fsid, pools[pool].last_change = epoch; pools[pool].application_metadata.insert( {pg_pool_t::APPLICATION_NAME_RBD, {}}); + auto m = pg_pool_t::get_pg_autoscale_mode_by_name( + cct->_conf.get_val("osd_pool_default_pg_autoscale_mode")); + pools[pool].pg_autoscale_mode = m >= 0 ? m : 0; pool_name[pool] = plname; name_pool[plname] = pool; } diff --git a/src/test/cli/osdmaptool/clobber.t b/src/test/cli/osdmaptool/clobber.t index 29351f1fc44..f4e4ac628f9 100644 --- a/src/test/cli/osdmaptool/clobber.t +++ b/src/test/cli/osdmaptool/clobber.t @@ -25,7 +25,7 @@ nearfull_ratio 0 min_compat_client jewel - pool 1 'rbd' replicated size 3 min_size 2 crush_rule 0 object_hash rjenkins pg_num 192 pgp_num 192 last_change 0 flags hashpspool stripe_width 0 application rbd + pool 1 'rbd' replicated size 3 min_size 2 crush_rule 0 object_hash rjenkins pg_num 192 pgp_num 192 autoscale_mode warn last_change 0 flags hashpspool stripe_width 0 application rbd max_osd 3 @@ -51,7 +51,7 @@ nearfull_ratio 0 min_compat_client jewel - pool 1 'rbd' replicated size 3 min_size 2 crush_rule 0 object_hash rjenkins pg_num 64 pgp_num 64 last_change 0 flags hashpspool stripe_width 0 application rbd + pool 1 'rbd' replicated size 3 min_size 2 crush_rule 0 object_hash rjenkins pg_num 64 pgp_num 64 autoscale_mode warn last_change 0 flags hashpspool stripe_width 0 application rbd max_osd 1 diff --git a/src/test/cli/osdmaptool/create-print.t b/src/test/cli/osdmaptool/create-print.t index 88e7918a1f2..4ea8050e72f 100644 --- a/src/test/cli/osdmaptool/create-print.t +++ b/src/test/cli/osdmaptool/create-print.t @@ -84,7 +84,7 @@ nearfull_ratio 0 min_compat_client jewel - pool 1 'rbd' replicated size 3 min_size 2 crush_rule 0 object_hash rjenkins pg_num 192 pgp_num 192 last_change 0 flags hashpspool stripe_width 0 application rbd + pool 1 'rbd' replicated size 3 min_size 2 crush_rule 0 object_hash rjenkins pg_num 192 pgp_num 192 autoscale_mode warn last_change 0 flags hashpspool stripe_width 0 application rbd max_osd 3 @@ -93,5 +93,5 @@ osdmaptool: writing epoch 1 to myosdmap $ osdmaptool --print myosdmap | grep 'pool 1' osdmaptool: osdmap file 'myosdmap' - pool 1 'rbd' replicated size 3 min_size 2 crush_rule 0 object_hash rjenkins pg_num 192 pgp_num 192 last_change 0 flags hashpspool stripe_width 0 application rbd + pool 1 'rbd' replicated size 3 min_size 2 crush_rule 0 object_hash rjenkins pg_num 192 pgp_num 192 autoscale_mode warn last_change 0 flags hashpspool stripe_width 0 application rbd $ rm -f myosdmap diff --git a/src/test/cli/osdmaptool/create-racks.t b/src/test/cli/osdmaptool/create-racks.t index fb13da65fc9..a7c59f02b9c 100644 --- a/src/test/cli/osdmaptool/create-racks.t +++ b/src/test/cli/osdmaptool/create-racks.t @@ -796,7 +796,7 @@ nearfull_ratio 0 min_compat_client jewel - pool 1 'rbd' replicated size 3 min_size 2 crush_rule 0 object_hash rjenkins pg_num 15296 pgp_num 15296 last_change 0 flags hashpspool stripe_width 0 application rbd + pool 1 'rbd' replicated size 3 min_size 2 crush_rule 0 object_hash rjenkins pg_num 15296 pgp_num 15296 autoscale_mode warn last_change 0 flags hashpspool stripe_width 0 application rbd max_osd 239 @@ -806,5 +806,5 @@ osdmaptool: writing epoch 1 to om $ osdmaptool --print om | grep 'pool 1' osdmaptool: osdmap file 'om' - pool 1 'rbd' replicated size 3 min_size 2 crush_rule 0 object_hash rjenkins pg_num 15296 pgp_num 15296 last_change 0 flags hashpspool stripe_width 0 application rbd + pool 1 'rbd' replicated size 3 min_size 2 crush_rule 0 object_hash rjenkins pg_num 15296 pgp_num 15296 autoscale_mode warn last_change 0 flags hashpspool stripe_width 0 application rbd $ rm -f om -- 2.39.5