]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: fail if unable to update device class in crush
authorKefu Chai <kchai@redhat.com>
Thu, 28 Sep 2017 07:30:43 +0000 (15:30 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 29 Sep 2017 03:01:53 +0000 (11:01 +0800)
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 <kchai@redhat.com>
src/osd/OSD.cc

index a558caf5e20c12151a6657ae9bde1f7b80200fba..6524e1e9a2de31274b94a178e146a0f158419b6d 100644 (file)
@@ -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)