diff options
author | Loic Dachary <ldachary@redhat.com> | 2017-04-10 22:52:35 +0200 |
---|---|---|
committer | Loic Dachary <ldachary@redhat.com> | 2017-04-11 17:06:57 +0200 |
commit | d198fdb7aedaf20bea1732a85ec59eecfcb617de (patch) | |
tree | b7fe4f98844e5af2933351689ed448c4a1505843 /src/osd | |
parent | osd: split mon_cmd_maybe_osd_create out of update_crush_location (diff) | |
download | ceph-d198fdb7aedaf20bea1732a85ec59eecfcb617de.tar.xz ceph-d198fdb7aedaf20bea1732a85ec59eecfcb617de.zip |
ceph-disk,osd: add support for crush device classes
Fixes: http://tracker.ceph.com/issues/19513
Signed-off-by: Loic Dachary <loic@dachary.org>
Diffstat (limited to 'src/osd')
-rw-r--r-- | src/osd/OSD.cc | 20 | ||||
-rw-r--r-- | src/osd/OSD.h | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index ea67e40f843..bdc2878d785 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -2382,6 +2382,12 @@ int OSD::init() } } + r = update_crush_device_class(); + if (r < 0) { + osd_lock.Lock(); + goto monout; + } + r = update_crush_location(); if (r < 0) { osd_lock.Lock(); @@ -3100,6 +3106,20 @@ int OSD::update_crush_location() return mon_cmd_maybe_osd_create(cmd); } +int OSD::update_crush_device_class() +{ + string device_class; + int r = store->read_meta("crush_device_class", &device_class); + if (r < 0) + return 0; + + string cmd = + string("{\"prefix\": \"osd crush set-device-class\", ") + + string("\"id\": ") + stringify(whoami) + string(", ") + + string("\"class\": \"") + device_class + string("\"}"); + + return mon_cmd_maybe_osd_create(cmd); +} void OSD::write_superblock(ObjectStore::Transaction& t) { diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 90821997caa..71db4878d91 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -2415,6 +2415,7 @@ protected: private: int mon_cmd_maybe_osd_create(string &cmd); + int update_crush_device_class(); int update_crush_location(); static int write_meta(ObjectStore *store, |