mirror of
https://github.com/ceph/ceph
synced 2025-02-22 18:47:18 +00:00
replace pool type REP with REPLICATED
Signed-off-by: Loic Dachary <loic@dachary.org>
This commit is contained in:
parent
7b98862dd5
commit
a0d1521ddb
@ -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
|
||||
|
@ -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
|
||||
|
@ -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")
|
||||
|
@ -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
|
||||
|
||||
|
@ -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<int> osds;
|
||||
osdmap.pg_to_osds(pgid, osds);
|
||||
if (osds[0] == 0) {
|
||||
@ -2726,10 +2726,10 @@ int OSDMonitor::prepare_new_pool(MPoolOp *m)
|
||||
vector<string> 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
|
||||
|
@ -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);
|
||||
|
@ -1828,7 +1828,7 @@ void OSDMap::build_simple(CephContext *cct, epoch_t e, uuid_d &fsid,
|
||||
|
||||
for (map<int,const char*>::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<int,const char*>::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<int,const char*>::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<int,const char*>::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);
|
||||
|
||||
|
@ -1058,7 +1058,7 @@ void pg_pool_t::generate_test_instances(list<pg_pool_t*>& 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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user