Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osd: pg-remap -> pg-upmap #14556

Merged
merged 1 commit into from Apr 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -18,6 +18,6 @@ split_tasks:
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"
Expand Up @@ -18,6 +18,6 @@ stress-tasks:
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"
4 changes: 2 additions & 2 deletions qa/suites/upgrade/jewel-x/stress-split/3-thrash/default.yaml
Expand Up @@ -17,6 +17,6 @@ stress-tasks:
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"
Expand Up @@ -18,6 +18,6 @@ stress-tasks:
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"
4 changes: 2 additions & 2 deletions qa/suites/upgrade/kraken-x/stress-split/3-thrash/default.yaml
Expand Up @@ -17,6 +17,6 @@ stress-tasks:
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"
44 changes: 22 additions & 22 deletions qa/tasks/ceph_manager.py
Expand Up @@ -123,8 +123,8 @@ def __init__(self, manager, config, logger=None):
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
Expand Down Expand Up @@ -507,9 +507,9 @@ def thrash_cluster_full(self):
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')
Expand All @@ -529,27 +529,27 @@ def thrash_pg_remap(self):
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')
Expand All @@ -569,23 +569,23 @@ def thrash_pg_remap_items(self):
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):
"""
Expand Down Expand Up @@ -805,10 +805,10 @@ def choose_action(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 [
Expand Down
4 changes: 2 additions & 2 deletions qa/tasks/thrashosds.py
Expand Up @@ -122,8 +122,8 @@ def task(ctx, config):

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:

Expand Down
2 changes: 1 addition & 1 deletion src/common/config_opts.h
Expand Up @@ -282,7 +282,7 @@ OPTION(mon_osd_max_op_age, OPT_DOUBLE, 32) // max op age before we get conce
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
Expand Down
16 changes: 8 additions & 8 deletions src/mon/MonCommands.h
Expand Up @@ -647,24 +647,24 @@ COMMAND("osd pg-temp " \
"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 " \
Expand Down
64 changes: 32 additions & 32 deletions src/mon/OSDMonitor.cc
Expand Up @@ -7219,9 +7219,9 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
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;
}
Expand All @@ -7248,8 +7248,8 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
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;
Expand All @@ -7261,22 +7261,22 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
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;
}
Expand All @@ -7303,19 +7303,19 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
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;
}
Expand All @@ -7342,8 +7342,8 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
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;
Expand All @@ -7360,7 +7360,7 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
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;
Expand All @@ -7374,15 +7374,15 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
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;
}
Expand All @@ -7409,15 +7409,15 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
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;
Expand Down