From: Josh Durgin Date: Mon, 31 Jul 2017 15:59:18 +0000 (-0400) Subject: osd: do not try to set device class before luminous X-Git-Tag: ses5-milestone10~6^2~9^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=966513908c9f37c35a1c02210c21369ad70331f5;p=ceph.git osd: do not try to set device class before luminous This avoids crashing when older monitors do not support it. Fixes: http://tracker.ceph.com/issues/20850 Signed-off-by: Josh Durgin --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 79f29db4b998..2376f4a7a453 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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; }