From db7936ae1c8ff0cb102460b820621eb0e56e7856 Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Sun, 17 May 2015 15:28:52 +0200 Subject: [PATCH] erasure-code: implement consistent error stream The error stream in the erasure code path is broken and the error message is sometime not reported back to the user. For instance the ErasureCodePlugin::factory method has no error stream: when an error happens the user is left with a cryptic error code that needs lookup in the sources to figure it out. The error stream is made more systematic by: * always pass it as ostream *ss (instead of something passing it as a reference and sometime as a stringstream) * ostream *ss is added to ErasureCodePlugin::factory * define the ErasureCodeInterface::init pure virtual. It is already implemented by all plugins, only in slightly different ways. The ostream *ss is added so the init function has a way to report error in a human readable way to the caller, in addition to the error code. The ErasureCodePluginJerasure::init return value was incorrectly ignored when called from ErasureCodePluginJerasure::factory and now returns when it fails. The ErasureCodeLrc::layers_init method is given ostream *ss for error messages instead of printing them via derr. The ErasureCodePluginLrc::factory method no longer prints errors via derr: this workaround is made unnecessary by the ostream *ss argument. The ErasureCodeShec::init ostream *ss argument is ignored. The ErasureCodeShec::parse method entirely relies on derr to report errors and converting it goes beyond the scope of this cleanup. There is a slight risk of getting it wrong and it deserves a separate commit and careful and independent review. The PGBackend, OSDMonitor.{cc,h} changes are only about prototype changes. Signed-off-by: Loic Dachary --- src/ceph_mon.cc | 2 +- src/ceph_osd.cc | 2 +- src/erasure-code/ErasureCodeInterface.h | 16 ++ src/erasure-code/ErasureCodePlugin.cc | 32 ++-- src/erasure-code/ErasureCodePlugin.h | 9 +- src/erasure-code/isa/ErasureCodeIsa.cc | 12 +- src/erasure-code/isa/ErasureCodeIsa.h | 2 +- src/erasure-code/isa/ErasureCodePluginIsa.cc | 13 +- .../jerasure/ErasureCodeJerasure.cc | 10 +- .../jerasure/ErasureCodeJerasure.h | 2 +- .../jerasure/ErasureCodePluginJerasure.cc | 10 +- .../ErasureCodePluginSelectJerasure.cc | 8 +- src/erasure-code/lrc/ErasureCodeLrc.cc | 9 +- src/erasure-code/lrc/ErasureCodeLrc.h | 2 +- src/erasure-code/lrc/ErasureCodePluginLrc.cc | 12 +- .../shec/ErasureCodePluginShec.cc | 5 +- src/erasure-code/shec/ErasureCodeShec.cc | 11 +- src/erasure-code/shec/ErasureCodeShec.h | 2 +- src/mon/OSDMonitor.cc | 60 +++---- src/mon/OSDMonitor.h | 18 +-- src/osd/PGBackend.cc | 2 +- src/test/erasure-code/ErasureCodeExample.h | 4 + .../erasure-code/ErasureCodePluginExample.cc | 3 +- src/test/erasure-code/TestErasureCode.cc | 4 + src/test/erasure-code/TestErasureCodeIsa.cc | 24 +-- .../erasure-code/TestErasureCodeJerasure.cc | 12 +- src/test/erasure-code/TestErasureCodeLrc.cc | 2 +- .../erasure-code/TestErasureCodePlugin.cc | 20 ++- .../erasure-code/TestErasureCodePluginIsa.cc | 4 +- .../TestErasureCodePluginJerasure.cc | 14 +- .../erasure-code/TestErasureCodePluginLrc.cc | 2 +- src/test/erasure-code/TestErasureCodeShec.cc | 152 +++++++++--------- .../erasure-code/TestErasureCodeShec_all.cc | 2 +- .../TestErasureCodeShec_thread.cc | 2 +- src/test/erasure-code/ceph_erasure_code.cc | 2 +- 35 files changed, 258 insertions(+), 228 deletions(-) diff --git a/src/ceph_mon.cc b/src/ceph_mon.cc index 42c67b58302dd..dcb07de615dd0 100644 --- a/src/ceph_mon.cc +++ b/src/ceph_mon.cc @@ -193,7 +193,7 @@ int preload_erasure_code() stringstream ss; int r = ErasureCodePluginRegistry::instance().preload(plugins, directory, - ss); + &ss); if (r) derr << ss.str() << dendl; else diff --git a/src/ceph_osd.cc b/src/ceph_osd.cc index d893aebd052a0..8a7e0c294180b 100644 --- a/src/ceph_osd.cc +++ b/src/ceph_osd.cc @@ -89,7 +89,7 @@ int preload_erasure_code() stringstream ss; int r = ErasureCodePluginRegistry::instance().preload(plugins, directory, - ss); + &ss); if (r) derr << ss.str() << dendl; else diff --git a/src/erasure-code/ErasureCodeInterface.h b/src/erasure-code/ErasureCodeInterface.h index 70e8c6438a67b..1fb962aad5eef 100644 --- a/src/erasure-code/ErasureCodeInterface.h +++ b/src/erasure-code/ErasureCodeInterface.h @@ -157,6 +157,22 @@ namespace ceph { public: virtual ~ErasureCodeInterface() {} + /** + * Initialize the instance according to the content of + * **profile**. The **ss** stream is set with debug messages or + * error messages, the content of which depend on the + * implementation. + * + * Return 0 on success or a negative errno on error. When + * returning on error, the implementation is expected to + * provide a human readable explanation in **ss**. + * + * @param [in] profile a key/value map + * @param [out] ss contains informative messages when an error occurs + * @return 0 on success or a negative errno on error. + */ + virtual int init(ErasureCodeProfile &profile, ostream *ss) = 0; + /** * Create a new ruleset in **crush** under the name **name**, * unless it already exists. diff --git a/src/erasure-code/ErasureCodePlugin.cc b/src/erasure-code/ErasureCodePlugin.cc index f874357707fca..f8f9eec6a1ef5 100644 --- a/src/erasure-code/ErasureCodePlugin.cc +++ b/src/erasure-code/ErasureCodePlugin.cc @@ -86,7 +86,7 @@ ErasureCodePlugin *ErasureCodePluginRegistry::get(const std::string &name) int ErasureCodePluginRegistry::factory(const std::string &plugin_name, ErasureCodeProfile &profile, ErasureCodeInterfaceRef *erasure_code, - ostream &ss) + ostream *ss) { ErasureCodePlugin *plugin; { @@ -102,7 +102,7 @@ int ErasureCodePluginRegistry::factory(const std::string &plugin_name, } } - return plugin->factory(profile, erasure_code); + return plugin->factory(profile, erasure_code, ss); } static const char *an_older_version() { @@ -112,14 +112,14 @@ static const char *an_older_version() { int ErasureCodePluginRegistry::load(const std::string &plugin_name, const std::string &directory, ErasureCodePlugin **plugin, - ostream &ss) + ostream *ss) { assert(lock.is_locked()); std::string fname = directory + "/" PLUGIN_PREFIX + plugin_name + PLUGIN_SUFFIX; void *library = dlopen(fname.c_str(), RTLD_NOW); if (!library) { - ss << "load dlopen(" << fname << "): " << dlerror(); + *ss << "load dlopen(" << fname << "): " << dlerror(); return -EIO; } @@ -128,8 +128,8 @@ int ErasureCodePluginRegistry::load(const std::string &plugin_name, if (erasure_code_version == NULL) erasure_code_version = an_older_version; if (erasure_code_version() != string(CEPH_GIT_NICE_VER)) { - ss << "expected plugin " << fname << " version " << CEPH_GIT_NICE_VER - << " but it claims to be " << erasure_code_version() << " instead"; + *ss << "expected plugin " << fname << " version " << CEPH_GIT_NICE_VER + << " but it claims to be " << erasure_code_version() << " instead"; dlclose(library); return -EXDEV; } @@ -140,38 +140,38 @@ int ErasureCodePluginRegistry::load(const std::string &plugin_name, std::string name = plugin_name; int r = erasure_code_init(name.c_str(), directory.c_str()); if (r != 0) { - ss << "erasure_code_init(" << plugin_name - << "," << directory - << "): " << cpp_strerror(r); + *ss << "erasure_code_init(" << plugin_name + << "," << directory + << "): " << cpp_strerror(r); dlclose(library); return r; } } else { - ss << "load dlsym(" << fname - << ", " << PLUGIN_INIT_FUNCTION - << "): " << dlerror(); + *ss << "load dlsym(" << fname + << ", " << PLUGIN_INIT_FUNCTION + << "): " << dlerror(); dlclose(library); return -ENOENT; } *plugin = get(plugin_name); if (*plugin == 0) { - ss << "load " << PLUGIN_INIT_FUNCTION << "()" - << "did not register " << plugin_name; + *ss << "load " << PLUGIN_INIT_FUNCTION << "()" + << "did not register " << plugin_name; dlclose(library); return -EBADF; } (*plugin)->library = library; - ss << __func__ << ": " << plugin_name << " "; + *ss << __func__ << ": " << plugin_name << " "; return 0; } int ErasureCodePluginRegistry::preload(const std::string &plugins, const std::string &directory, - ostream &ss) + ostream *ss) { Mutex::Locker l(lock); list plugins_list; diff --git a/src/erasure-code/ErasureCodePlugin.h b/src/erasure-code/ErasureCodePlugin.h index 19c4e0ce3a1ef..9da0a6efcfaa1 100644 --- a/src/erasure-code/ErasureCodePlugin.h +++ b/src/erasure-code/ErasureCodePlugin.h @@ -37,7 +37,8 @@ namespace ceph { virtual ~ErasureCodePlugin() {} virtual int factory(ErasureCodeProfile &profile, - ErasureCodeInterfaceRef *erasure_code) = 0; + ErasureCodeInterfaceRef *erasure_code, + ostream *ss) = 0; }; class ErasureCodePluginRegistry { @@ -59,7 +60,7 @@ namespace ceph { int factory(const std::string &plugin, ErasureCodeProfile &profile, ErasureCodeInterfaceRef *erasure_code, - ostream &ss); + ostream *ss); int add(const std::string &name, ErasureCodePlugin *plugin); int remove(const std::string &name); @@ -68,11 +69,11 @@ namespace ceph { int load(const std::string &plugin_name, const std::string &directory, ErasureCodePlugin **plugin, - ostream &ss); + ostream *ss); int preload(const std::string &plugins, const std::string &directory, - ostream &ss); + ostream *ss); }; } diff --git a/src/erasure-code/isa/ErasureCodeIsa.cc b/src/erasure-code/isa/ErasureCodeIsa.cc index 2ddb87df475d3..697062e9a9192 100644 --- a/src/erasure-code/isa/ErasureCodeIsa.cc +++ b/src/erasure-code/isa/ErasureCodeIsa.cc @@ -63,9 +63,10 @@ ErasureCodeIsa::create_ruleset(const string &name, // ----------------------------------------------------------------------------- -void -ErasureCodeIsa::init(ErasureCodeProfile &profile) +int +ErasureCodeIsa::init(ErasureCodeProfile &profile, ostream *ss) { + int err = 0; dout(10) << "technique=" << technique << dendl; map::const_iterator parameter; parameter = profile.find("ruleset-root"); @@ -74,10 +75,11 @@ ErasureCodeIsa::init(ErasureCodeProfile &profile) parameter = profile.find("ruleset-failure-domain"); if (parameter != profile.end()) ruleset_failure_domain = parameter->second; - ostringstream ss; - if (parse(profile, &ss)) - derr << ss.str() << dendl; + err |= parse(profile, ss); + if (err) + return err; prepare(); + return err; } // ----------------------------------------------------------------------------- diff --git a/src/erasure-code/isa/ErasureCodeIsa.h b/src/erasure-code/isa/ErasureCodeIsa.h index 44c098e6bf231..764e55a471a77 100644 --- a/src/erasure-code/isa/ErasureCodeIsa.h +++ b/src/erasure-code/isa/ErasureCodeIsa.h @@ -91,7 +91,7 @@ public: const map &chunks, map *decoded); - void init(ErasureCodeProfile &profile); + virtual int init(ErasureCodeProfile &profile, ostream *ss); virtual void isa_encode(char **data, char **coding, diff --git a/src/erasure-code/isa/ErasureCodePluginIsa.cc b/src/erasure-code/isa/ErasureCodePluginIsa.cc index fd3d7b3da8f51..86aff3ae0e48f 100644 --- a/src/erasure-code/isa/ErasureCodePluginIsa.cc +++ b/src/erasure-code/isa/ErasureCodePluginIsa.cc @@ -36,7 +36,8 @@ public: ErasureCodeIsaTableCache tcache; virtual int factory(ErasureCodeProfile &profile, - ErasureCodeInterfaceRef *erasure_code) + ErasureCodeInterfaceRef *erasure_code, + ostream *ss) { ErasureCodeIsa *interface; std::string t = "reed_sol_van"; @@ -50,15 +51,19 @@ public: interface = new ErasureCodeIsaDefault(tcache, ErasureCodeIsaDefault::kCauchy); } else { - derr << "technique=" << t << " is not a valid coding technique. " + *ss << "technique=" << t << " is not a valid coding technique. " << " Choose one of the following: " << "reed_sol_van," - << "cauchy" << dendl; + << "cauchy" << std::endl; return -ENOENT; } } - interface->init(profile); + int r = interface->init(profile, ss); + if (r) { + delete interface; + return r; + } *erasure_code = ErasureCodeInterfaceRef(interface); return 0; } diff --git a/src/erasure-code/jerasure/ErasureCodeJerasure.cc b/src/erasure-code/jerasure/ErasureCodeJerasure.cc index 9804f0e42bbf5..72bd9b30ea37a 100644 --- a/src/erasure-code/jerasure/ErasureCodeJerasure.cc +++ b/src/erasure-code/jerasure/ErasureCodeJerasure.cc @@ -52,8 +52,9 @@ int ErasureCodeJerasure::create_ruleset(const string &name, } } -void ErasureCodeJerasure::init(ErasureCodeProfile& profile) +int ErasureCodeJerasure::init(ErasureCodeProfile& profile, ostream *ss) { + int err = 0; dout(10) << "technique=" << technique << dendl; map::const_iterator parameter; parameter = profile.find("ruleset-root"); @@ -62,10 +63,11 @@ void ErasureCodeJerasure::init(ErasureCodeProfile& profile) parameter = profile.find("ruleset-failure-domain"); if (parameter != profile.end()) ruleset_failure_domain = parameter->second; - ostringstream ss; - if (parse(profile, &ss)) - derr << ss.str() << dendl; + err |= parse(profile, ss); + if (err) + return err; prepare(); + return err; } int ErasureCodeJerasure::parse(ErasureCodeProfile &profile, diff --git a/src/erasure-code/jerasure/ErasureCodeJerasure.h b/src/erasure-code/jerasure/ErasureCodeJerasure.h index 436ff3dcc1be4..8d9bb6a1cb31f 100644 --- a/src/erasure-code/jerasure/ErasureCodeJerasure.h +++ b/src/erasure-code/jerasure/ErasureCodeJerasure.h @@ -71,7 +71,7 @@ public: const map &chunks, map *decoded); - void init(ErasureCodeProfile &profile); + virtual int init(ErasureCodeProfile &profile, ostream *ss); virtual void jerasure_encode(char **data, char **coding, diff --git a/src/erasure-code/jerasure/ErasureCodePluginJerasure.cc b/src/erasure-code/jerasure/ErasureCodePluginJerasure.cc index d461c69ac5190..163b0c247cb98 100644 --- a/src/erasure-code/jerasure/ErasureCodePluginJerasure.cc +++ b/src/erasure-code/jerasure/ErasureCodePluginJerasure.cc @@ -32,7 +32,8 @@ static ostream& _prefix(std::ostream* _dout) class ErasureCodePluginJerasure : public ErasureCodePlugin { public: virtual int factory(ErasureCodeProfile &profile, - ErasureCodeInterfaceRef *erasure_code) { + ErasureCodeInterfaceRef *erasure_code, + ostream *ss) { ErasureCodeJerasure *interface; std::string t; if (profile.find("technique") != profile.end()) @@ -59,7 +60,12 @@ public: << dendl; return -ENOENT; } - interface->init(profile); + dout(20) << __func__ << ": " << profile << dendl; + int r = interface->init(profile, ss); + if (r) { + delete interface; + return r; + } *erasure_code = ErasureCodeInterfaceRef(interface); return 0; } diff --git a/src/erasure-code/jerasure/ErasureCodePluginSelectJerasure.cc b/src/erasure-code/jerasure/ErasureCodePluginSelectJerasure.cc index c072161fe7cad..0ac3132ae3327 100644 --- a/src/erasure-code/jerasure/ErasureCodePluginSelectJerasure.cc +++ b/src/erasure-code/jerasure/ErasureCodePluginSelectJerasure.cc @@ -55,9 +55,9 @@ static string get_variant() { class ErasureCodePluginSelectJerasure : public ErasureCodePlugin { public: virtual int factory(ErasureCodeProfile &profile, - ErasureCodeInterfaceRef *erasure_code) { + ErasureCodeInterfaceRef *erasure_code, + ostream *ss) { ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance(); - stringstream ss; int ret; string name = "jerasure"; if (profile.count("jerasure-name")) @@ -72,8 +72,6 @@ public: dout(10) << variant << " plugin" << dendl; ret = instance.factory(name + "_" + variant, profile, erasure_code, ss); } - if (ret) - derr << ss.str() << dendl; return ret; } }; @@ -87,7 +85,7 @@ int __erasure_code_init(char *plugin_name, char *directory) ErasureCodePlugin *plugin; stringstream ss; int r = instance.load(plugin_name + string("_") + variant, - directory, &plugin, ss); + directory, &plugin, &ss); if (r) { derr << ss.str() << dendl; return r; diff --git a/src/erasure-code/lrc/ErasureCodeLrc.cc b/src/erasure-code/lrc/ErasureCodeLrc.cc index 25d4878c77863..aafc304048482 100644 --- a/src/erasure-code/lrc/ErasureCodeLrc.cc +++ b/src/erasure-code/lrc/ErasureCodeLrc.cc @@ -197,7 +197,7 @@ int ErasureCodeLrc::layers_parse(string description_string, return 0; } -int ErasureCodeLrc::layers_init() +int ErasureCodeLrc::layers_init(ostream *ss) { ErasureCodePluginRegistry ®istry = ErasureCodePluginRegistry::instance(); for (unsigned int i = 0; i < layers.size(); i++) { @@ -217,7 +217,6 @@ int ErasureCodeLrc::layers_init() layer.chunks = layer.data; layer.chunks.insert(layer.chunks.end(), layer.coding.begin(), layer.coding.end()); - stringstream ss; if (layer.profile.find("k") == layer.profile.end()) layer.profile["k"] = stringify(layer.data.size()); if (layer.profile.find("m") == layer.profile.end()) @@ -232,10 +231,8 @@ int ErasureCodeLrc::layers_init() layer.profile, &layer.erasure_code, ss); - if (err) { - derr << ss.str() << dendl; + if (err) return err; - } } return 0; } @@ -505,7 +502,7 @@ int ErasureCodeLrc::init(ErasureCodeProfile &profile, if (r) return r; - r = layers_init(); + r = layers_init(ss); if (r) return r; diff --git a/src/erasure-code/lrc/ErasureCodeLrc.h b/src/erasure-code/lrc/ErasureCodeLrc.h index cd4351b77fe7b..221c1676fd69b 100644 --- a/src/erasure-code/lrc/ErasureCodeLrc.h +++ b/src/erasure-code/lrc/ErasureCodeLrc.h @@ -126,7 +126,7 @@ public: int layers_parse(string description_string, json_spirit::mArray description, ostream *ss); - int layers_init(); + int layers_init(ostream *ss); int layers_sanity_checks(string description_string, ostream *ss) const; }; diff --git a/src/erasure-code/lrc/ErasureCodePluginLrc.cc b/src/erasure-code/lrc/ErasureCodePluginLrc.cc index 8c6d5e779f5fb..0a52c9cedbfec 100644 --- a/src/erasure-code/lrc/ErasureCodePluginLrc.cc +++ b/src/erasure-code/lrc/ErasureCodePluginLrc.cc @@ -27,22 +27,16 @@ #undef dout_prefix #define dout_prefix _prefix(_dout) -static ostream& _prefix(std::ostream* _dout) -{ - return *_dout << "ErasureCodePluginLrc: "; -} - class ErasureCodePluginLrc : public ErasureCodePlugin { public: virtual int factory(ErasureCodeProfile &profile, - ErasureCodeInterfaceRef *erasure_code) { + ErasureCodeInterfaceRef *erasure_code, + ostream *ss) { ErasureCodeLrc *interface; interface = new ErasureCodeLrc(); - stringstream ss; assert(profile.count("directory") != 0); - int r = interface->init(profile, &ss); + int r = interface->init(profile, ss); if (r) { - derr << ss.str() << dendl; delete interface; return r; } diff --git a/src/erasure-code/shec/ErasureCodePluginShec.cc b/src/erasure-code/shec/ErasureCodePluginShec.cc index 407c3241cc477..d581e5d73c4de 100644 --- a/src/erasure-code/shec/ErasureCodePluginShec.cc +++ b/src/erasure-code/shec/ErasureCodePluginShec.cc @@ -38,7 +38,8 @@ public: ErasureCodeShecTableCache tcache; virtual int factory(ErasureCodeProfile &profile, - ErasureCodeInterfaceRef *erasure_code) { + ErasureCodeInterfaceRef *erasure_code, + ostream *ss) { ErasureCodeShec *interface; std::string t = "multiple"; @@ -57,7 +58,7 @@ public: << dendl; return -ENOENT; } - int r = interface->init(profile); + int r = interface->init(profile, ss); if (r) { delete interface; return r; diff --git a/src/erasure-code/shec/ErasureCodeShec.cc b/src/erasure-code/shec/ErasureCodeShec.cc index 17cd9135a1274..4283ce0f705fb 100644 --- a/src/erasure-code/shec/ErasureCodeShec.cc +++ b/src/erasure-code/shec/ErasureCodeShec.cc @@ -54,8 +54,10 @@ int ErasureCodeShec::create_ruleset(const string &name, } } -int ErasureCodeShec::init(ErasureCodeProfile &profile) +int ErasureCodeShec::init(ErasureCodeProfile &profile, + ostream *ss) { + int err = 0; map::const_iterator parameter; parameter = profile.find("ruleset-root"); if (parameter != profile.end()) @@ -63,12 +65,11 @@ int ErasureCodeShec::init(ErasureCodeProfile &profile) parameter = profile.find("ruleset-failure-domain"); if (parameter != profile.end()) ruleset_failure_domain = parameter->second; - int err = parse(profile); - if (err) { + err |= parse(profile); + if (err) return err; - } prepare(); - return 0; + return err; } unsigned int ErasureCodeShec::get_chunk_size(unsigned int object_size) const diff --git a/src/erasure-code/shec/ErasureCodeShec.h b/src/erasure-code/shec/ErasureCodeShec.h index 1cc612cede588..680fd255c4803 100644 --- a/src/erasure-code/shec/ErasureCodeShec.h +++ b/src/erasure-code/shec/ErasureCodeShec.h @@ -102,7 +102,7 @@ public: const map &chunks, map *decoded); - int init(ErasureCodeProfile &profile); + virtual int init(ErasureCodeProfile &profile, ostream *ss); virtual void shec_encode(char **data, char **coding, int blocksize) = 0; diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index cb77fa55be2e6..c3be47e75baa9 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -3900,12 +3900,12 @@ int OSDMonitor::prepare_new_pool(MPoolOp *m) return prepare_new_pool(m->name, m->auid, m->crush_rule, ruleset_name, 0, 0, erasure_code_profile, - pg_pool_t::TYPE_REPLICATED, 0, ss); + pg_pool_t::TYPE_REPLICATED, 0, &ss); else return prepare_new_pool(m->name, session->auid, m->crush_rule, ruleset_name, 0, 0, erasure_code_profile, - pg_pool_t::TYPE_REPLICATED, 0, ss); + pg_pool_t::TYPE_REPLICATED, 0, &ss); } int OSDMonitor::crush_rename_bucket(const string& srcname, @@ -3943,7 +3943,7 @@ int OSDMonitor::crush_rename_bucket(const string& srcname, int OSDMonitor::crush_ruleset_create_erasure(const string &name, const string &profile, int *ruleset, - stringstream &ss) + ostream *ss) { int ruleid = osdmap.crush->get_rule_id(name); if (ruleid != -ENOENT) { @@ -3962,11 +3962,11 @@ int OSDMonitor::crush_ruleset_create_erasure(const string &name, ErasureCodeInterfaceRef erasure_code; int err = get_erasure_code(profile, &erasure_code, ss); if (err) { - ss << "failed to load plugin using profile " << profile << std::endl; + *ss << "failed to load plugin using profile " << profile << std::endl; return err; } - err = erasure_code->create_ruleset(name, newcrush, &ss); + err = erasure_code->create_ruleset(name, newcrush, ss); erasure_code.reset(); if (err < 0) return err; @@ -3979,7 +3979,7 @@ int OSDMonitor::crush_ruleset_create_erasure(const string &name, int OSDMonitor::get_erasure_code(const string &erasure_code_profile, ErasureCodeInterfaceRef *erasure_code, - stringstream &ss) const + ostream *ss) const { if (pending_inc.has_erasure_code_profile(erasure_code_profile)) return -EAGAIN; @@ -3988,7 +3988,7 @@ int OSDMonitor::get_erasure_code(const string &erasure_code_profile, ErasureCodeProfile::const_iterator plugin = profile.find("plugin"); if (plugin == profile.end()) { - ss << "cannot determine the erasure code plugin" + *ss << "cannot determine the erasure code plugin" << " because there is no 'plugin' entry in the erasure_code_profile " << profile << std::endl; return -EINVAL; @@ -4065,29 +4065,29 @@ bool OSDMonitor::validate_crush_against_features(const CrushWrapper *newcrush, bool OSDMonitor::erasure_code_profile_in_use(const map &pools, const string &profile, - ostream &ss) + ostream *ss) { bool found = false; for (map::const_iterator p = pools.begin(); p != pools.end(); ++p) { if (p->second.erasure_code_profile == profile) { - ss << osdmap.pool_name[p->first] << " "; + *ss << osdmap.pool_name[p->first] << " "; found = true; } } if (found) { - ss << "pool(s) are using the erasure code profile '" << profile << "'"; + *ss << "pool(s) are using the erasure code profile '" << profile << "'"; } return found; } int OSDMonitor::parse_erasure_code_profile(const vector &erasure_code_profile, map *erasure_code_profile_map, - stringstream &ss) + ostream *ss) { int r = get_json_str_map(g_conf->osd_pool_default_erasure_code_profile, - ss, + *ss, erasure_code_profile_map); if (r) return r; @@ -4123,7 +4123,7 @@ int OSDMonitor::parse_erasure_code_profile(const vector &erasure_code_pr int OSDMonitor::prepare_pool_size(const unsigned pool_type, const string &erasure_code_profile, unsigned *size, unsigned *min_size, - stringstream &ss) + ostream *ss) { int err = 0; switch (pool_type) { @@ -4142,7 +4142,7 @@ int OSDMonitor::prepare_pool_size(const unsigned pool_type, } break; default: - ss << "prepare_pool_size: " << pool_type << " is not a known pool type"; + *ss << "prepare_pool_size: " << pool_type << " is not a known pool type"; err = -EINVAL; break; } @@ -4152,7 +4152,7 @@ int OSDMonitor::prepare_pool_size(const unsigned pool_type, int OSDMonitor::prepare_pool_stripe_width(const unsigned pool_type, const string &erasure_code_profile, uint32_t *stripe_width, - stringstream &ss) + ostream *ss) { int err = 0; switch (pool_type) { @@ -4170,7 +4170,7 @@ int OSDMonitor::prepare_pool_stripe_width(const unsigned pool_type, } break; default: - ss << "prepare_pool_stripe_width: " + *ss << "prepare_pool_stripe_width: " << pool_type << " is not a known pool type"; err = -EINVAL; break; @@ -4182,7 +4182,7 @@ int OSDMonitor::prepare_pool_crush_ruleset(const unsigned pool_type, const string &erasure_code_profile, const string &ruleset_name, int *crush_ruleset, - stringstream &ss) + ostream *ss) { if (*crush_ruleset < 0) { switch (pool_type) { @@ -4193,7 +4193,7 @@ int OSDMonitor::prepare_pool_crush_ruleset(const unsigned pool_type, *crush_ruleset = osdmap.crush->get_osd_pool_default_crush_replicated_ruleset(g_ceph_context); if (*crush_ruleset < 0) { // Errors may happen e.g. if no valid ruleset is available - ss << "No suitable CRUSH ruleset exists"; + *ss << "No suitable CRUSH ruleset exists"; return *crush_ruleset; } } else { @@ -4222,14 +4222,14 @@ int OSDMonitor::prepare_pool_crush_ruleset(const unsigned pool_type, } break; default: - ss << "prepare_pool_crush_ruleset: " << pool_type + *ss << "prepare_pool_crush_ruleset: " << pool_type << " is not a known pool type"; return -EINVAL; break; } } else { if (!osdmap.crush->ruleset_exists(*crush_ruleset)) { - ss << "CRUSH ruleset " << *crush_ruleset << " not found"; + *ss << "CRUSH ruleset " << *crush_ruleset << " not found"; return -ENOENT; } } @@ -4239,7 +4239,7 @@ int OSDMonitor::prepare_pool_crush_ruleset(const unsigned pool_type, int OSDMonitor::get_crush_ruleset(const string &ruleset_name, int *crush_ruleset, - stringstream &ss) + ostream *ss) { int ret; ret = osdmap.crush->get_rule_id(ruleset_name); @@ -4258,7 +4258,7 @@ int OSDMonitor::get_crush_ruleset(const string &ruleset_name, return -EAGAIN; } else { //Cannot find it , return error - ss << "specified ruleset " << ruleset_name << " doesn't exist"; + *ss << "specified ruleset " << ruleset_name << " doesn't exist"; return ret; } } @@ -4286,7 +4286,7 @@ int OSDMonitor::prepare_new_pool(string& name, uint64_t auid, const string &erasure_code_profile, const unsigned pool_type, const uint64_t expected_num_objects, - stringstream &ss) + ostream *ss) { if (name.length() == 0) return -EINVAL; @@ -4510,7 +4510,7 @@ int OSDMonitor::prepare_command_pool_set(map &cmdmap, ErasureCodeInterfaceRef erasure_code; int k; stringstream tmp; - int err = get_erasure_code(p.erasure_code_profile, &erasure_code, tmp); + int err = get_erasure_code(p.erasure_code_profile, &erasure_code, &tmp); if (err == 0) { k = erasure_code->get_data_chunk_count(); } else { @@ -5399,10 +5399,10 @@ bool OSDMonitor::prepare_command_impl(MMonCommand *m, string name; cmd_getval(g_ceph_context, cmdmap, "name", name); - if (erasure_code_profile_in_use(pending_inc.new_pools, name, ss)) + if (erasure_code_profile_in_use(pending_inc.new_pools, name, &ss)) goto wait; - if (erasure_code_profile_in_use(osdmap.pools, name, ss)) { + if (erasure_code_profile_in_use(osdmap.pools, name, &ss)) { err = -EBUSY; goto reply; } @@ -5439,7 +5439,7 @@ bool OSDMonitor::prepare_command_impl(MMonCommand *m, force = false; } map profile_map; - err = parse_erasure_code_profile(profile, &profile_map, ss); + err = parse_erasure_code_profile(profile, &profile_map, &ss); if (err) goto reply; if (profile_map.find("plugin") == profile_map.end()) { @@ -5523,7 +5523,7 @@ bool OSDMonitor::prepare_command_impl(MMonCommand *m, } int ruleset; - err = crush_ruleset_create_erasure(name, profile, &ruleset, ss); + err = crush_ruleset_create_erasure(name, profile, &ruleset, &ss); if (err < 0) { switch(err) { case -EEXIST: // return immediately @@ -6297,7 +6297,7 @@ done: if (!implicit_ruleset_creation && ruleset_name != "") { int ruleset; - err = get_crush_ruleset(ruleset_name, &ruleset, ss); + err = get_crush_ruleset(ruleset_name, &ruleset, &ss); if (err == -EAGAIN) { wait_for_finished_proposal(new C_RetryMessage(this, m)); return true; @@ -6319,7 +6319,7 @@ done: pg_num, pgp_num, erasure_code_profile, pool_type, (uint64_t)expected_num_objects, - ss); + &ss); if (err < 0) { switch(err) { case -EEXIST: diff --git a/src/mon/OSDMonitor.h b/src/mon/OSDMonitor.h index 41cd805a7e2d4..bd533c9eb8ecf 100644 --- a/src/mon/OSDMonitor.h +++ b/src/mon/OSDMonitor.h @@ -280,32 +280,32 @@ private: int crush_ruleset_create_erasure(const string &name, const string &profile, int *ruleset, - stringstream &ss); + ostream *ss); int get_crush_ruleset(const string &ruleset_name, int *crush_ruleset, - stringstream &ss); + ostream *ss); int get_erasure_code(const string &erasure_code_profile, ErasureCodeInterfaceRef *erasure_code, - stringstream &ss) const; + ostream *ss) const; int prepare_pool_crush_ruleset(const unsigned pool_type, const string &erasure_code_profile, const string &ruleset_name, int *crush_ruleset, - stringstream &ss); + ostream *ss); bool erasure_code_profile_in_use(const map &pools, const string &profile, - ostream &ss); + ostream *ss); int parse_erasure_code_profile(const vector &erasure_code_profile, map *erasure_code_profile_map, - stringstream &ss); + ostream *ss); int prepare_pool_size(const unsigned pool_type, const string &erasure_code_profile, unsigned *size, unsigned *min_size, - stringstream &ss); + ostream *ss); int prepare_pool_stripe_width(const unsigned pool_type, const string &erasure_code_profile, unsigned *stripe_width, - stringstream &ss); + ostream *ss); int prepare_new_pool(string& name, uint64_t auid, int crush_ruleset, const string &crush_ruleset_name, @@ -313,7 +313,7 @@ private: const string &erasure_code_profile, const unsigned pool_type, const uint64_t expected_num_objects, - stringstream &ss); + ostream *ss); int prepare_new_pool(MPoolOp *m); void update_pool_flags(int64_t pool_id, uint64_t flags); diff --git a/src/osd/PGBackend.cc b/src/osd/PGBackend.cc index 5de764ff4e17e..dd25f7209a201 100644 --- a/src/osd/PGBackend.cc +++ b/src/osd/PGBackend.cc @@ -299,7 +299,7 @@ PGBackend *PGBackend::build_pg_backend( profile.find("plugin")->second, profile, &ec_impl, - ss); + &ss); assert(ec_impl); return new ECBackend( l, diff --git a/src/test/erasure-code/ErasureCodeExample.h b/src/test/erasure-code/ErasureCodeExample.h index dce35d18e557f..c45d7f78d9a5b 100644 --- a/src/test/erasure-code/ErasureCodeExample.h +++ b/src/test/erasure-code/ErasureCodeExample.h @@ -39,6 +39,10 @@ class ErasureCodeExample : public ErasureCode { public: virtual ~ErasureCodeExample() {} + virtual int init(ErasureCodeProfile &profile, ostream *ss) { + return 0; + } + virtual int create_ruleset(const string &name, CrushWrapper &crush, ostream *ss) const { diff --git a/src/test/erasure-code/ErasureCodePluginExample.cc b/src/test/erasure-code/ErasureCodePluginExample.cc index c3fb2c99b8df6..96e4c462b2134 100644 --- a/src/test/erasure-code/ErasureCodePluginExample.cc +++ b/src/test/erasure-code/ErasureCodePluginExample.cc @@ -24,7 +24,8 @@ class ErasureCodePluginExample : public ErasureCodePlugin { public: virtual int factory(ErasureCodeProfile &profile, - ErasureCodeInterfaceRef *erasure_code) + ErasureCodeInterfaceRef *erasure_code, + ostream *ss) { *erasure_code = ErasureCodeInterfaceRef(new ErasureCodeExample()); return 0; diff --git a/src/test/erasure-code/TestErasureCode.cc b/src/test/erasure-code/TestErasureCode.cc index 2c972610fc7a8..d6f98a92a1ff6 100644 --- a/src/test/erasure-code/TestErasureCode.cc +++ b/src/test/erasure-code/TestErasureCode.cc @@ -33,6 +33,10 @@ public: k(_k), m(_m), chunk_size(_chunk_size) {} virtual ~ErasureCodeTest() {} + virtual int init(ErasureCodeProfile &profile, ostream *ss) { + return 0; + } + virtual unsigned int get_chunk_count() const { return k + m; } virtual unsigned int get_data_chunk_count() const { return k; } virtual unsigned int get_chunk_size(unsigned int object_size) const { diff --git a/src/test/erasure-code/TestErasureCodeIsa.cc b/src/test/erasure-code/TestErasureCodeIsa.cc index 816ef58f4452f..ce2b056da4689 100644 --- a/src/test/erasure-code/TestErasureCodeIsa.cc +++ b/src/test/erasure-code/TestErasureCodeIsa.cc @@ -53,7 +53,7 @@ void IsaErasureCodeTest::encode_decode(unsigned object_size) ErasureCodeProfile profile; profile["k"] = "2"; profile["m"] = "2"; - Isa.init(profile); + Isa.init(profile, &cerr); string payload(object_size, 'X'); bufferlist in; @@ -193,7 +193,7 @@ TEST_F(IsaErasureCodeTest, minimum_to_decode) ErasureCodeProfile profile; profile["k"] = "2"; profile["m"] = "2"; - Isa.init(profile); + Isa.init(profile, &cerr); // // If trying to read nothing, the minimum is empty. @@ -290,7 +290,7 @@ TEST_F(IsaErasureCodeTest, chunk_size) ErasureCodeProfile profile; profile["k"] = "2"; profile["m"] = "1"; - Isa.init(profile); + Isa.init(profile, &cerr); int k = 2; ASSERT_EQ(EC_ISA_ADDRESS_ALIGNMENT, Isa.get_chunk_size(1)); @@ -302,7 +302,7 @@ TEST_F(IsaErasureCodeTest, chunk_size) ErasureCodeProfile profile; profile["k"] = "3"; profile["m"] = "1"; - Isa.init(profile); + Isa.init(profile, &cerr); int k = 3; ASSERT_EQ(EC_ISA_ADDRESS_ALIGNMENT, Isa.get_chunk_size(1)); @@ -323,7 +323,7 @@ TEST_F(IsaErasureCodeTest, encode) ErasureCodeProfile profile; profile["k"] = "2"; profile["m"] = "2"; - Isa.init(profile); + Isa.init(profile, &cerr); unsigned aligned_object_size = Isa.get_alignment() * 2; { @@ -394,7 +394,7 @@ TEST_F(IsaErasureCodeTest, isa_vandermonde_exhaustive) ErasureCodeProfile profile; profile["k"] = "12"; profile["m"] = "4"; - Isa.init(profile); + Isa.init(profile, &cerr); int k = 12; int m = 4; @@ -521,7 +521,7 @@ TEST_F(IsaErasureCodeTest, isa_cauchy_exhaustive) profile["m"] = "4"; profile["technique"] = "cauchy"; - Isa.init(profile); + Isa.init(profile, &cerr); int k = 12; int m = 4; @@ -648,7 +648,7 @@ TEST_F(IsaErasureCodeTest, isa_cauchy_cache_trash) profile["m"] = "4"; profile["technique"] = "cauchy"; - Isa.init(profile); + Isa.init(profile, &cerr); int k = 16; int m = 4; @@ -774,7 +774,7 @@ TEST_F(IsaErasureCodeTest, isa_xor_codec) ErasureCodeProfile profile; profile["k"] = "4"; profile["m"] = "1"; - Isa.init(profile); + Isa.init(profile, &cerr); int k = 4; int m = 1; @@ -899,7 +899,7 @@ TEST_F(IsaErasureCodeTest, create_ruleset) profile["k"] = "2"; profile["m"] = "2"; profile["w"] = "8"; - isa.init(profile); + isa.init(profile, &cerr); int ruleset = isa.create_ruleset("myrule", *c, &ss); EXPECT_EQ(0, ruleset); EXPECT_EQ(-EEXIST, isa.create_ruleset("myrule", *c, &ss)); @@ -924,7 +924,7 @@ TEST_F(IsaErasureCodeTest, create_ruleset) profile["m"] = "2"; profile["w"] = "8"; profile["ruleset-root"] = "BAD"; - isa.init(profile); + isa.init(profile, &cerr); EXPECT_EQ(-ENOENT, isa.create_ruleset("otherrule", *c, &ss)); EXPECT_EQ("root item BAD does not exist", ss.str()); } @@ -936,7 +936,7 @@ TEST_F(IsaErasureCodeTest, create_ruleset) profile["m"] = "2"; profile["w"] = "8"; profile["ruleset-failure-domain"] = "WORSE"; - isa.init(profile); + isa.init(profile, &cerr); EXPECT_EQ(-EINVAL, isa.create_ruleset("otherrule", *c, &ss)); EXPECT_EQ("unknown type WORSE", ss.str()); } diff --git a/src/test/erasure-code/TestErasureCodeJerasure.cc b/src/test/erasure-code/TestErasureCodeJerasure.cc index 1eca4909de52b..4cccb5c3f3087 100644 --- a/src/test/erasure-code/TestErasureCodeJerasure.cc +++ b/src/test/erasure-code/TestErasureCodeJerasure.cc @@ -54,7 +54,7 @@ TYPED_TEST(ErasureCodeTest, encode_decode) profile["packetsize"] = "8"; profile["jerasure-per-chunk-alignment"] = per_chunk_alignments[per_chunk_alignment]; - jerasure.init(profile); + jerasure.init(profile, &cerr); #define LARGE_ENOUGH 2048 bufferptr in_ptr(buffer::create_page_aligned(LARGE_ENOUGH)); @@ -124,7 +124,7 @@ TYPED_TEST(ErasureCodeTest, minimum_to_decode) profile["m"] = "2"; profile["w"] = "7"; profile["packetsize"] = "8"; - jerasure.init(profile); + jerasure.init(profile, &cerr); // // If trying to read nothing, the minimum is empty. @@ -221,7 +221,7 @@ TEST(ErasureCodeTest, encode) profile["k"] = "2"; profile["m"] = "2"; profile["w"] = "8"; - jerasure.init(profile); + jerasure.init(profile, &cerr); unsigned aligned_object_size = jerasure.get_alignment() * 2; { @@ -300,7 +300,7 @@ TEST(ErasureCodeTest, create_ruleset) profile["k"] = "2"; profile["m"] = "2"; profile["w"] = "8"; - jerasure.init(profile); + jerasure.init(profile, &cerr); int ruleset = jerasure.create_ruleset("myrule", *c, &ss); EXPECT_EQ(0, ruleset); EXPECT_EQ(-EEXIST, jerasure.create_ruleset("myrule", *c, &ss)); @@ -325,7 +325,7 @@ TEST(ErasureCodeTest, create_ruleset) profile["m"] = "2"; profile["w"] = "8"; profile["ruleset-root"] = "BAD"; - jerasure.init(profile); + jerasure.init(profile, &cerr); EXPECT_EQ(-ENOENT, jerasure.create_ruleset("otherrule", *c, &ss)); EXPECT_EQ("root item BAD does not exist", ss.str()); } @@ -337,7 +337,7 @@ TEST(ErasureCodeTest, create_ruleset) profile["m"] = "2"; profile["w"] = "8"; profile["ruleset-failure-domain"] = "WORSE"; - jerasure.init(profile); + jerasure.init(profile, &cerr); EXPECT_EQ(-EINVAL, jerasure.create_ruleset("otherrule", *c, &ss)); EXPECT_EQ("unknown type WORSE", ss.str()); } diff --git a/src/test/erasure-code/TestErasureCodeLrc.cc b/src/test/erasure-code/TestErasureCodeLrc.cc index c03195950e820..2d44a1e952e77 100644 --- a/src/test/erasure-code/TestErasureCodeLrc.cc +++ b/src/test/erasure-code/TestErasureCodeLrc.cc @@ -411,7 +411,7 @@ TEST(ErasureCodeLrc, layers_init) json_spirit::mArray description; EXPECT_EQ(0, lrc.layers_description(profile, &description, &cerr)); EXPECT_EQ(0, lrc.layers_parse(description_string, description, &cerr)); - EXPECT_EQ(0, lrc.layers_init()); + EXPECT_EQ(0, lrc.layers_init(&cerr)); EXPECT_EQ("5", lrc.layers.front().profile["k"]); EXPECT_EQ("2", lrc.layers.front().profile["m"]); EXPECT_EQ("jerasure", lrc.layers.front().profile["plugin"]); diff --git a/src/test/erasure-code/TestErasureCodePlugin.cc b/src/test/erasure-code/TestErasureCodePlugin.cc index 314f44f0c93e7..e8c594fc8e6f7 100644 --- a/src/test/erasure-code/TestErasureCodePlugin.cc +++ b/src/test/erasure-code/TestErasureCodePlugin.cc @@ -34,8 +34,7 @@ protected: profile["directory"] = ".libs"; ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance(); ErasureCodeInterfaceRef erasure_code; - stringstream ss; - instance.factory("hangs", profile, &erasure_code, ss); + instance.factory("hangs", profile, &erasure_code, &cerr); return NULL; } }; @@ -77,31 +76,30 @@ TEST_F(ErasureCodePluginRegistryTest, all) profile["directory"] = directory; ErasureCodeInterfaceRef erasure_code; ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance(); - stringstream ss; EXPECT_FALSE(erasure_code); - EXPECT_EQ(-EIO, instance.factory("invalid", profile, &erasure_code, ss)); + EXPECT_EQ(-EIO, instance.factory("invalid", profile, &erasure_code, &cerr)); EXPECT_FALSE(erasure_code); EXPECT_EQ(-EXDEV, instance.factory("missing_version", profile, - &erasure_code, ss)); + &erasure_code, &cerr)); EXPECT_FALSE(erasure_code); EXPECT_EQ(-ENOENT, instance.factory("missing_entry_point", profile, - &erasure_code, ss)); + &erasure_code, &cerr)); EXPECT_FALSE(erasure_code); EXPECT_EQ(-ESRCH, instance.factory("fail_to_initialize", profile, - &erasure_code, ss)); + &erasure_code, &cerr)); EXPECT_FALSE(erasure_code); EXPECT_EQ(-EBADF, instance.factory("fail_to_register", profile, - &erasure_code, ss)); + &erasure_code, &cerr)); EXPECT_FALSE(erasure_code); - EXPECT_EQ(0, instance.factory("example", profile, &erasure_code, ss)); + EXPECT_EQ(0, instance.factory("example", profile, &erasure_code, &cerr)); EXPECT_TRUE(erasure_code); ErasureCodePlugin *plugin = 0; { Mutex::Locker l(instance.lock); - EXPECT_EQ(-EEXIST, instance.load("example", directory, &plugin, ss)); + EXPECT_EQ(-EEXIST, instance.load("example", directory, &plugin, &cerr)); EXPECT_EQ(-ENOENT, instance.remove("does not exist")); EXPECT_EQ(0, instance.remove("example")); - EXPECT_EQ(0, instance.load("example", directory, &plugin, ss)); + EXPECT_EQ(0, instance.load("example", directory, &plugin, &cerr)); } } diff --git a/src/test/erasure-code/TestErasureCodePluginIsa.cc b/src/test/erasure-code/TestErasureCodePluginIsa.cc index 59d918abc64d6..e730b40015414 100644 --- a/src/test/erasure-code/TestErasureCodePluginIsa.cc +++ b/src/test/erasure-code/TestErasureCodePluginIsa.cc @@ -30,7 +30,7 @@ TEST(ErasureCodePlugin, factory) ErasureCodeInterfaceRef erasure_code; EXPECT_FALSE(erasure_code); EXPECT_EQ(-EIO, instance.factory("no-isa", profile, - &erasure_code, cerr)); + &erasure_code, &cerr)); EXPECT_FALSE(erasure_code); } const char *techniques[] = { @@ -42,7 +42,7 @@ TEST(ErasureCodePlugin, factory) profile["technique"] = *technique; EXPECT_FALSE(erasure_code); EXPECT_EQ(0, instance.factory("isa", profile, - &erasure_code, cerr)); + &erasure_code, &cerr)); EXPECT_TRUE(erasure_code); } } diff --git a/src/test/erasure-code/TestErasureCodePluginJerasure.cc b/src/test/erasure-code/TestErasureCodePluginJerasure.cc index 31b250f65297c..ad456c0235f9a 100644 --- a/src/test/erasure-code/TestErasureCodePluginJerasure.cc +++ b/src/test/erasure-code/TestErasureCodePluginJerasure.cc @@ -34,7 +34,7 @@ TEST(ErasureCodePlugin, factory) ErasureCodeInterfaceRef erasure_code; EXPECT_FALSE(erasure_code); EXPECT_EQ(-ENOENT, instance.factory("jerasure", profile, - &erasure_code, cerr)); + &erasure_code, &cerr)); EXPECT_FALSE(erasure_code); } const char *techniques[] = { @@ -54,7 +54,7 @@ TEST(ErasureCodePlugin, factory) profile["technique"] = *technique; EXPECT_FALSE(erasure_code); EXPECT_EQ(0, instance.factory("jerasure", profile, - &erasure_code, cerr)); + &erasure_code, &cerr)); EXPECT_TRUE(erasure_code); } } @@ -92,7 +92,7 @@ TEST(ErasureCodePlugin, select) ErasureCodeInterfaceRef erasure_code; int sse4_side_effect = -444; EXPECT_EQ(sse4_side_effect, instance.factory("jerasure", profile, - &erasure_code, cerr)); + &erasure_code, &cerr)); } // pclmul is missing, load the SSE3 plugin { @@ -107,7 +107,7 @@ TEST(ErasureCodePlugin, select) ErasureCodeInterfaceRef erasure_code; int sse3_side_effect = -333; EXPECT_EQ(sse3_side_effect, instance.factory("jerasure", profile, - &erasure_code, cerr)); + &erasure_code, &cerr)); } // pclmul and sse3 are missing, load the generic plugin { @@ -122,7 +122,7 @@ TEST(ErasureCodePlugin, select) ErasureCodeInterfaceRef erasure_code; int generic_side_effect = -111; EXPECT_EQ(generic_side_effect, instance.factory("jerasure", profile, - &erasure_code, cerr)); + &erasure_code, &cerr)); } // neon is set, load the neon plugin { @@ -137,7 +137,7 @@ TEST(ErasureCodePlugin, select) ErasureCodeInterfaceRef erasure_code; int generic_side_effect = -555; EXPECT_EQ(generic_side_effect, instance.factory("jerasure", profile, - &erasure_code, cerr)); + &erasure_code, &cerr)); } @@ -200,7 +200,7 @@ TEST(ErasureCodePlugin, sse) ErasureCodeInterfaceRef erasure_code; EXPECT_FALSE(erasure_code); EXPECT_EQ(0, instance.factory("jerasure_" + *sse_variant, profile, - &erasure_code, cerr)); + &erasure_code, &cerr)); EXPECT_TRUE(erasure_code); // diff --git a/src/test/erasure-code/TestErasureCodePluginLrc.cc b/src/test/erasure-code/TestErasureCodePluginLrc.cc index 165e21511c542..fea576c546082 100644 --- a/src/test/erasure-code/TestErasureCodePluginLrc.cc +++ b/src/test/erasure-code/TestErasureCodePluginLrc.cc @@ -33,7 +33,7 @@ TEST(ErasureCodePlugin, factory) profile["layers"] = "[ [ \"DDc\", \"\" ] ]"; ErasureCodeInterfaceRef erasure_code; EXPECT_FALSE(erasure_code); - EXPECT_EQ(0, instance.factory("lrc", profile, &erasure_code, cerr)); + EXPECT_EQ(0, instance.factory("lrc", profile, &erasure_code, &cerr)); EXPECT_TRUE(erasure_code); } diff --git a/src/test/erasure-code/TestErasureCodeShec.cc b/src/test/erasure-code/TestErasureCodeShec.cc index 472f001067f98..f0d63cb5112f5 100644 --- a/src/test/erasure-code/TestErasureCodeShec.cc +++ b/src/test/erasure-code/TestErasureCodeShec.cc @@ -56,7 +56,7 @@ TEST(ErasureCodeShec, init_1) (*profile)["m"] = "4"; (*profile)["c"] = "3"; - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_EQ(6, shec->k); EXPECT_EQ(4, shec->m); @@ -89,7 +89,7 @@ TEST(ErasureCodeShec, init_2) (*profile)["c"] = "3"; (*profile)["w"] = "8"; - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); //check profile EXPECT_EQ(6, shec->k); @@ -122,7 +122,7 @@ TEST(ErasureCodeShec, init_3) (*profile)["c"] = "3"; (*profile)["w"] = "16"; - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); //check profile EXPECT_EQ(6, shec->k); @@ -155,7 +155,7 @@ TEST(ErasureCodeShec, init_4) (*profile)["c"] = "3"; (*profile)["w"] = "32"; - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); //check profile EXPECT_EQ(6, shec->k); @@ -186,7 +186,7 @@ TEST(ErasureCodeShec, init_5) (*profile)["m"] = "4"; (*profile)["c"] = "3"; - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_TRUE(shec->matrix != NULL); EXPECT_EQ(0, r); @@ -209,7 +209,7 @@ TEST(ErasureCodeShec, init_6) (*profile)["m"] = "4"; (*profile)["c"] = "3"; - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_TRUE(shec->matrix != NULL); EXPECT_EQ(0, r); @@ -232,7 +232,7 @@ TEST(ErasureCodeShec, init_7) (*profile)["m"] = "4"; (*profile)["c"] = "3"; - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_TRUE(shec->matrix != NULL); EXPECT_EQ(0, r); @@ -256,7 +256,7 @@ TEST(ErasureCodeShec, init_8) (*profile)["m"] = "4"; (*profile)["c"] = "3"; - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_TRUE(shec->matrix != NULL); EXPECT_EQ(0, r); @@ -280,7 +280,7 @@ TEST(ErasureCodeShec, init_9) (*profile)["m"] = "4"; (*profile)["c"] = "3"; - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_TRUE(shec->matrix != NULL); EXPECT_EQ(0, r); @@ -303,7 +303,7 @@ TEST(ErasureCodeShec, init_10) (*profile)["m"] = "4"; (*profile)["c"] = "3"; - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_TRUE(shec->matrix != NULL); EXPECT_EQ(0, r); @@ -326,7 +326,7 @@ TEST(ErasureCodeShec, init_11) (*profile)["m"] = "4"; (*profile)["c"] = "3"; - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_TRUE(shec->matrix != NULL); EXPECT_EQ(0, r); @@ -349,7 +349,7 @@ TEST(ErasureCodeShec, init_12) (*profile)["m"] = "4"; (*profile)["c"] = "3"; - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_EQ(-EINVAL, r); @@ -371,7 +371,7 @@ TEST(ErasureCodeShec, init_13) (*profile)["m"] = "4"; (*profile)["c"] = "3"; - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_EQ(-EINVAL, r); @@ -393,7 +393,7 @@ TEST(ErasureCodeShec, init_14) (*profile)["m"] = "4"; (*profile)["c"] = "3"; - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_EQ(-EINVAL, r); @@ -415,7 +415,7 @@ TEST(ErasureCodeShec, init_15) (*profile)["m"] = "4"; (*profile)["c"] = "3"; - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_EQ(-EINVAL, r); @@ -437,7 +437,7 @@ TEST(ErasureCodeShec, init_16) (*profile)["m"] = "-1"; //unexpected value (*profile)["c"] = "3"; - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_EQ(-EINVAL, r); @@ -459,7 +459,7 @@ TEST(ErasureCodeShec, init_17) (*profile)["m"] = "0.1"; //unexpected value (*profile)["c"] = "3"; - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_EQ(-EINVAL, r); @@ -481,7 +481,7 @@ TEST(ErasureCodeShec, init_18) (*profile)["m"] = "a"; //unexpected value (*profile)["c"] = "3"; - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_EQ(-EINVAL, r); @@ -503,7 +503,7 @@ TEST(ErasureCodeShec, init_19) //m is not specified (*profile)["c"] = "3"; - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_EQ(-EINVAL, r); @@ -525,7 +525,7 @@ TEST(ErasureCodeShec, init_20) (*profile)["m"] = "4"; (*profile)["c"] = "-1"; //unexpected value - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_EQ(-EINVAL, r); @@ -547,7 +547,7 @@ TEST(ErasureCodeShec, init_21) (*profile)["m"] = "4"; (*profile)["c"] = "0.1"; //unexpected value - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_EQ(-EINVAL, r); @@ -569,7 +569,7 @@ TEST(ErasureCodeShec, init_22) (*profile)["m"] = "4"; (*profile)["c"] = "a"; //unexpected value - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_EQ(-EINVAL, r); @@ -591,7 +591,7 @@ TEST(ErasureCodeShec, init_23) (*profile)["m"] = "4"; //c is not specified - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_EQ(-EINVAL, r); @@ -614,7 +614,7 @@ TEST(ErasureCodeShec, init_24) (*profile)["c"] = "3"; (*profile)["w"] = "1"; //unexpected value - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_TRUE(shec->matrix != NULL); EXPECT_EQ(0, r); @@ -643,7 +643,7 @@ TEST(ErasureCodeShec, init_25) (*profile)["c"] = "3"; (*profile)["w"] = "-1"; //unexpected value - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_TRUE(shec->matrix != NULL); EXPECT_EQ(0, r); @@ -672,7 +672,7 @@ TEST(ErasureCodeShec, init_26) (*profile)["c"] = "3"; (*profile)["w"] = "0.1"; //unexpected value - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_TRUE(shec->matrix != NULL); EXPECT_EQ(0, r); @@ -701,7 +701,7 @@ TEST(ErasureCodeShec, init_27) (*profile)["c"] = "3"; (*profile)["w"] = "a"; //unexpected value - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_TRUE(shec->matrix != NULL); EXPECT_EQ(0, r); @@ -729,7 +729,7 @@ TEST(ErasureCodeShec, init_28) (*profile)["m"] = "4"; (*profile)["c"] = "10"; //c > m - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_EQ(-EINVAL, r); @@ -751,7 +751,7 @@ TEST(ErasureCodeShec, init_29) //m is not specified //c is not specified - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_TRUE(shec->matrix != NULL); EXPECT_EQ(0, r); @@ -778,7 +778,7 @@ TEST(ErasureCodeShec, init_30) (*profile)["m"] = "8"; (*profile)["c"] = "8"; - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_TRUE(shec->matrix != NULL); EXPECT_EQ(0, r); @@ -804,7 +804,7 @@ TEST(ErasureCodeShec, init_31) (*profile)["m"] = "7"; (*profile)["c"] = "7"; - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_EQ(-EINVAL, r); @@ -826,7 +826,7 @@ TEST(ErasureCodeShec, init_32) (*profile)["m"] = "13"; (*profile)["c"] = "13"; - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_EQ(-EINVAL, r); @@ -848,7 +848,7 @@ TEST(ErasureCodeShec, init_33) (*profile)["m"] = "9"; (*profile)["c"] = "8"; - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_EQ(-EINVAL, r); @@ -870,7 +870,7 @@ TEST(ErasureCodeShec, init_34) (*profile)["m"] = "12"; (*profile)["c"] = "12"; - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); EXPECT_EQ(-EINVAL, r); @@ -892,8 +892,8 @@ TEST(ErasureCodeShec, init2_4) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); - int r = shec->init(*profile); //init executed twice + shec->init(*profile, &cerr); + int r = shec->init(*profile, &cerr); //init executed twice //check profile EXPECT_EQ(6, shec->k); @@ -927,7 +927,7 @@ TEST(ErasureCodeShec, init2_5) (*profile)["c"] = "5"; (*profile)["w"] = "16"; - int r = shec->init(*profile); + int r = shec->init(*profile, &cerr); //reexecute init (*profile2)["plugin"] = "shec"; @@ -936,7 +936,7 @@ TEST(ErasureCodeShec, init2_5) (*profile2)["k"] = "6"; (*profile2)["m"] = "4"; (*profile2)["c"] = "3"; - shec->init(*profile2); + shec->init(*profile2, &cerr); EXPECT_EQ(6, shec->k); EXPECT_EQ(4, shec->m); @@ -966,7 +966,7 @@ TEST(ErasureCodeShec, minimum_to_decode_1) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //minimum_to_decode set want_to_decode; @@ -1002,7 +1002,7 @@ TEST(ErasureCodeShec, minimum_to_decode_2) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //minimum_to_decode set want_to_decode; @@ -1038,7 +1038,7 @@ TEST(ErasureCodeShec, minimum_to_decode_3) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //minimum_to_decode set want_to_decode; @@ -1073,7 +1073,7 @@ TEST(ErasureCodeShec, minimum_to_decode_4) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //minimum_to_decode set want_to_decode; @@ -1109,7 +1109,7 @@ TEST(ErasureCodeShec, minimum_to_decode_5) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //minimum_to_decode set want_to_decode; @@ -1145,7 +1145,7 @@ TEST(ErasureCodeShec, minimum_to_decode_6) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //minimum_to_decode set want_to_decode; @@ -1180,7 +1180,7 @@ TEST(ErasureCodeShec, minimum_to_decode_7) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //minimum_to_decode set want_to_decode; @@ -1216,7 +1216,7 @@ TEST(ErasureCodeShec, minimum_to_decode_8) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //minimum_to_decode set want_to_decode; @@ -1249,7 +1249,7 @@ TEST(ErasureCodeShec, minimum_to_decode_9) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //minimum_to_decode set want_to_decode; @@ -1290,7 +1290,7 @@ TEST(ErasureCodeShec, minimum_to_decode2_1) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //minimum_to_decode set want_to_decode; @@ -1326,7 +1326,7 @@ TEST(ErasureCodeShec, minimum_to_decode2_3) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //minimum_to_decode set want_to_decode; @@ -1375,7 +1375,7 @@ TEST(ErasureCodeShec, minimum_to_decode_with_cost_1) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //minimum_to_decode_with_cost set want_to_decode; @@ -1411,7 +1411,7 @@ TEST(ErasureCodeShec, minimum_to_decode_with_cost_2_3) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //minimum_to_decode_with_cost set want_to_decode; @@ -1460,7 +1460,7 @@ TEST(ErasureCodeShec, encode_1) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //encode bufferlist in; @@ -1522,7 +1522,7 @@ TEST(ErasureCodeShec, encode_2) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //encode bufferlist in; @@ -1579,7 +1579,7 @@ TEST(ErasureCodeShec, encode_3) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); bufferlist in; in.append("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"//length = 62 @@ -1637,7 +1637,7 @@ TEST(ErasureCodeShec, encode_4) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //encode bufferlist in; @@ -1697,7 +1697,7 @@ TEST(ErasureCodeShec, encode_8) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //encode bufferlist in; @@ -1732,7 +1732,7 @@ TEST(ErasureCodeShec, encode_9) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //encode bufferlist in; @@ -1771,7 +1771,7 @@ TEST(ErasureCodeShec, encode2_1) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //encode bufferlist in; @@ -1831,7 +1831,7 @@ TEST(ErasureCodeShec, encode2_3) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //encode bufferlist in; @@ -1903,7 +1903,7 @@ TEST(ErasureCodeShec, decode_1) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //encode bufferlist in; @@ -1958,7 +1958,7 @@ TEST(ErasureCodeShec, decode_2) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //encode bufferlist in; @@ -2013,7 +2013,7 @@ TEST(ErasureCodeShec, decode_3) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //encode bufferlist in; @@ -2075,7 +2075,7 @@ TEST(ErasureCodeShec, decode_4) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //encode bufferlist in; @@ -2137,7 +2137,7 @@ TEST(ErasureCodeShec, decode_7) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //encode bufferlist in; @@ -2204,7 +2204,7 @@ TEST(ErasureCodeShec, decode_8) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //encode bufferlist in; @@ -2252,7 +2252,7 @@ TEST(ErasureCodeShec, decode_9) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //encode bufferlist in; @@ -2307,7 +2307,7 @@ TEST(ErasureCodeShec, decode2_1) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //encode bufferlist in; @@ -2363,7 +2363,7 @@ TEST(ErasureCodeShec, decode2_3) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //encode bufferlist in; @@ -2430,7 +2430,7 @@ TEST(ErasureCodeShec, decode2_4) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //encode bufferlist in; @@ -2508,7 +2508,7 @@ TEST(ErasureCodeShec, create_ruleset_1_2) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //create_ruleset stringstream ss; @@ -2566,7 +2566,7 @@ TEST(ErasureCodeShec, create_ruleset_4) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //create_ruleset int r = shec->create_ruleset("myrule", *crush, NULL); //ss = NULL @@ -2617,7 +2617,7 @@ TEST(ErasureCodeShec, create_ruleset2_1) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //create_ruleset stringstream ss; @@ -2676,7 +2676,7 @@ TEST(ErasureCodeShec, create_ruleset2_3) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //create_ruleset stringstream ss; @@ -2714,7 +2714,7 @@ TEST(ErasureCodeShec, get_chunk_count_1) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //get_chunk_count EXPECT_EQ(10u, shec->get_chunk_count()); @@ -2737,7 +2737,7 @@ TEST(ErasureCodeShec, get_data_chunk_count_1) (*profile)["k"] = "6"; (*profile)["m"] = "4"; (*profile)["c"] = "3"; - shec->init(*profile); + shec->init(*profile, &cerr); //get_data_chunk_count EXPECT_EQ(6u, shec->get_data_chunk_count()); @@ -2761,7 +2761,7 @@ TEST(ErasureCodeShec, get_chunk_size_1_2) (*profile)["m"] = "4"; (*profile)["c"] = "3"; (*profile)["w"] = "8"; - shec->init(*profile); + shec->init(*profile, &cerr); //when there is no padding(192=k*w*4) EXPECT_EQ(32u, shec->get_chunk_size(192)); diff --git a/src/test/erasure-code/TestErasureCodeShec_all.cc b/src/test/erasure-code/TestErasureCodeShec_all.cc index 6a26b2f40eda0..00e59e7d6a634 100644 --- a/src/test/erasure-code/TestErasureCodeShec_all.cc +++ b/src/test/erasure-code/TestErasureCodeShec_all.cc @@ -82,7 +82,7 @@ TEST_P(ParameterTest, parameter_all) (*profile)["m"] = m; (*profile)["c"] = c; - result = shec->init(*profile); + result = shec->init(*profile, &cerr); //check profile EXPECT_EQ(i_k, shec->k); diff --git a/src/test/erasure-code/TestErasureCodeShec_thread.cc b/src/test/erasure-code/TestErasureCodeShec_thread.cc index 3470a6397b48c..97846f5ccdbb8 100644 --- a/src/test/erasure-code/TestErasureCodeShec_thread.cc +++ b/src/test/erasure-code/TestErasureCodeShec_thread.cc @@ -147,7 +147,7 @@ void* thread1(void* pParam) (*profile)["m"] = param->m; (*profile)["c"] = param->c; (*profile)["w"] = param->w; - r = shec->init(*profile); + r = shec->init(*profile, &cerr); int i_k = std::atoi(param->k.c_str()); int i_m = std::atoi(param->m.c_str()); diff --git a/src/test/erasure-code/ceph_erasure_code.cc b/src/test/erasure-code/ceph_erasure_code.cc index 4c0e22373d8f4..2a88137904023 100644 --- a/src/test/erasure-code/ceph_erasure_code.cc +++ b/src/test/erasure-code/ceph_erasure_code.cc @@ -145,7 +145,7 @@ int ErasureCodeCommand::display_information() { int code = instance.factory(profile["plugin"], profile, - &erasure_code, cerr); + &erasure_code, &cerr); if (code) return code; -- 2.39.5