From a0d1521ddbccbf4b780340ac487d41af3dd6fdca Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Sun, 22 Dec 2013 07:04:36 +0100 Subject: [PATCH] replace pool type REP with REPLICATED Signed-off-by: Loic Dachary --- qa/workunits/cephtool/test.sh | 6 +++--- src/crush/CrushCompiler.cc | 4 ++-- src/crush/CrushWrapper.cc | 2 +- src/include/rados.h | 2 +- src/mon/OSDMonitor.cc | 10 +++++----- src/osd/OSD.cc | 2 +- src/osd/OSDMap.cc | 8 ++++---- src/osd/osd_types.cc | 2 +- src/osd/osd_types.h | 8 ++++---- src/test/cli/osdmaptool/clobber.t | 12 ++++++------ src/test/cli/osdmaptool/create-print.t | 6 +++--- src/tools/crushtool.cc | 2 +- 12 files changed, 32 insertions(+), 32 deletions(-) diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh index cf04c56cb46dd..ee525cb674941 100755 --- a/qa/workunits/cephtool/test.sh +++ b/qa/workunits/cephtool/test.sh @@ -273,11 +273,11 @@ ceph osd pool delete data3 data3 --yes-i-really-really-mean-it ceph osd pool create erasurecodes 12 12 erasure ceph osd pool create erasurecodes 12 12 erasure -# should fail because the default type is rep and +# should fail because the default type is replicated and # the pool is of type erasure #expect_false ceph osd pool create erasurecodes 12 12 -ceph osd pool create replicated 12 12 rep -ceph osd pool create replicated 12 12 rep +ceph osd pool create replicated 12 12 replicated +ceph osd pool create replicated 12 12 replicated ceph osd pool create replicated 12 12 # default is replicated ceph osd pool create replicated 12 # default is replicated, pgp_num = pg_num # should fail because the type is not the same diff --git a/src/crush/CrushCompiler.cc b/src/crush/CrushCompiler.cc index 9a210d1ea0402..a954fecd0be46 100644 --- a/src/crush/CrushCompiler.cc +++ b/src/crush/CrushCompiler.cc @@ -227,7 +227,7 @@ int CrushCompiler::decompile(ostream &out) out << "\truleset " << crush.get_rule_mask_ruleset(i) << "\n"; switch (crush.get_rule_mask_type(i)) { - case CEPH_PG_TYPE_REP: + case CEPH_PG_TYPE_REPLICATED: out << "\ttype replicated\n"; break; case CEPH_PG_TYPE_ERASURE: @@ -583,7 +583,7 @@ int CrushCompiler::parse_rule(iter_t const& i) string tname = string_node(i->children[start+2]); int type; if (tname == "replicated") - type = CEPH_PG_TYPE_REP; + type = CEPH_PG_TYPE_REPLICATED; else if (tname == "erasure") type = CEPH_PG_TYPE_ERASURE; else diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index 5318ddd8a79cd..ae1ece1a74a6f 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -698,7 +698,7 @@ int CrushWrapper::add_simple_rule(string name, string root_name, int steps = 3; if (mode == "indep") steps = 4; - crush_rule *rule = crush_make_rule(steps, ruleset, 1 /* pg_pool_t::TYPE_REP */, 1, 10); + crush_rule *rule = crush_make_rule(steps, ruleset, 1 /* pg_pool_t::TYPE_REPLICATED */, 1, 10); assert(rule); int step = 0; if (mode == "indep") diff --git a/src/include/rados.h b/src/include/rados.h index e52d2087da713..a037df15c2935 100644 --- a/src/include/rados.h +++ b/src/include/rados.h @@ -68,7 +68,7 @@ struct ceph_pg { * NOTE: These map 1:1 on to the pg_pool_t::TYPE_* values. They are * duplicated here only for CrushCompiler's benefit. */ -#define CEPH_PG_TYPE_REP 1 +#define CEPH_PG_TYPE_REPLICATED 1 /* #define CEPH_PG_TYPE_RAID4 2 never implemented */ #define CEPH_PG_TYPE_ERASURE 3 diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 4fa796e4d63a9..1bd7a5e78f1e1 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -1882,7 +1882,7 @@ void OSDMonitor::tick() ps_t numps = osdmap.get_pg_num(); for (int64_t pool=0; pool<1; pool++) for (ps_t ps = 0; ps < numps; ++ps) { - pg_t pgid = pg_t(pg_t::TYPE_REP, ps, pool, -1); + pg_t pgid = pg_t(pg_t::TYPE_REPLICATED, ps, pool, -1); vector osds; osdmap.pg_to_osds(pgid, osds); if (osds[0] == 0) { @@ -2726,10 +2726,10 @@ int OSDMonitor::prepare_new_pool(MPoolOp *m) vector properties; if (m->auid) return prepare_new_pool(m->name, m->auid, m->crush_rule, 0, 0, - properties, pg_pool_t::TYPE_REP); + properties, pg_pool_t::TYPE_REPLICATED); else return prepare_new_pool(m->name, session->auid, m->crush_rule, 0, 0, - properties, pg_pool_t::TYPE_REP); + properties, pg_pool_t::TYPE_REPLICATED); } /** @@ -3955,8 +3955,8 @@ done: string pool_type_str; cmd_getval(g_ceph_context, cmdmap, "pool_type", pool_type_str); int pool_type; - if (pool_type_str.empty() || pool_type_str == "rep") { - pool_type = pg_pool_t::TYPE_REP; + if (pool_type_str.empty() || pool_type_str == "replicated") { + pool_type = pg_pool_t::TYPE_REPLICATED; } else if (pool_type_str == "erasure") { // check if all up osds support erasure coding diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 327c0adddada0..582b36aed30cc 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -1694,7 +1694,7 @@ PG* OSD::_make_pg( PG *pg; hobject_t logoid = make_pg_log_oid(pgid); hobject_t infooid = make_pg_biginfo_oid(pgid); - if (createmap->get_pg_type(pgid) == pg_pool_t::TYPE_REP) + if (createmap->get_pg_type(pgid) == pg_pool_t::TYPE_REPLICATED) pg = new ReplicatedPG(&service, createmap, pool, pgid, logoid, infooid); else assert(0); diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 758b15dfdfc7a..400a1a490f484 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -1828,7 +1828,7 @@ void OSDMap::build_simple(CephContext *cct, epoch_t e, uuid_d &fsid, for (map::iterator p = rulesets.begin(); p != rulesets.end(); ++p) { int64_t pool = ++pool_max; - pools[pool].type = pg_pool_t::TYPE_REP; + 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].flags |= pg_pool_t::FLAG_HASHPSPOOL; @@ -1901,7 +1901,7 @@ void OSDMap::build_simple_crush_map(CephContext *cct, CrushWrapper& crush, assert(maxrep >= minrep); for (map::iterator p = rulesets.begin(); p != rulesets.end(); ++p) { int ruleset = p->first; - crush_rule *rule = crush_make_rule(3, ruleset, pg_pool_t::TYPE_REP, minrep, maxrep); + crush_rule *rule = crush_make_rule(3, ruleset, pg_pool_t::TYPE_REPLICATED, minrep, maxrep); assert(rule); crush_rule_set_step(rule, 0, CRUSH_RULE_TAKE, rootid, 0); crush_rule_set_step(rule, 1, @@ -1966,7 +1966,7 @@ int OSDMap::build_simple_from_conf(CephContext *cct, epoch_t e, uuid_d &fsid, for (map::iterator p = rulesets.begin(); p != rulesets.end(); ++p) { int64_t pool = ++pool_max; - pools[pool].type = pg_pool_t::TYPE_REP; + 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].flags |= pg_pool_t::FLAG_HASHPSPOOL; @@ -2062,7 +2062,7 @@ void OSDMap::build_simple_crush_map_from_conf(CephContext *cct, CrushWrapper& cr int maxrep = conf->osd_max_rep; for (map::iterator p = rulesets.begin(); p != rulesets.end(); ++p) { int ruleset = p->first; - crush_rule *rule = crush_make_rule(3, ruleset, pg_pool_t::TYPE_REP, minrep, maxrep); + crush_rule *rule = crush_make_rule(3, ruleset, pg_pool_t::TYPE_REPLICATED, minrep, maxrep); assert(rule); crush_rule_set_step(rule, 0, CRUSH_RULE_TAKE, rootid, 0); diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index cc0d389c80fa2..2ca70d33bfa3c 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -1058,7 +1058,7 @@ void pg_pool_t::generate_test_instances(list& o) pg_pool_t a; o.push_back(new pg_pool_t(a)); - a.type = TYPE_REP; + a.type = TYPE_REPLICATED; a.size = 2; a.crush_ruleset = 3; a.object_hash = 4; diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 72aaad735d29e..f224e6d864fbf 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -697,13 +697,13 @@ inline ostream& operator<<(ostream& out, const pool_snap_info_t& si) { */ struct pg_pool_t { enum { - TYPE_REP = 1, // replication + TYPE_REPLICATED = 1, // replication //TYPE_RAID4 = 2, // raid4 (never implemented) TYPE_ERASURE = 3, // erasure-coded }; static const char *get_type_name(int t) { switch (t) { - case TYPE_REP: return "rep"; + case TYPE_REPLICATED: return "replicated"; //case TYPE_RAID4: return "raid4"; case TYPE_ERASURE: return "erasure"; default: return "???"; @@ -861,12 +861,12 @@ public: void set_snap_seq(snapid_t s) { snap_seq = s; } void set_snap_epoch(epoch_t e) { snap_epoch = e; } - bool is_rep() const { return get_type() == TYPE_REP; } + bool is_replicated() const { return get_type() == TYPE_REPLICATED; } bool is_erasure() const { return get_type() == TYPE_ERASURE; } bool can_shift_osds() const { switch (get_type()) { - case TYPE_REP: + case TYPE_REPLICATED: return true; case TYPE_ERASURE: return false; diff --git a/src/test/cli/osdmaptool/clobber.t b/src/test/cli/osdmaptool/clobber.t index 6d6cc7d45aa38..9d8cfef04c60b 100644 --- a/src/test/cli/osdmaptool/clobber.t +++ b/src/test/cli/osdmaptool/clobber.t @@ -20,9 +20,9 @@ modified \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re) flags - pool 0 'data' rep size 3 min_size 2 crush_ruleset 0 object_hash rjenkins pg_num 192 pgp_num 192 last_change 0 owner 0 flags hashpspool crash_replay_interval 45 - pool 1 'metadata' rep size 3 min_size 2 crush_ruleset 1 object_hash rjenkins pg_num 192 pgp_num 192 last_change 0 owner 0 flags hashpspool - pool 2 'rbd' rep size 3 min_size 2 crush_ruleset 2 object_hash rjenkins pg_num 192 pgp_num 192 last_change 0 owner 0 flags hashpspool + pool 0 'data' replicated size 3 min_size 2 crush_ruleset 0 object_hash rjenkins pg_num 192 pgp_num 192 last_change 0 owner 0 flags hashpspool crash_replay_interval 45 + pool 1 'metadata' replicated size 3 min_size 2 crush_ruleset 1 object_hash rjenkins pg_num 192 pgp_num 192 last_change 0 owner 0 flags hashpspool + pool 2 'rbd' replicated size 3 min_size 2 crush_ruleset 2 object_hash rjenkins pg_num 192 pgp_num 192 last_change 0 owner 0 flags hashpspool max_osd 3 @@ -43,9 +43,9 @@ modified \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re) flags - pool 0 'data' rep size 3 min_size 2 crush_ruleset 0 object_hash rjenkins pg_num 64 pgp_num 64 last_change 0 owner 0 flags hashpspool crash_replay_interval 45 - pool 1 'metadata' rep size 3 min_size 2 crush_ruleset 1 object_hash rjenkins pg_num 64 pgp_num 64 last_change 0 owner 0 flags hashpspool - pool 2 'rbd' rep size 3 min_size 2 crush_ruleset 2 object_hash rjenkins pg_num 64 pgp_num 64 last_change 0 owner 0 flags hashpspool + pool 0 'data' replicated size 3 min_size 2 crush_ruleset 0 object_hash rjenkins pg_num 64 pgp_num 64 last_change 0 owner 0 flags hashpspool crash_replay_interval 45 + pool 1 'metadata' replicated size 3 min_size 2 crush_ruleset 1 object_hash rjenkins pg_num 64 pgp_num 64 last_change 0 owner 0 flags hashpspool + pool 2 'rbd' replicated size 3 min_size 2 crush_ruleset 2 object_hash rjenkins pg_num 64 pgp_num 64 last_change 0 owner 0 flags hashpspool max_osd 1 diff --git a/src/test/cli/osdmaptool/create-print.t b/src/test/cli/osdmaptool/create-print.t index f54f4be939501..c10e3d182eff9 100644 --- a/src/test/cli/osdmaptool/create-print.t +++ b/src/test/cli/osdmaptool/create-print.t @@ -10,9 +10,9 @@ modified \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re) flags - pool 0 'data' rep size 3 min_size 2 crush_ruleset 0 object_hash rjenkins pg_num 192 pgp_num 192 last_change 0 owner 0 flags hashpspool crash_replay_interval 45 - pool 1 'metadata' rep size 3 min_size 2 crush_ruleset 1 object_hash rjenkins pg_num 192 pgp_num 192 last_change 0 owner 0 flags hashpspool - pool 2 'rbd' rep size 3 min_size 2 crush_ruleset 2 object_hash rjenkins pg_num 192 pgp_num 192 last_change 0 owner 0 flags hashpspool + pool 0 'data' replicated size 3 min_size 2 crush_ruleset 0 object_hash rjenkins pg_num 192 pgp_num 192 last_change 0 owner 0 flags hashpspool crash_replay_interval 45 + pool 1 'metadata' replicated size 3 min_size 2 crush_ruleset 1 object_hash rjenkins pg_num 192 pgp_num 192 last_change 0 owner 0 flags hashpspool + pool 2 'rbd' replicated size 3 min_size 2 crush_ruleset 2 object_hash rjenkins pg_num 192 pgp_num 192 last_change 0 owner 0 flags hashpspool max_osd 3 diff --git a/src/tools/crushtool.cc b/src/tools/crushtool.cc index 14ac9c89a7e61..55813c3d14f82 100644 --- a/src/tools/crushtool.cc +++ b/src/tools/crushtool.cc @@ -599,7 +599,7 @@ int main(int argc, const char **argv) // make a generic rules int ruleset=1; - crush_rule *rule = crush_make_rule(3, ruleset, CEPH_PG_TYPE_REP, 2, 2); + crush_rule *rule = crush_make_rule(3, ruleset, CEPH_PG_TYPE_REPLICATED, 2, 2); assert(rule); crush_rule_set_step(rule, 0, CRUSH_RULE_TAKE, rootid, 0); crush_rule_set_step(rule, 1, CRUSH_RULE_CHOOSELEAF_FIRSTN, CRUSH_CHOOSE_N, 1); -- 2.39.5