mirror of
https://github.com/ceph/ceph
synced 2024-12-18 01:16:55 +00:00
mon: 'ceph osd crush add ...' to add a second link to an item
Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
4e2557a038
commit
05dac04ba0
@ -2256,7 +2256,8 @@ bool OSDMonitor::prepare_command(MMonCommand *m)
|
||||
wait_for_finished_proposal(new Monitor::C_Command(mon, m, 0, rs, get_version()));
|
||||
return true;
|
||||
}
|
||||
else if (m->cmd.size() >= 5 && m->cmd[1] == "crush" && m->cmd[2] == "set") {
|
||||
else if (m->cmd.size() >= 5 && m->cmd[1] == "crush" && (m->cmd[2] == "set" ||
|
||||
m->cmd[2] == "add")) {
|
||||
do {
|
||||
// osd crush set <osd-id> [<osd.* name>] <weight> <loc1> [<loc2> ...]
|
||||
int id = parse_osd_id(m->cmd[3].c_str(), &ss);
|
||||
@ -2297,16 +2298,22 @@ bool OSDMonitor::prepare_command(MMonCommand *m)
|
||||
bufferlist::iterator p = bl.begin();
|
||||
newcrush.decode(p);
|
||||
|
||||
err = newcrush.update_item(g_ceph_context, id, weight, name, loc);
|
||||
if (m->cmd[2] == "set") {
|
||||
err = newcrush.update_item(g_ceph_context, id, weight, name, loc);
|
||||
} else {
|
||||
err = newcrush.insert_item(g_ceph_context, id, weight, name, loc);
|
||||
if (err == 0)
|
||||
err = 1;
|
||||
}
|
||||
if (err == 0) {
|
||||
ss << "updated item id " << id << " name '" << name << "' weight " << weight
|
||||
ss << m->cmd[2] << " item id " << id << " name '" << name << "' weight " << weight
|
||||
<< " at location " << loc << " to crush map";
|
||||
break;
|
||||
}
|
||||
if (err > 0) {
|
||||
pending_inc.crush.clear();
|
||||
newcrush.encode(pending_inc.crush);
|
||||
ss << "updated item id " << id << " name '" << name << "' weight " << weight
|
||||
ss << m->cmd[2] << " item id " << id << " name '" << name << "' weight " << weight
|
||||
<< " at location " << loc << " to crush map";
|
||||
getline(ss, rs);
|
||||
wait_for_finished_proposal(new Monitor::C_Command(mon, m, 0, rs, get_version()));
|
||||
|
@ -45,6 +45,7 @@
|
||||
ceph osd getcrushmap -o <file>
|
||||
ceph osd getmap -o <file>
|
||||
ceph osd crush set <osd-id> <weight> <loc1> [<loc2> ...]
|
||||
ceph osd crush add <osd-id> <weight> <loc1> [<loc2> ...]
|
||||
ceph osd crush move <bucketname> <loc1> [<loc2> ...]
|
||||
ceph osd crush create-or-move <osd-id> <initial-weight> <loc1> [<loc2> ...]
|
||||
ceph osd crush reweight <name> <weight>
|
||||
|
@ -88,6 +88,7 @@ static void usage()
|
||||
cout << " ceph osd getcrushmap -o <file>\n";
|
||||
cout << " ceph osd getmap -o <file>\n";
|
||||
cout << " ceph osd crush set <osd-id> <weight> <loc1> [<loc2> ...]\n";
|
||||
cout << " ceph osd crush add <osd-id> <weight> <loc1> [<loc2> ...]\n";
|
||||
cout << " ceph osd crush move <bucketname> <loc1> [<loc2> ...]\n";
|
||||
cout << " ceph osd crush create-or-move <osd-id> <initial-weight> <loc1> [<loc2> ...]\n";
|
||||
cout << " ceph osd crush reweight <name> <weight>\n";
|
||||
|
Loading…
Reference in New Issue
Block a user