From a7ed837f5ca6ba40a0bb38f064b7a139df2189aa Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Thu, 29 Jun 2017 19:01:09 +0800 Subject: [PATCH] crush: allow "osd crush set-device-class" to create class automatically Signed-off-by: xie xingguo --- src/crush/CrushWrapper.cc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index 6a0017df96d7..1f4b3f521934 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -1562,11 +1562,7 @@ int CrushWrapper::update_device_class(int id, const string& name, ostream *ss) { - int class_id = get_class_id(class_name); - if (class_id < 0) { - *ss << "class " << class_name << " does not exist"; - return -ENOENT; - } + int class_id = get_or_create_class_id(class_name); if (id < 0) { *ss << name << " id " << id << " is negative"; return -EINVAL; -- 2.47.3