Add or move a new item (OSD) with the given id/name/weight at the specified
location. ::
- ceph osd crush set {id} {name} {weight} [{loc1} [{loc2} ...]]
+ ceph osd crush set {id} {weight} [{loc1} [{loc2} ...]]
Remove an existing item from the CRUSH map. ::
Adding new devices or moving existing devices to new positions in the
CRUSH hierarchy can be done via the monitor. The general form is::
- $ ceph osd crush set <id> <name> <weight> [<loc> [<lo2> ...]]
+ $ ceph osd crush set <id> <weight> [<loc> [<lo2> ...]]
where
For example, if the OSD id is ``123``, we want a weight of ``1.0`` and
the device is on host ``hostfoo`` and rack ``rackbar``::
- $ ceph osd crush set 123 osd.123 1.0 root=default rack=rackbar host=hostfoo
+ $ ceph osd crush set 123 1.0 root=default rack=rackbar host=hostfoo
will add it to the hierarchy, or move it from its previous position.
(Note: for clusters created prior to v0.52, replace ``root=default``
Note that if I later add another device in the same host but specify a
different pool or rack::
- $ ceph osd crush set 124 osd.124 1.0 root=nondefault rack=weirdrack host=hostfoo
+ $ ceph osd crush set 124 1.0 root=nondefault rack=weirdrack host=hostfoo
the device will still be placed in host ``hostfoo`` at its current
location (rack ``rackbar`` and pool ``default``).
}
else if (m->cmd.size() >= 6 && m->cmd[1] == "crush" && m->cmd[2] == "set") {
do {
- // osd crush set <id> <name> <weight> [<loc1> [<loc2> ...]]
- int id = parse_pos_long(m->cmd[3].c_str(), &ss);
+ // osd crush set <osd-id> [<osd.* name>] <weight> [<loc1> [<loc2> ...]]
+ int id = parse_osd_id(m->cmd[3].c_str(), &ss);
if (id < 0) {
err = -EINVAL;
goto out;
goto out;
}
- string name = m->cmd[4];
- float weight = atof(m->cmd[5].c_str());
+ int argpos = 4;
+ string name;
+ if (m->cmd[argpos].find("osd.") == 0) {
+ // old annoying usage, explicitly specifying osd.NNN name
+ name = m->cmd[argpos];
+ argpos++;
+ } else {
+ // new usage; infer name
+ name = "osd." + stringify(id);
+ }
+ float weight = atof(m->cmd[argpos].c_str());
+ argpos++;
map<string,string> loc;
- for (unsigned i = 6; i < m->cmd.size(); ++i) {
+ for (unsigned i = argpos; i < m->cmd.size(); ++i) {
const char *s = m->cmd[i].c_str();
const char *pos = strchr(s, '=');
if (!pos)
ceph osd tell <osd-id or *> injectargs '--<switch> <value> [--<switch> <value>...]'
ceph osd getcrushmap -o <file>
ceph osd getmap -o <file>
- ceph osd crush set <osd-id> <name> <weight> [<loc1> [<loc2> ...]]
+ ceph osd crush set <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>
cout << " ceph osd tell <osd-id or *> injectargs '--<switch> <value> [--<switch> <value>...]'\n";
cout << " ceph osd getcrushmap -o <file>\n";
cout << " ceph osd getmap -o <file>\n";
- cout << " ceph osd crush set <osd-id> <name> <weight> [<loc1> [<loc2> ...]]\n";
+ cout << " ceph osd crush set <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";