]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osdmap: do not automatically create an rbd pool on cluster creation; skip pool 0
authorGreg Farnum <gfarnum@redhat.com>
Mon, 5 Jun 2017 19:27:46 +0000 (12:27 -0700)
committerSage Weil <sage@redhat.com>
Wed, 28 Jun 2017 14:52:49 +0000 (10:52 -0400)
We don't use pool ID 0 any more because CephFS can't handle it.
Update the user quick-start to include it, and add some links to support that process.
Fix the tests to handle the new state of life.

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
doc/rados/operations/placement-groups.rst
doc/start/quick-rbd.rst
src/osd/OSDMap.cc
src/osd/OSDMap.h
src/test/osd/TestOSDMap.cc

index 98e13f8608b6a861e9d6a9633181300117dc1fb9..d822373dd168b0317be9063c98bc71bac61c4c60 100644 (file)
@@ -296,6 +296,9 @@ resources. However, if 1,000 pools were created with 512 placement
 groups each, the OSDs will handle ~50,000 placement groups each and it
 would require significantly more resources and time for peering.
 
+You may find the `PGCalc`_ tool helpful.
+
+
 .. _setting the number of placement groups:
 
 Set the Number of Placement Groups
index 59c70cd12c29429233954064d0058c5022e2c911..eb489e76b8b83bca6dd4ff091e86dd36d1e00db9 100644 (file)
@@ -47,6 +47,10 @@ Install Ceph
    directory. Ensure that the keyring file has appropriate read permissions 
    (e.g., ``sudo chmod +r /etc/ceph/ceph.client.admin.keyring``).
 
+Create an rbd pool
+==================
+#. On the admin node, use the ``ceph`` tool to `Create a Pool`_
+   (we recommend the name 'rbd').
 
 Configure a Block Device
 ========================
index aee8256e077ddf4427cb5ee161ac7dd7f34ca962..c37ed79d00710fbed0607b0588d919821910cd8f 100644 (file)
@@ -3231,8 +3231,7 @@ int OSDMap::build_simple(CephContext *cct, epoch_t e, uuid_d &fsid,
                          int nosd, int pg_bits, int pgp_bits)
 {
   ldout(cct, 10) << "build_simple on " << num_osd
-                << " osds with " << pg_bits << " pg bits per osd, "
-                << dendl;
+                << " osds" << dendl;
   epoch = e;
   set_fsid(fsid);
   created = modified = ceph_clock_now();
@@ -3268,13 +3267,6 @@ int OSDMap::build_simple(CephContext *cct, epoch_t e, uuid_d &fsid,
     set_max_osd(maxosd + 1);
   }
 
-  // pgp_num <= pg_num
-  if (pgp_bits > pg_bits)
-    pgp_bits = pg_bits;
-
-  vector<string> pool_names;
-  pool_names.push_back("rbd");
-
   stringstream ss;
   int r;
   if (nosd >= 0)
@@ -3283,35 +3275,6 @@ int OSDMap::build_simple(CephContext *cct, epoch_t e, uuid_d &fsid,
     r = build_simple_crush_map_from_conf(cct, *crush, &ss);
   assert(r == 0);
 
-  int poolbase = get_max_osd() ? get_max_osd() : 1;
-
-  int const default_replicated_rule =
-    crush->get_osd_pool_default_crush_replicated_ruleset(cct);
-  assert(default_replicated_rule >= 0);
-
-  for (auto &plname : pool_names) {
-    int64_t pool = ++pool_max;
-    pools[pool].type = pg_pool_t::TYPE_REPLICATED;
-    pools[pool].flags = cct->_conf->osd_pool_default_flags;
-    if (cct->_conf->osd_pool_default_flag_hashpspool)
-      pools[pool].set_flag(pg_pool_t::FLAG_HASHPSPOOL);
-    if (cct->_conf->osd_pool_default_flag_nodelete)
-      pools[pool].set_flag(pg_pool_t::FLAG_NODELETE);
-    if (cct->_conf->osd_pool_default_flag_nopgchange)
-      pools[pool].set_flag(pg_pool_t::FLAG_NOPGCHANGE);
-    if (cct->_conf->osd_pool_default_flag_nosizechange)
-      pools[pool].set_flag(pg_pool_t::FLAG_NOSIZECHANGE);
-    pools[pool].size = cct->_conf->osd_pool_default_size;
-    pools[pool].min_size = cct->_conf->get_osd_pool_default_min_size();
-    pools[pool].crush_rule = default_replicated_rule;
-    pools[pool].object_hash = CEPH_STR_HASH_RJENKINS;
-    pools[pool].set_pg_num(poolbase << pg_bits);
-    pools[pool].set_pgp_num(poolbase << pgp_bits);
-    pools[pool].last_change = epoch;
-    pool_name[pool] = plname;
-    name_pool[plname] = pool;
-  }
-
   for (int i=0; i<get_max_osd(); i++) {
     set_state(i, 0);
     set_weight(i, CEPH_OSD_OUT);
index 8e236cf805bfad0e5a56e182f7c398db935451c1..b2bcb461d947d302a28f84d39d8a3b26713c9d60 100644 (file)
@@ -569,7 +569,7 @@ private:
 
  public:
   OSDMap() : epoch(0), 
-            pool_max(-1),
+            pool_max(0),
             flags(0),
             num_osd(0), num_up_osd(0), num_in_osd(0),
             max_osd(0),
index 8eb12720e6dad81a87db81c89b8831aa4351b9ac..dad236074179be745c7b8e79b22dd70a328e5f5f 100644 (file)
@@ -32,6 +32,9 @@ class OSDMapTest : public testing::Test {
 public:
   OSDMap osdmap;
   OSDMapMapping mapping;
+  const uint64_t my_ec_pool = 1;
+  const uint64_t my_rep_pool = 2;
+
 
   OSDMapTest() {}
 
@@ -65,7 +68,9 @@ public:
     new_pool_inc.new_pool_max = osdmap.get_pool_max();
     new_pool_inc.fsid = osdmap.get_fsid();
     pg_pool_t empty;
+    // make an ec pool
     uint64_t pool_id = ++new_pool_inc.new_pool_max;
+    assert(pool_id == my_ec_pool);
     pg_pool_t *p = new_pool_inc.get_new_pool(pool_id, &empty);
     p->size = 3;
     p->set_pg_num(64);
@@ -73,6 +78,17 @@ public:
     p->type = pg_pool_t::TYPE_ERASURE;
     p->crush_rule = r;
     new_pool_inc.new_pool_names[pool_id] = "ec";
+    // and a replicated pool
+    pool_id = ++new_pool_inc.new_pool_max;
+    assert(pool_id == my_rep_pool);
+    p = new_pool_inc.get_new_pool(pool_id, &empty);
+    p->size = 3;
+    p->set_pg_num(64);
+    p->set_pgp_num(64);
+    p->type = pg_pool_t::TYPE_REPLICATED;
+    p->crush_rule = 0;
+    p->set_flag(pg_pool_t::FLAG_HASHPSPOOL);
+    new_pool_inc.new_pool_names[pool_id] = "reppool";
     osdmap.apply_incremental(new_pool_inc);
   }
   unsigned int get_num_osds() { return num_osds; }
@@ -160,7 +176,8 @@ TEST_F(OSDMapTest, Features) {
 TEST_F(OSDMapTest, MapPG) {
   set_up_map();
 
-  pg_t rawpg(0, 0, -1);
+  std::cerr << " osdmap.pool_max==" << osdmap.get_pool_max() << std::endl;
+  pg_t rawpg(0, my_rep_pool, -1);
   pg_t pgid = osdmap.raw_pg_to_pg(rawpg);
   vector<int> up_osds, acting_osds;
   int up_primary, acting_primary;
@@ -173,14 +190,13 @@ TEST_F(OSDMapTest, MapPG) {
   ASSERT_EQ(old_up_osds, up_osds);
   ASSERT_EQ(old_acting_osds, acting_osds);
 
-  ASSERT_EQ(osdmap.get_pg_pool(0)->get_size(), up_osds.size());
+  ASSERT_EQ(osdmap.get_pg_pool(my_rep_pool)->get_size(), up_osds.size());
 }
 
 TEST_F(OSDMapTest, MapFunctionsMatch) {
   // TODO: make sure pg_to_up_acting_osds and pg_to_acting_osds match
   set_up_map();
-
-  pg_t rawpg(0, 0, -1);
+  pg_t rawpg(0, my_rep_pool, -1);
   pg_t pgid = osdmap.raw_pg_to_pg(rawpg);
   vector<int> up_osds, acting_osds;
   int up_primary, acting_primary;
@@ -208,7 +224,7 @@ TEST_F(OSDMapTest, MapFunctionsMatch) {
 TEST_F(OSDMapTest, PrimaryIsFirst) {
   set_up_map();
 
-  pg_t rawpg(0, 0, -1);
+  pg_t rawpg(0, my_rep_pool, -1);
   pg_t pgid = osdmap.raw_pg_to_pg(rawpg);
   vector<int> up_osds, acting_osds;
   int up_primary, acting_primary;
@@ -222,7 +238,7 @@ TEST_F(OSDMapTest, PrimaryIsFirst) {
 TEST_F(OSDMapTest, PGTempRespected) {
   set_up_map();
 
-  pg_t rawpg(0, 0, -1);
+  pg_t rawpg(0, my_rep_pool, -1);
   pg_t pgid = osdmap.raw_pg_to_pg(rawpg);
   vector<int> up_osds, acting_osds;
   int up_primary, acting_primary;
@@ -250,7 +266,7 @@ TEST_F(OSDMapTest, PGTempRespected) {
 TEST_F(OSDMapTest, PrimaryTempRespected) {
   set_up_map();
 
-  pg_t rawpg(0, 0, -1);
+  pg_t rawpg(0, my_rep_pool, -1);
   pg_t pgid = osdmap.raw_pg_to_pg(rawpg);
   vector<int> up_osds;
   vector<int> acting_osds;
@@ -274,7 +290,7 @@ TEST_F(OSDMapTest, CleanTemps) {
 
   OSDMap::Incremental pgtemp_map(osdmap.get_epoch() + 1);
   OSDMap::Incremental pending_inc(osdmap.get_epoch() + 2);
-  pg_t pga = osdmap.raw_pg_to_pg(pg_t(0, 0));
+  pg_t pga = osdmap.raw_pg_to_pg(pg_t(0, my_rep_pool));
   {
     vector<int> up_osds, acting_osds;
     int up_primary, acting_primary;
@@ -284,7 +300,7 @@ TEST_F(OSDMapTest, CleanTemps) {
       up_osds.begin(), up_osds.end());
     pgtemp_map.new_primary_temp[pga] = up_primary;
   }
-  pg_t pgb = osdmap.raw_pg_to_pg(pg_t(1, 0));
+  pg_t pgb = osdmap.raw_pg_to_pg(pg_t(1, my_rep_pool));
   {
     vector<int> up_osds, acting_osds;
     int up_primary, acting_primary;
@@ -310,7 +326,7 @@ TEST_F(OSDMapTest, CleanTemps) {
 TEST_F(OSDMapTest, KeepsNecessaryTemps) {
   set_up_map();
 
-  pg_t rawpg(0, 0, -1);
+  pg_t rawpg(0, my_rep_pool, -1);
   pg_t pgid = osdmap.raw_pg_to_pg(rawpg);
   vector<int> up_osds, acting_osds;
   int up_primary, acting_primary;