]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: do not try to set device class before luminous
authorJosh Durgin <jdurgin@redhat.com>
Mon, 31 Jul 2017 15:59:18 +0000 (11:59 -0400)
committerJosh Durgin <jdurgin@redhat.com>
Tue, 1 Aug 2017 01:50:48 +0000 (21:50 -0400)
This avoids crashing when older monitors do not support it.

Fixes: http://tracker.ceph.com/issues/20850
Signed-off-by: Josh Durgin <jdurgin@redhat.com>
src/osd/OSD.cc

index 79f29db4b998e5e4d5ff2d7d1ac7f842813cc818..2376f4a7a45377e8288f46017f7ee37825a2a6c0 100644 (file)
@@ -2635,15 +2635,15 @@ int OSD::init()
 
   r = update_crush_device_class();
   if (r < 0) {
-    derr << __func__ <<" unable to update_crush_device_class: "
-         << cpp_strerror(r) << dendl;
+    derr << __func__ << " unable to update_crush_device_class: "
+        << cpp_strerror(r) << dendl;
     osd_lock.Lock();
     goto monout;
   }
 
   r = update_crush_location();
   if (r < 0) {
-    derr << __func__ <<" unable to update_crush_location: "
+    derr << __func__ << " unable to update_crush_location: "
          << cpp_strerror(r) << dendl;
     osd_lock.Lock();
     goto monout;
@@ -3524,6 +3524,7 @@ int OSD::update_crush_device_class()
   }
 
   if (device_class.empty()) {
+    dout(20) << __func__ << " no device class stored locally" << dendl;
     return 0;
   }
 
@@ -3533,7 +3534,10 @@ int OSD::update_crush_device_class()
     string("\"ids\": [\"") + stringify(whoami) + string("\"]}");
 
   r = mon_cmd_maybe_osd_create(cmd);
-  if (r == -EPERM) {
+  // we may not have a real osdmap on first boot, so we can't check if
+  // require-osd-release is set to luminous yet. Instead, ignore
+  // EINVAL.
+  if (r == -EPERM || r == -EINVAL) {
     r = 0;
   }