]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd/OSDMap: set pg_autoscale_mode with setting from conf
authorKefu Chai <kchai@redhat.com>
Wed, 2 Jan 2019 16:20:13 +0000 (00:20 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 2 Jan 2019 17:40:28 +0000 (01:40 +0800)
* 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 <kchai@redhat.com>
src/osd/OSDMap.cc
src/test/cli/osdmaptool/clobber.t
src/test/cli/osdmaptool/create-print.t
src/test/cli/osdmaptool/create-racks.t

index afde1d058d26cb891e947e1bc3b523c890b332c0..3ca1181275df4503f6f8a4f1b54013d30a47f5aa 100644 (file)
@@ -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<string>("osd_pool_default_pg_autoscale_mode"));
+      pools[pool].pg_autoscale_mode = m >= 0 ? m : 0;
       pool_name[pool] = plname;
       name_pool[plname] = pool;
     }
index 29351f1fc4486d0dc54c0180502dbfaba20644ea..f4e4ac628f9c5b50ce728c2440e7dd8753612e84 100644 (file)
@@ -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
   
index 88e7918a1f23d0a5e1f01a5481cc4dad0b9c5e2c..4ea8050e72fc8b20b1caa1d57607a5130dc40e0f 100644 (file)
@@ -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
index fb13da65fc97eaaed0eaf8548d2eee387a2fbab2..a7c59f02b9ccb0f13eaa80aca33a90fee51e98c1 100644 (file)
   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
   
   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