From: Kefu Chai Date: Thu, 28 Sep 2017 07:30:43 +0000 (+0800) Subject: osd: fail if unable to update device class in crush X-Git-Tag: v13.0.1~733^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1087350aaca6adfc698aa00eb37d6064557b598b;p=ceph.git osd: fail if unable to update device class in crush device-class is supported since luminous, so we should fail the init() if device-class is not updated in crush. this reverts 244db740: if the device class changes then the user should either follow the instruction to "ceph osd crush rm-device-class" or fix CrushWrapper::update_device_class(). this silences clang analyzer warning of: Value stored to 'r' is never read Signed-off-by: Kefu Chai --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index a558caf5e20c..6524e1e9a2de 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -3537,12 +3537,12 @@ int OSD::update_crush_device_class() string("\"ids\": [\"") + stringify(whoami) + string("\"]}"); r = mon_cmd_maybe_osd_create(cmd); - // the above cmd can fail for various reasons, e.g.: - // (1) we are connecting to a pre-luminous monitor - // (2) user manually specify a class other than - // 'ceph-disk prepare --crush-device-class' - // simply skip result-checking for now - return 0; + if (r == -EBUSY) { + // good, already bound to a device-class + return 0; + } else { + return r; + } } void OSD::write_superblock(ObjectStore::Transaction& t)