From fa2faeefd8b01e951f952232033ddddeaf4f5c10 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 18 Jan 2018 12:47:51 -0600 Subject: [PATCH] common/options,librbd/Utils: refactor RBD feature validation Move conversion of RBD features to/from string/uint64_t to helpers, and use those from the option validator. Keep the resulting features in integer form to avoid breaking Cinder. Meh. Change behavior from prior version: - fail to parse if any of the specified features is invalid (previously we would parse the ones we understood and ignore the others). Signed-off-by: Sage Weil --- src/CMakeLists.txt | 1 + src/common/options.cc | 79 ++++++------------------------- src/librbd/Features.cc | 105 +++++++++++++++++++++++++++++++++++++++++ src/librbd/Features.h | 16 +++++++ src/librbd/Utils.cc | 6 ++- 5 files changed, 140 insertions(+), 67 deletions(-) create mode 100644 src/librbd/Features.cc create mode 100644 src/librbd/Features.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b454f7d866043..5e1e949b7bd33 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -536,6 +536,7 @@ set(libcommon_files common/dns_resolve.cc common/hostname.cc common/util.cc + librbd/Features.cc arch/probe.cc ${auth_files} ${mds_files}) diff --git a/src/common/options.cc b/src/common/options.cc index 505cf277e7fae..71d97704c2e7c 100644 --- a/src/common/options.cc +++ b/src/common/options.cc @@ -14,6 +14,9 @@ // Definitions for enums #include "common/perf_counters.h" +// rbd feature validation +#include "librbd/Features.h" + void Option::dump_value(const char *field_name, const Option::value_t &v, Formatter *f) const @@ -5817,71 +5820,17 @@ static std::vector