This option should be keyvaluestore_*, not osd_*.
Clean up the backend instantiation.
Signed-off-by: xinxin shu <xinxin.shu@intel.com>
Signed-off-by: Sage Weil <sage@redhat.com>
OPTION(leveldb_log, OPT_STR, "/dev/null") // enable leveldb log file
OPTION(leveldb_compact_on_mount, OPT_BOOL, false)
-OPTION(osd_keyvaluedb, OPT_STR, "leveldb")
-
OPTION(kinetic_host, OPT_STR, "") // hostname or ip address of a kinetic drive to use
OPTION(kinetic_port, OPT_INT, 8123) // port number of the kinetic drive
OPTION(kinetic_user_id, OPT_INT, 1) // kinetic user to authenticate as
OPTION(keyvaluestore_default_strip_size, OPT_INT, 4096) // Only affect new object
OPTION(keyvaluestore_max_expected_write_size, OPT_U64, 1ULL << 24) // bytes
OPTION(keyvaluestore_header_cache_size, OPT_INT, 4096) // Header cache size
+OPTION(keyvaluestore_backend, OPT_STR, "leveldb")
// max bytes to search ahead in journal searching for corruption
OPTION(journal_max_corrupt_search, OPT_U64, 10<<20)
internal_name(name),
basedir(base),
fsid_fd(-1), current_fd(-1),
- kv_type(KV_TYPE_NONE),
backend(NULL),
ondisk_finisher(g_ceph_context),
lock("KeyValueStore::lock"),
goto close_fsid_fd;
}
- if (_detect_backend()) {
- derr << "KeyValueStore::mkfs error in _detect_backend" << dendl;
- ret = -1;
- goto close_fsid_fd;
- }
-
{
- KeyValueDB *store;
- if (kv_type == KV_TYPE_LEVELDB) {
- store = new LevelDBStore(g_ceph_context, current_fn);
-#ifdef HAVE_KINETIC
- } else if (kv_type == KV_TYPE_KINETIC) {
- store = new KineticStore(g_ceph_context);
-#endif
- } else {
- derr << "KeyValueStore::mkfs error: unknown backend type" << kv_type << dendl;
+ KeyValueDB *store = KeyValueDB::create(g_ceph_context,
+ g_conf->keyvaluestore_backend,
+ current_fn.c_str());
+ if(! store)
+ {
+ derr << "KeyValueStore::mkfs backend type "
+ << g_conf->keyvaluestore_backend << " error" << dendl;
ret = -1;
goto close_fsid_fd;
- }
+ }
store->init();
stringstream err;
if (store->create_and_open(err)) {
assert(current_fd >= 0);
- if (_detect_backend()) {
- derr << "KeyValueStore::mount error in _detect_backend" << dendl;
- ret = -1;
- goto close_current_fd;
- }
-
{
- KeyValueDB *store;
- if (kv_type == KV_TYPE_LEVELDB) {
- store = new LevelDBStore(g_ceph_context, current_fn);
-#ifdef HAVE_KINETIC
- } else if (kv_type == KV_TYPE_KINETIC) {
- store = new KineticStore(g_ceph_context);
-#endif
- } else {
- derr << "KeyValueStore::mount error: unknown backend type" << kv_type
- << dendl;
+
+ KeyValueDB *store = KeyValueDB::create(g_ceph_context,
+ g_conf->keyvaluestore_backend,
+ current_fn.c_str());
+ if(! store)
+ {
+ derr << "KeyValueStore::mount backend type "
+ << g_conf->keyvaluestore_backend << " error" << dendl;
ret = -1;
- goto close_current_fd;
+ goto close_fsid_fd;
+
}
store->init();
#include "include/uuid.h"
-enum kvstore_types {
- KV_TYPE_NONE = 0,
- KV_TYPE_LEVELDB,
- KV_TYPE_KINETIC,
- KV_TYPE_OTHER
-};
-
-
static uint64_t default_strip_size = 1024;
class StripObjectMap: public GenericObjectMap {
int fsid_fd, current_fd;
- enum kvstore_types kv_type;
-
deque<uint64_t> snaps;
// ObjectMap
bool update_to=false);
~KeyValueStore();
- int _detect_backend() {
- if (g_conf->osd_keyvaluedb == "leveldb")
- kv_type = KV_TYPE_LEVELDB;
-#ifdef HAVE_KINETIC
- else if (g_conf->osd_keyvaluedb == "kinetic")
- kv_type = KV_TYPE_KINETIC;
-#endif
- else
- return -EINVAL;
- return 0;
- }
bool test_mount_in_use();
int version_stamp_is_valid(uint32_t *version);
int update_version_stamp();