From 966513908c9f37c35a1c02210c21369ad70331f5 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Mon, 31 Jul 2017 11:59:18 -0400 Subject: [PATCH] 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 --- src/osd/OSD.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 79f29db4b99..2376f4a7a45 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; } -- 2.39.5