chance_pgnum_grow: 1
chance_pgpnum_fix: 1
chance_thrash_cluster_full: 0
- chance_thrash_pg_remap: 0
- chance_thrash_pg_remap_items: 0
+ chance_thrash_pg_upmap: 0
+ chance_thrash_pg_upmap_items: 0
- print: "**** done thrashosds 3-thrash"
chance_pgpnum_fix: 1
min_in: 4
chance_thrash_cluster_full: 0
- chance_thrash_pg_remap: 0
- chance_thrash_pg_remap_items: 0
+ chance_thrash_pg_upmap: 0
+ chance_thrash_pg_upmap_items: 0
- print: "**** done thrashosds 3-thrash"
chance_pgnum_grow: 1
chance_pgpnum_fix: 1
chance_thrash_cluster_full: 0
- chance_thrash_pg_remap: 0
- chance_thrash_pg_remap_items: 0
+ chance_thrash_pg_upmap: 0
+ chance_thrash_pg_upmap_items: 0
- print: "**** done thrashosds 3-thrash"
chance_pgpnum_fix: 1
min_in: 4
chance_thrash_cluster_full: 0
- chance_thrash_pg_remap: 0
- chance_thrash_pg_remap_items: 0
+ chance_thrash_pg_upmap: 0
+ chance_thrash_pg_upmap_items: 0
- print: "**** done thrashosds 3-thrash"
chance_pgnum_grow: 1
chance_pgpnum_fix: 1
chance_thrash_cluster_full: 0
- chance_thrash_pg_remap: 0
- chance_thrash_pg_remap_items: 0
+ chance_thrash_pg_upmap: 0
+ chance_thrash_pg_upmap_items: 0
- print: "**** done thrashosds 3-thrash"
self.dump_ops_enable = self.config.get('dump_ops_enable')
self.noscrub_toggle_delay = self.config.get('noscrub_toggle_delay')
self.chance_thrash_cluster_full = self.config.get('chance_thrash_cluster_full', .05)
- self.chance_thrash_pg_remap = self.config.get('chance_thrash_pg_remap', 1.0)
- self.chance_thrash_pg_remap_items = self.config.get('chance_thrash_pg_remap', 1.0)
+ self.chance_thrash_pg_upmap = self.config.get('chance_thrash_pg_upmap', 1.0)
+ self.chance_thrash_pg_upmap_items = self.config.get('chance_thrash_pg_upmap', 1.0)
num_osds = self.in_osds + self.out_osds
self.max_pgs = self.config.get("max_pgs_per_pool_osd", 1200) * num_osds
self.log('Setting full ratio back to .95')
self.ceph_manager.raw_cluster_cmd('osd', 'set-full-ratio', '.95')
- def thrash_pg_remap(self):
+ def thrash_pg_upmap(self):
"""
- Install or remove random pg_remap entries in OSDMap
+ Install or remove random pg_upmap entries in OSDMap
"""
from random import shuffle
out = self.ceph_manager.raw_cluster_cmd('osd', 'dump', '-f', 'json-pretty')
shuffle(osds)
osds = osds[0:n]
self.log('Setting %s to %s' % (pgid, osds))
- cmd = ['osd', 'pg-remap', pgid] + [str(x) for x in osds]
+ cmd = ['osd', 'pg-upmap', pgid] + [str(x) for x in osds]
self.log('cmd %s' % cmd)
self.ceph_manager.raw_cluster_cmd(*cmd)
else:
- m = j['pg_remap']
+ m = j['pg_upmap']
if len(m) > 0:
shuffle(m)
pg = m[0]['pgid']
- self.log('Clearing pg_remap on %s' % pg)
+ self.log('Clearing pg_upmap on %s' % pg)
self.ceph_manager.raw_cluster_cmd(
'osd',
- 'rm-pg-remap',
+ 'rm-pg-upmap',
pg)
else:
- self.log('No pg_remap entries; doing nothing')
+ self.log('No pg_upmap entries; doing nothing')
except CommandFailedError:
- self.log('Failed to rm-pg-remap, ignoring')
+ self.log('Failed to rm-pg-upmap, ignoring')
- def thrash_pg_remap_items(self):
+ def thrash_pg_upmap_items(self):
"""
- Install or remove random pg_remap_items entries in OSDMap
+ Install or remove random pg_upmap_items entries in OSDMap
"""
from random import shuffle
out = self.ceph_manager.raw_cluster_cmd('osd', 'dump', '-f', 'json-pretty')
shuffle(osds)
osds = osds[0:n*2]
self.log('Setting %s to %s' % (pgid, osds))
- cmd = ['osd', 'pg-remap-items', pgid] + [str(x) for x in osds]
+ cmd = ['osd', 'pg-upmap-items', pgid] + [str(x) for x in osds]
self.log('cmd %s' % cmd)
self.ceph_manager.raw_cluster_cmd(*cmd)
else:
- m = j['pg_remap_items']
+ m = j['pg_upmap_items']
if len(m) > 0:
shuffle(m)
pg = m[0]['pgid']
- self.log('Clearing pg_remap on %s' % pg)
+ self.log('Clearing pg_upmap on %s' % pg)
self.ceph_manager.raw_cluster_cmd(
'osd',
- 'rm-pg-remap-items',
+ 'rm-pg-upmap-items',
pg)
else:
- self.log('No pg_remap entries; doing nothing')
+ self.log('No pg_upmap entries; doing nothing')
except CommandFailedError:
- self.log('Failed to rm-pg-remap-items, ignoring')
+ self.log('Failed to rm-pg-upmap-items, ignoring')
def all_up(self):
"""
chance_test_backfill_full,))
if self.chance_thrash_cluster_full > 0:
actions.append((self.thrash_cluster_full, self.chance_thrash_cluster_full,))
- if self.chance_thrash_pg_remap > 0:
- actions.append((self.thrash_pg_remap, self.chance_thrash_pg_remap,))
- if self.chance_thrash_pg_remap_items > 0:
- actions.append((self.thrash_pg_remap_items, self.chance_thrash_pg_remap_items,))
+ if self.chance_thrash_pg_upmap > 0:
+ actions.append((self.thrash_pg_upmap, self.chance_thrash_pg_upmap,))
+ if self.chance_thrash_pg_upmap_items > 0:
+ actions.append((self.thrash_pg_upmap_items, self.chance_thrash_pg_upmap_items,))
for key in ['heartbeat_inject_failure', 'filestore_inject_stall']:
for scenario in [
chance_thrash_cluster_full: .05
- chance_thrash_pg_remap: 1.0
- chance_thrash_pg_remap_items: 1.0
+ chance_thrash_pg_upmap: 1.0
+ chance_thrash_pg_upmap_items: 1.0
example:
OPTION(mon_osd_max_split_count, OPT_INT, 32) // largest number of PGs per "involved" OSD to let split create
OPTION(mon_osd_allow_primary_temp, OPT_BOOL, false) // allow primary_temp to be set in the osdmap
OPTION(mon_osd_allow_primary_affinity, OPT_BOOL, false) // allow primary_affinity to be set in the osdmap
-OPTION(mon_osd_allow_pg_remap, OPT_BOOL, false) // allow pg remap to be set in the osdmap
+OPTION(mon_osd_allow_pg_upmap, OPT_BOOL, false) // allow pg upmap to be set in the osdmap
OPTION(mon_osd_prime_pg_temp, OPT_BOOL, true) // prime osdmap with pg mapping changes
OPTION(mon_osd_prime_pg_temp_max_time, OPT_FLOAT, .5) // max time to spend priming
OPTION(mon_osd_prime_pg_temp_max_estimate, OPT_FLOAT, .25) // max estimate of pg total before we do all pgs in parallel
"name=id,type=CephOsdName,n=N,req=false", \
"set pg_temp mapping pgid:[<id> [<id>...]] (developers only)", \
"osd", "rw", "cli,rest")
-COMMAND("osd pg-remap " \
+COMMAND("osd pg-upmap " \
"name=pgid,type=CephPgid " \
"name=id,type=CephOsdName,n=N", \
- "set pg_remap mapping <pgid>:[<id> [<id>...]] primary <primary> (developers only)", \
+ "set pg_upmap mapping <pgid>:[<id> [<id>...]] primary <primary> (developers only)", \
"osd", "rw", "cli,rest")
-COMMAND("osd rm-pg-remap " \
+COMMAND("osd rm-pg-upmap " \
"name=pgid,type=CephPgid", \
- "clear pg_remap mapping for <pgid> (developers only)", \
+ "clear pg_upmap mapping for <pgid> (developers only)", \
"osd", "rw", "cli,rest")
-COMMAND("osd pg-remap-items " \
+COMMAND("osd pg-upmap-items " \
"name=pgid,type=CephPgid " \
"name=id,type=CephOsdName,n=N", \
- "set pg_remap_items mapping <pgid>:{<id> to <id>, [...]} (developers only)", \
+ "set pg_upmap_items mapping <pgid>:{<id> to <id>, [...]} (developers only)", \
"osd", "rw", "cli,rest")
-COMMAND("osd rm-pg-remap-items " \
+COMMAND("osd rm-pg-upmap-items " \
"name=pgid,type=CephPgid", \
- "clear pg_remap_items mapping for <pgid> (developers only)", \
+ "clear pg_upmap_items mapping for <pgid> (developers only)", \
"osd", "rw", "cli,rest")
COMMAND("osd primary-temp " \
"name=pgid,type=CephPgid " \
pending_inc.new_primary_temp[pgid] = osd;
ss << "set " << pgid << " primary_temp mapping to " << osd;
goto update;
- } else if (prefix == "osd pg-remap") {
- if (!g_conf->mon_osd_allow_pg_remap) {
- ss << "you must enable 'mon osd allow pg remap = true' on the mons before you can adjust pg_remap. note that pre-luminous clients will no longer be able to communicate with the cluster.";
+ } else if (prefix == "osd pg-upmap") {
+ if (!g_conf->mon_osd_allow_pg_upmap) {
+ ss << "you must enable 'mon osd allow pg upmap = true' on the mons before you can adjust pg_upmap. note that pre-luminous clients will no longer be able to communicate with the cluster.";
err = -EPERM;
goto reply;
}
err = -ENOENT;
goto reply;
}
- if (pending_inc.new_pg_remap.count(pgid) ||
- pending_inc.old_pg_remap.count(pgid)) {
+ if (pending_inc.new_pg_upmap.count(pgid) ||
+ pending_inc.old_pg_upmap.count(pgid)) {
dout(10) << __func__ << " waiting for pending update on " << pgid << dendl;
wait_for_finished_proposal(op, new C_RetryMessage(this, op));
return true;
err = -EINVAL;
goto reply;
}
- vector<int32_t> new_pg_remap;
+ vector<int32_t> new_pg_upmap;
for (auto osd : id_vec) {
if (osd != CRUSH_ITEM_NONE && !osdmap.exists(osd)) {
ss << "osd." << osd << " does not exist";
err = -ENOENT;
goto reply;
}
- new_pg_remap.push_back(osd);
+ new_pg_upmap.push_back(osd);
}
- pending_inc.new_pg_remap[pgid] = new_pg_remap;
- ss << "set " << pgid << " pg_remap mapping to " << new_pg_remap;
+ pending_inc.new_pg_upmap[pgid] = new_pg_upmap;
+ ss << "set " << pgid << " pg_upmap mapping to " << new_pg_upmap;
goto update;
- } else if (prefix == "osd rm-pg-remap") {
- if (!g_conf->mon_osd_allow_pg_remap) {
- ss << "you must enable 'mon osd allow pg remap = true' on the mons before you can adjust pg_remap. note that pre-luminous clients will no longer be able to communicate with the cluster.";
+ } else if (prefix == "osd rm-pg-upmap") {
+ if (!g_conf->mon_osd_allow_pg_upmap) {
+ ss << "you must enable 'mon osd allow pg upmap = true' on the mons before you can adjust pg_upmap. note that pre-luminous clients will no longer be able to communicate with the cluster.";
err = -EPERM;
goto reply;
}
err = -ENOENT;
goto reply;
}
- if (pending_inc.new_pg_remap.count(pgid) ||
- pending_inc.old_pg_remap.count(pgid)) {
+ if (pending_inc.new_pg_upmap.count(pgid) ||
+ pending_inc.old_pg_upmap.count(pgid)) {
dout(10) << __func__ << " waiting for pending update on " << pgid << dendl;
wait_for_finished_proposal(op, new C_RetryMessage(this, op));
return true;
}
- pending_inc.old_pg_remap.insert(pgid);
- ss << "clear " << pgid << " pg_remap mapping";
+ pending_inc.old_pg_upmap.insert(pgid);
+ ss << "clear " << pgid << " pg_upmap mapping";
goto update;
- } else if (prefix == "osd pg-remap-items") {
- if (!g_conf->mon_osd_allow_pg_remap) {
- ss << "you must enable 'mon osd allow pg remap = true' on the mons before you can adjust pg_remap. note that pre-luminous clients will no longer be able to communicate with the cluster.";
+ } else if (prefix == "osd pg-upmap-items") {
+ if (!g_conf->mon_osd_allow_pg_upmap) {
+ ss << "you must enable 'mon osd allow pg upmap = true' on the mons before you can adjust pg_upmap. note that pre-luminous clients will no longer be able to communicate with the cluster.";
err = -EPERM;
goto reply;
}
err = -ENOENT;
goto reply;
}
- if (pending_inc.new_pg_remap_items.count(pgid) ||
- pending_inc.old_pg_remap_items.count(pgid)) {
+ if (pending_inc.new_pg_upmap_items.count(pgid) ||
+ pending_inc.old_pg_upmap_items.count(pgid)) {
dout(10) << __func__ << " waiting for pending update on " << pgid << dendl;
wait_for_finished_proposal(op, new C_RetryMessage(this, op));
return true;
err = -EINVAL;
goto reply;
}
- vector<pair<int32_t,int32_t>> new_pg_remap_items;
+ vector<pair<int32_t,int32_t>> new_pg_upmap_items;
for (auto p = id_vec.begin(); p != id_vec.end(); ++p) {
int from = *p++;
int to = *p;
err = -ENOENT;
goto reply;
}
- new_pg_remap_items.push_back(make_pair(from, to));
+ new_pg_upmap_items.push_back(make_pair(from, to));
}
- pending_inc.new_pg_remap_items[pgid] = new_pg_remap_items;
- ss << "set " << pgid << " pg_remap_items mapping to " << new_pg_remap_items;
+ pending_inc.new_pg_upmap_items[pgid] = new_pg_upmap_items;
+ ss << "set " << pgid << " pg_upmap_items mapping to " << new_pg_upmap_items;
goto update;
- } else if (prefix == "osd rm-pg-remap-items") {
- if (!g_conf->mon_osd_allow_pg_remap) {
- ss << "you must enable 'mon osd allow pg remap = true' on the mons before you can adjust pg_remap. note that pre-luminous clients will no longer be able to communicate with the cluster.";
+ } else if (prefix == "osd rm-pg-upmap-items") {
+ if (!g_conf->mon_osd_allow_pg_upmap) {
+ ss << "you must enable 'mon osd allow pg upmap = true' on the mons before you can adjust pg_upmap. note that pre-luminous clients will no longer be able to communicate with the cluster.";
err = -EPERM;
goto reply;
}
err = -ENOENT;
goto reply;
}
- if (pending_inc.new_pg_remap_items.count(pgid) ||
- pending_inc.old_pg_remap_items.count(pgid)) {
+ if (pending_inc.new_pg_upmap_items.count(pgid) ||
+ pending_inc.old_pg_upmap_items.count(pgid)) {
dout(10) << __func__ << " waiting for pending update on " << pgid << dendl;
wait_for_finished_proposal(op, new C_RetryMessage(this, op));
return true;
}
- pending_inc.old_pg_remap_items.insert(pgid);
- ss << "clear " << pgid << " pg_remap_items mapping";
+ pending_inc.old_pg_upmap_items.insert(pgid);
+ ss << "clear " << pgid << " pg_upmap_items mapping";
goto update;
} else if (prefix == "osd primary-affinity") {
int64_t id;
::encode(new_erasure_code_profiles, bl);
::encode(old_erasure_code_profiles, bl);
if (v >= 4) {
- ::encode(new_pg_remap, bl);
- ::encode(old_pg_remap, bl);
- ::encode(new_pg_remap_items, bl);
- ::encode(old_pg_remap_items, bl);
+ ::encode(new_pg_upmap, bl);
+ ::encode(old_pg_upmap, bl);
+ ::encode(new_pg_upmap_items, bl);
+ ::encode(old_pg_upmap_items, bl);
}
ENCODE_FINISH(bl); // client-usable data
}
old_erasure_code_profiles.clear();
}
if (struct_v >= 4) {
- ::decode(new_pg_remap, bl);
- ::decode(old_pg_remap, bl);
- ::decode(new_pg_remap_items, bl);
- ::decode(old_pg_remap_items, bl);
+ ::decode(new_pg_upmap, bl);
+ ::decode(old_pg_upmap, bl);
+ ::decode(new_pg_upmap_items, bl);
+ ::decode(old_pg_upmap_items, bl);
}
DECODE_FINISH(bl); // client-usable data
}
}
f->close_section(); // primary_temp
- f->open_array_section("new_pg_remap");
- for (auto& i : new_pg_remap) {
+ f->open_array_section("new_pg_upmap");
+ for (auto& i : new_pg_upmap) {
f->open_object_section("mapping");
f->dump_stream("pgid") << i.first;
f->open_array_section("osds");
f->close_section();
}
f->close_section();
- f->open_array_section("old_pg_remap");
- for (auto& i : old_pg_remap) {
+ f->open_array_section("old_pg_upmap");
+ for (auto& i : old_pg_upmap) {
f->dump_stream("pgid") << i;
}
f->close_section();
- f->open_array_section("new_pg_remap_items");
- for (auto& i : new_pg_remap_items) {
+ f->open_array_section("new_pg_upmap_items");
+ for (auto& i : new_pg_upmap_items) {
f->open_object_section("mapping");
f->dump_stream("pgid") << i.first;
f->open_array_section("mappings");
f->close_section();
}
f->close_section();
- f->open_array_section("old_pg_remap_items");
- for (auto& i : old_pg_remap_items) {
+ f->open_array_section("old_pg_upmap_items");
+ for (auto& i : old_pg_upmap_items) {
f->dump_stream("pgid") << i;
}
f->close_section();
features |= CEPH_FEATURE_CRUSH_TUNABLES5;
mask |= CEPH_FEATURES_CRUSH;
- if (!pg_remap.empty() || !pg_remap_items.empty())
+ if (!pg_upmap.empty() || !pg_upmap_items.empty())
features |= CEPH_FEATUREMASK_OSDMAP_REMAP;
mask |= CEPH_FEATUREMASK_OSDMAP_REMAP;
(*primary_temp)[p->first] = p->second;
}
- for (auto& p : inc.new_pg_remap) {
- pg_remap[p.first] = p.second;
+ for (auto& p : inc.new_pg_upmap) {
+ pg_upmap[p.first] = p.second;
}
- for (auto& pg : inc.old_pg_remap) {
- pg_remap.erase(pg);
+ for (auto& pg : inc.old_pg_upmap) {
+ pg_upmap.erase(pg);
}
- for (auto& p : inc.new_pg_remap_items) {
- pg_remap_items[p.first] = p.second;
+ for (auto& p : inc.new_pg_upmap_items) {
+ pg_upmap_items[p.first] = p.second;
}
- for (auto& pg : inc.old_pg_remap_items) {
- pg_remap_items.erase(pg);
+ for (auto& pg : inc.old_pg_upmap_items) {
+ pg_upmap_items.erase(pg);
}
// blacklist
void OSDMap::_apply_remap(const pg_pool_t& pi, pg_t raw_pg, vector<int> *raw) const
{
pg_t pg = pi.raw_pg_to_pg(raw_pg);
- auto p = pg_remap.find(pg);
- if (p != pg_remap.end()) {
+ auto p = pg_upmap.find(pg);
+ if (p != pg_upmap.end()) {
// make sure targets aren't marked out
for (auto osd : p->second) {
if (osd != CRUSH_ITEM_NONE && osd < max_osd && osd_weight[osd] == 0) {
return;
}
- auto q = pg_remap_items.find(pg);
- if (q != pg_remap_items.end()) {
+ auto q = pg_upmap_items.find(pg);
+ if (q != pg_upmap_items.end()) {
// NOTE: this approach does not allow a bidirectional swap,
// e.g., [[1,2],[2,1]] applied to [0,1,2] -> [0,2,1].
for (auto& r : q->second) {
::encode(erasure_code_profiles, bl);
if (v >= 4) {
- ::encode(pg_remap, bl);
- ::encode(pg_remap_items, bl);
+ ::encode(pg_upmap, bl);
+ ::encode(pg_upmap_items, bl);
} else {
- assert(pg_remap.empty());
- assert(pg_remap_items.empty());
+ assert(pg_upmap.empty());
+ assert(pg_upmap_items.empty());
}
ENCODE_FINISH(bl); // client-usable data
}
erasure_code_profiles.clear();
}
if (struct_v >= 4) {
- ::decode(pg_remap, bl);
- ::decode(pg_remap_items, bl);
+ ::decode(pg_upmap, bl);
+ ::decode(pg_upmap_items, bl);
} else {
- pg_remap.clear();
- pg_remap_items.clear();
+ pg_upmap.clear();
+ pg_upmap_items.clear();
}
DECODE_FINISH(bl); // client-usable data
}
}
f->close_section();
- f->open_array_section("pg_remap");
- for (auto& p : pg_remap) {
+ f->open_array_section("pg_upmap");
+ for (auto& p : pg_upmap) {
f->open_object_section("mapping");
f->dump_stream("pgid") << p.first;
f->open_array_section("osds");
f->close_section();
}
f->close_section();
- f->open_array_section("pg_remap_items");
- for (auto& p : pg_remap_items) {
+ f->open_array_section("pg_upmap_items");
+ for (auto& p : pg_upmap_items) {
f->open_object_section("mapping");
f->dump_stream("pgid") << p.first;
f->open_array_section("mappings");
}
out << std::endl;
- for (auto& p : pg_remap) {
- out << "pg_remap " << p.first << " " << p.second << "\n";
+ for (auto& p : pg_upmap) {
+ out << "pg_upmap " << p.first << " " << p.second << "\n";
}
- for (auto& p : pg_remap_items) {
- out << "pg_remap_items " << p.first << " " << p.second << "\n";
+ for (auto& p : pg_upmap_items) {
+ out << "pg_upmap_items " << p.first << " " << p.second << "\n";
}
for (map<pg_t,vector<int32_t> >::const_iterator p = pg_temp->begin();
}
-int OSDMap::clean_remaps(
+int OSDMap::clean_pg_upmaps(
CephContext *cct,
Incremental *pending_inc)
{
ldout(cct, 10) << __func__ << dendl;
int changed = 0;
- for (auto& p : pg_remap) {
+ for (auto& p : pg_upmap) {
vector<int> raw;
int primary;
pg_to_raw_osds(p.first, &raw, &primary);
if (raw == p.second) {
- ldout(cct, 10) << " removing redundant pg_remap " << p.first << " "
+ ldout(cct, 10) << " removing redundant pg_upmap " << p.first << " "
<< p.second << dendl;
- pending_inc->old_pg_remap.insert(p.first);
+ pending_inc->old_pg_upmap.insert(p.first);
++changed;
}
}
- for (auto& p : pg_remap_items) {
+ for (auto& p : pg_upmap_items) {
vector<int> raw;
int primary;
pg_to_raw_osds(p.first, &raw, &primary);
}
}
if (newmap.empty()) {
- ldout(cct, 10) << " removing no-op pg_remap_items " << p.first << " "
+ ldout(cct, 10) << " removing no-op pg_upmap_items " << p.first << " "
<< p.second << dendl;
- pending_inc->old_pg_remap_items.insert(p.first);
+ pending_inc->old_pg_upmap_items.insert(p.first);
++changed;
} else if (newmap != p.second) {
- ldout(cct, 10) << " simplifying partially no-op pg_remap_items "
+ ldout(cct, 10) << " simplifying partially no-op pg_upmap_items "
<< p.first << " " << p.second << " -> " << newmap << dendl;
- pending_inc->new_pg_remap_items[p.first] = newmap;
+ pending_inc->new_pg_upmap_items[p.first] = newmap;
++changed;
}
}
return changed;
}
-bool OSDMap::try_pg_remap(
+bool OSDMap::try_pg_upmap(
CephContext *cct,
pg_t pg, ///< pg to potentially remap
const set<int>& overfull, ///< osds we'd want to evacuate
return true;
}
-int OSDMap::remap_pgs(
+int OSDMap::calc_pg_upmaps(
CephContext *cct,
float max_deviation,
int max,
// look for remaps we can un-remap
for (auto pg : pgs) {
- auto p = tmp.pg_remap_items.find(pg);
- if (p != tmp.pg_remap_items.end()) {
+ auto p = tmp.pg_upmap_items.find(pg);
+ if (p != tmp.pg_upmap_items.end()) {
for (auto q : p->second) {
if (q.second == osd) {
- ldout(cct, 10) << " dropping pg_remap_items " << pg
+ ldout(cct, 10) << " dropping pg_upmap_items " << pg
<< " " << p->second << dendl;
- tmp.pg_remap_items.erase(p);
- pending_inc->old_pg_remap_items.insert(pg);
+ tmp.pg_upmap_items.erase(p);
+ pending_inc->old_pg_upmap_items.insert(pg);
++num_changed;
restart = true;
}
break;
for (auto pg : pgs) {
- if (tmp.pg_remap.count(pg) ||
- tmp.pg_remap_items.count(pg)) {
+ if (tmp.pg_upmap.count(pg) ||
+ tmp.pg_upmap_items.count(pg)) {
ldout(cct, 20) << " already remapped " << pg << dendl;
continue;
}
ldout(cct, 10) << " trying " << pg << dendl;
vector<int> orig, out;
- if (!try_pg_remap(cct, pg, overfull, underfull, &orig, &out)) {
+ if (!try_pg_upmap(cct, pg, overfull, underfull, &orig, &out)) {
continue;
}
ldout(cct, 10) << " " << pg << " " << orig << " -> " << out << dendl;
continue;
}
assert(orig != out);
- vector<pair<int,int>>& rmi = tmp.pg_remap_items[pg];
+ vector<pair<int,int>>& rmi = tmp.pg_upmap_items[pg];
for (unsigned i = 0; i < out.size(); ++i) {
if (orig[i] != out[i]) {
rmi.push_back(make_pair(orig[i], out[i]));
}
}
- pending_inc->new_pg_remap_items[pg] = rmi;
- ldout(cct, 10) << " " << pg << " pg_remap_items " << rmi << dendl;
+ pending_inc->new_pg_upmap_items[pg] = rmi;
+ ldout(cct, 10) << " " << pg << " pg_upmap_items " << rmi << dendl;
restart = true;
++num_changed;
break;
map<int32_t, entity_addr_t> new_hb_back_up;
map<int32_t, entity_addr_t> new_hb_front_up;
- map<pg_t,vector<int32_t>> new_pg_remap;
- map<pg_t,vector<pair<int32_t,int32_t>>> new_pg_remap_items;
- set<pg_t> old_pg_remap, old_pg_remap_items;
+ map<pg_t,vector<int32_t>> new_pg_upmap;
+ map<pg_t,vector<pair<int32_t,int32_t>>> new_pg_upmap_items;
+ set<pg_t> old_pg_upmap, old_pg_upmap_items;
string cluster_snapshot;
ceph::shared_ptr< vector<__u32> > osd_primary_affinity; ///< 16.16 fixed point, 0x10000 = baseline
// remap (post-CRUSH, pre-up)
- map<pg_t,vector<int32_t>> pg_remap; ///< remap pg
- map<pg_t,vector<pair<int32_t,int32_t>>> pg_remap_items; ///< remap osds in up set
+ map<pg_t,vector<int32_t>> pg_upmap; ///< remap pg
+ map<pg_t,vector<pair<int32_t,int32_t>>> pg_upmap_items; ///< remap osds in up set
map<int64_t,pg_pool_t> pools;
map<int64_t,string> pool_name;
void _apply_primary_affinity(ps_t seed, const pg_pool_t& pool,
vector<int> *osds, int *primary) const;
- /// apply pg_remap[_items] mappings
+ /// apply pg_upmap[_items] mappings
void _apply_remap(const pg_pool_t& pi, pg_t pg, vector<int> *raw) const;
/// pg -> (up osd list)
return calc_pg_role(osd, group, nrep) >= 0;
}
- int clean_remaps(
+ int clean_pg_upmaps(
CephContext *cct,
Incremental *pending_inc);
- bool try_pg_remap(
+ bool try_pg_upmap(
CephContext *cct,
pg_t pg, ///< pg to potentially remap
const set<int>& overfull, ///< osds we'd want to evacuate
vector<int> *orig,
vector<int> *out); ///< resulting alternative mapping
- int remap_pgs(
+ int calc_pg_upmaps(
CephContext *cct,
float max_deviation, ///< max deviation from target (value < 1.0)
int max_iterations, ///< max iterations to run
const set<int64_t>& pools, ///< [optional] restrict to pool
- OSDMap::Incremental *pending_inc
+ Incremental *pending_inc
);
/*
--test-random do random placements
--test-map-pg <pgid> map a pgid to osds
--test-map-object <objectname> [--pool <poolid>] map an object to osds
- --remap-cleanup <file> clean up pg_remap[_items] entries, writing
+ --upmap-cleanup <file> clean up pg_upmap[_items] entries, writing
commands to <file> [default: - for stdout]
- --remap <file> calculate pg remap entries to balance pg layout
+ --upmap <file> calculate pg upmap entries to balance pg layout
writing commands to <file> [default: - for stdout]
- --remap-max <max-count> set max remap entries to calculate [default: 100]
- --remap-deviation <max-deviation>
+ --upmap-max <max-count> set max upmap entries to calculate [default: 100]
+ --upmap-deviation <max-deviation>
max deviation from target [default: .01]
- --remap-pool <poolname> restrict remap balancing to 1 or more pools
+ --upmap-pool <poolname> restrict upmap balancing to 1 or more pools
[1]
--test-random do random placements
--test-map-pg <pgid> map a pgid to osds
--test-map-object <objectname> [--pool <poolid>] map an object to osds
- --remap-cleanup <file> clean up pg_remap[_items] entries, writing
+ --upmap-cleanup <file> clean up pg_upmap[_items] entries, writing
commands to <file> [default: - for stdout]
- --remap <file> calculate pg remap entries to balance pg layout
+ --upmap <file> calculate pg upmap entries to balance pg layout
writing commands to <file> [default: - for stdout]
- --remap-max <max-count> set max remap entries to calculate [default: 100]
- --remap-deviation <max-deviation>
+ --upmap-max <max-count> set max upmap entries to calculate [default: 100]
+ --upmap-deviation <max-deviation>
max deviation from target [default: .01]
- --remap-pool <poolname> restrict remap balancing to 1 or more pools
+ --upmap-pool <poolname> restrict upmap balancing to 1 or more pools
[1]
+++ /dev/null
- $ osdmaptool --create-from-conf om -c $TESTDIR/ceph.conf.withracks
- osdmaptool: osdmap file 'om'
- osdmaptool: writing epoch 1 to om
- $ osdmaptool om --mark-up-in --remap-max 11 --remap c
- osdmaptool: osdmap file 'om'
- marking all OSDs up and in
- writing remap command output to: c
- checking for remap cleanups
- remap, max-count 11, max deviation 0.01
- osdmaptool: writing epoch 3 to om
- $ cat c
- ceph osd pg-remap-items 0.3 54 52 156 155
- ceph osd pg-remap-items 0.1b 158 155 231 227 143 142
- ceph osd pg-remap-items 0.22 168 163 54 52 136 135
- ceph osd pg-remap-items 0.2e 87 86 54 52
- ceph osd pg-remap-items 0.6f 69 65 54 52 157 155
- ceph osd pg-remap-items 0.12b 54 52 226 227
- ceph osd pg-remap-items 0.13f 54 52 96 95 43 46
- ceph osd pg-remap-items 0.151 36 42 54 52
- ceph osd pg-remap-items 0.185 60 61 54 52
- ceph osd pg-remap-items 0.1e3 54 52
- ceph osd pg-remap-items 0.272 54 52
- $ rm -f om c
--- /dev/null
+ $ osdmaptool --create-from-conf om -c $TESTDIR/ceph.conf.withracks
+ osdmaptool: osdmap file 'om'
+ osdmaptool: writing epoch 1 to om
+ $ osdmaptool om --mark-up-in --upmap-max 11 --upmap c
+ osdmaptool: osdmap file 'om'
+ marking all OSDs up and in
+ writing upmap command output to: c
+ checking for upmap cleanups
+ upmap, max-count 11, max deviation 0.01
+ osdmaptool: writing epoch 3 to om
+ $ cat c
+ ceph osd pg-upmap-items 0.3 54 52 156 155
+ ceph osd pg-upmap-items 0.1b 158 155 231 227 143 142
+ ceph osd pg-upmap-items 0.22 168 163 54 52 136 135
+ ceph osd pg-upmap-items 0.2e 87 86 54 52
+ ceph osd pg-upmap-items 0.6f 69 65 54 52 157 155
+ ceph osd pg-upmap-items 0.12b 54 52 226 227
+ ceph osd pg-upmap-items 0.13f 54 52 96 95 43 46
+ ceph osd pg-upmap-items 0.151 36 42 54 52
+ ceph osd pg-upmap-items 0.185 60 61 54 52
+ ceph osd pg-upmap-items 0.1e3 54 52
+ ceph osd pg-upmap-items 0.272 54 52
+ $ rm -f om c
cout << " --test-map-pg <pgid> map a pgid to osds" << std::endl;
cout << " --test-map-object <objectname> [--pool <poolid>] map an object to osds"
<< std::endl;
- cout << " --remap-cleanup <file> clean up pg_remap[_items] entries, writing" << std::endl;
+ cout << " --upmap-cleanup <file> clean up pg_upmap[_items] entries, writing" << std::endl;
cout << " commands to <file> [default: - for stdout]" << std::endl;
- cout << " --remap <file> calculate pg remap entries to balance pg layout" << std::endl;
+ cout << " --upmap <file> calculate pg upmap entries to balance pg layout" << std::endl;
cout << " writing commands to <file> [default: - for stdout]" << std::endl;
- cout << " --remap-max <max-count> set max remap entries to calculate [default: 100]" << std::endl;
- cout << " --remap-deviation <max-deviation>" << std::endl;
+ cout << " --upmap-max <max-count> set max upmap entries to calculate [default: 100]" << std::endl;
+ cout << " --upmap-deviation <max-deviation>" << std::endl;
cout << " max deviation from target [default: .01]" << std::endl;
- cout << " --remap-pool <poolname> restrict remap balancing to 1 or more pools" << std::endl;
+ cout << " --upmap-pool <poolname> restrict upmap balancing to 1 or more pools" << std::endl;
exit(1);
}
-void print_inc_remaps(const OSDMap::Incremental& pending_inc, int fd)
+void print_inc_upmaps(const OSDMap::Incremental& pending_inc, int fd)
{
ostringstream ss;
- for (auto& i : pending_inc.old_pg_remap) {
- ss << "ceph osd rm-pg-remap " << i << std::endl;
+ for (auto& i : pending_inc.old_pg_upmap) {
+ ss << "ceph osd rm-pg-upmap " << i << std::endl;
}
- for (auto& i : pending_inc.new_pg_remap) {
- ss << "ceph osd pg-remap " << i.first;
+ for (auto& i : pending_inc.new_pg_upmap) {
+ ss << "ceph osd pg-upmap " << i.first;
for (auto osd : i.second) {
ss << " " << osd;
}
ss << std::endl;
}
- for (auto& i : pending_inc.old_pg_remap_items) {
- ss << "ceph osd rm-pg-remap-items " << i << std::endl;
+ for (auto& i : pending_inc.old_pg_upmap_items) {
+ ss << "ceph osd rm-pg-upmap-items " << i << std::endl;
}
- for (auto& i : pending_inc.new_pg_remap_items) {
- ss << "ceph osd pg-remap-items " << i.first;
+ for (auto& i : pending_inc.new_pg_upmap_items) {
+ ss << "ceph osd pg-upmap-items " << i.first;
for (auto p : i.second) {
ss << " " << p.first << " " << p.second;
}
bool test_map_pgs = false;
bool test_map_pgs_dump = false;
bool test_random = false;
- bool remap_cleanup = false;
- bool remap = false;
- std::string remap_file = "-";
- int remap_max = 100;
- float remap_deviation = .01;
- std::set<std::string> remap_pools;
+ bool upmap_cleanup = false;
+ bool upmap = false;
+ std::string upmap_file = "-";
+ int upmap_max = 100;
+ float upmap_deviation = .01;
+ std::set<std::string> upmap_pools;
int64_t pg_num = -1;
bool test_map_pgs_dump_all = false;
if (!val.empty() && val != "plain") {
tree_formatter.reset(Formatter::create(val, "", "json"));
}
- } else if (ceph_argparse_witharg(args, i, &remap_file, "--remap-cleanup", (char*)NULL)) {
- remap_cleanup = true;
- } else if (ceph_argparse_witharg(args, i, &remap_file, "--remap", (char*)NULL)) {
- remap_cleanup = true;
- remap = true;
- } else if (ceph_argparse_witharg(args, i, &remap_max, err, "--remap-max", (char*)NULL)) {
- } else if (ceph_argparse_witharg(args, i, &remap_deviation, err, "--remap-deviation", (char*)NULL)) {
- } else if (ceph_argparse_witharg(args, i, &val, "--remap-pool", (char*)NULL)) {
- remap_pools.insert(val);
+ } else if (ceph_argparse_witharg(args, i, &upmap_file, "--upmap-cleanup", (char*)NULL)) {
+ upmap_cleanup = true;
+ } else if (ceph_argparse_witharg(args, i, &upmap_file, "--upmap", (char*)NULL)) {
+ upmap_cleanup = true;
+ upmap = true;
+ } else if (ceph_argparse_witharg(args, i, &upmap_max, err, "--upmap-max", (char*)NULL)) {
+ } else if (ceph_argparse_witharg(args, i, &upmap_deviation, err, "--upmap-deviation", (char*)NULL)) {
+ } else if (ceph_argparse_witharg(args, i, &val, "--upmap-pool", (char*)NULL)) {
+ upmap_pools.insert(val);
} else if (ceph_argparse_witharg(args, i, &num_osd, err, "--createsimple", (char*)NULL)) {
if (!err.str().empty()) {
cerr << err.str() << std::endl;
cout << "clearing pg/primary temp" << std::endl;
osdmap.clear_temp();
}
- int remap_fd = STDOUT_FILENO;
- if (remap || remap_cleanup) {
- if (remap_file != "-") {
- remap_fd = ::open(remap_file.c_str(), O_CREAT|O_WRONLY, 0644);
- if (remap_fd < 0) {
- cerr << "error opening " << remap_file << ": " << cpp_strerror(errno)
+ int upmap_fd = STDOUT_FILENO;
+ if (upmap || upmap_cleanup) {
+ if (upmap_file != "-") {
+ upmap_fd = ::open(upmap_file.c_str(), O_CREAT|O_WRONLY, 0644);
+ if (upmap_fd < 0) {
+ cerr << "error opening " << upmap_file << ": " << cpp_strerror(errno)
<< std::endl;
exit(1);
}
- cout << "writing remap command output to: " << remap_file << std::endl;
+ cout << "writing upmap command output to: " << upmap_file << std::endl;
}
}
- if (remap_cleanup) {
- cout << "checking for remap cleanups" << std::endl;
+ if (upmap_cleanup) {
+ cout << "checking for upmap cleanups" << std::endl;
OSDMap::Incremental pending_inc(osdmap.get_epoch()+1);
pending_inc.fsid = osdmap.get_fsid();
- int r = osdmap.clean_remaps(g_ceph_context, &pending_inc);
+ int r = osdmap.clean_pg_upmaps(g_ceph_context, &pending_inc);
if (r > 0) {
- print_inc_remaps(pending_inc, remap_fd);
+ print_inc_upmaps(pending_inc, upmap_fd);
r = osdmap.apply_incremental(pending_inc);
assert(r == 0);
}
}
- if (remap) {
- cout << "remap, max-count " << remap_max
- << ", max deviation " << remap_deviation
+ if (upmap) {
+ cout << "upmap, max-count " << upmap_max
+ << ", max deviation " << upmap_deviation
<< std::endl;
OSDMap::Incremental pending_inc(osdmap.get_epoch()+1);
pending_inc.fsid = osdmap.get_fsid();
set<int64_t> pools;
- for (auto& s : remap_pools) {
+ for (auto& s : upmap_pools) {
int64_t p = osdmap.lookup_pg_pool_name(s);
if (p < 0) {
cerr << " pool '" << s << "' does not exist" << std::endl;
pools.insert(p);
}
if (!pools.empty())
- cout << " limiting to pools " << remap_pools << " (" << pools << ")"
+ cout << " limiting to pools " << upmap_pools << " (" << pools << ")"
<< std::endl;
- int changed = osdmap.remap_pgs(g_ceph_context, remap_deviation,
- remap_max, pools,
- &pending_inc);
+ int changed = osdmap.calc_pg_upmaps(
+ g_ceph_context, upmap_deviation,
+ upmap_max, pools,
+ &pending_inc);
if (changed) {
- print_inc_remaps(pending_inc, remap_fd);
+ print_inc_upmaps(pending_inc, upmap_fd);
int r = osdmap.apply_incremental(pending_inc);
assert(r == 0);
modified = true;
} else {
- cout << "no remaps proposed" << std::endl;
+ cout << "no upmaps proposed" << std::endl;
}
}
- if (remap_file != "-") {
- ::close(remap_fd);
+ if (upmap_file != "-") {
+ ::close(upmap_fd);
}
if (!import_crush.empty()) {
export_crush.empty() && import_crush.empty() &&
test_map_pg.empty() && test_map_object.empty() &&
!test_map_pgs && !test_map_pgs_dump && !test_map_pgs_dump_all &&
- !remap && !remap_cleanup) {
+ !upmap && !upmap_cleanup) {
cerr << me << ": no action specified?" << std::endl;
usage();
}
[mon]
mon pg warn min per osd = 3
mon osd allow primary affinity = true
- mon osd allow pg remap = true
+ mon osd allow pg upmap = true
mon reweight min pgs per osd = 4
mon osd prime pg temp = true
crushtool = $CEPH_BIN/crushtool