diff options
author | Susant Palai <spalai@redhat.com> | 2018-05-22 19:55:27 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-05-30 03:26:25 +0000 |
commit | 62990c30fcec37f643b7631070de8baba276f0ba (patch) | |
tree | 14c46a3b15eacc3df318337da1e8a7d954efbfc6 /xlators/features/cloudsync/src/cloudsync.c | |
parent | cb4e0fa2cbd25ef4ab5b65c6a76a6aea90c0f835 (diff) |
cloudsync: Adding s3 plugin for cloudsync
This is a plugin which provides an interface to retrive files from amazon-s3
which are archived in to s3.
Users need to give the above information for cloudsync to retrieve the file
from s3.
TODO:
1- A separate commit in to developer-guide will detail about the usage
of this plugin in more detail.
2- Need to create target file in aws-bucket with "gfid" names. Helps avoiding
name collisions.
Change-Id: I2e4a586f4e3f86164de9178e37673a07f317e7d9
Updates: #387
Signed-off-by: Susant Palai <spalai@redhat.com>
Diffstat (limited to 'xlators/features/cloudsync/src/cloudsync.c')
-rw-r--r-- | xlators/features/cloudsync/src/cloudsync.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/xlators/features/cloudsync/src/cloudsync.c b/xlators/features/cloudsync/src/cloudsync.c index e14fc544957..e32181c22ab 100644 --- a/xlators/features/cloudsync/src/cloudsync.c +++ b/xlators/features/cloudsync/src/cloudsync.c @@ -36,9 +36,9 @@ cs_cleanup_private (cs_private_t *priv) struct cs_plugin plugins[] = { { - .name = "amazons3", - .library = "libamazons3.so", - .description = "amazon s3 store." + .name = "cloudsyncs3", + .library = "cloudsyncs3.so", + .description = "cloudsync s3 store." }, {.name = NULL}, @@ -55,6 +55,7 @@ cs_init (xlator_t *this) void *handle = NULL; char *temp_str = NULL; int index = 0; + char *libname = NULL; priv = GF_CALLOC (1, sizeof (*priv), gf_cs_mt_cs_private_t); if (!priv) { @@ -82,7 +83,7 @@ cs_init (xlator_t *this) &temp_str) == 0) { for (index = 0; plugins[index].name; index++) { if (!strcmp (temp_str, plugins[index].name)) { - libpath = plugins[index].library; + libname = plugins[index].library; break; } } @@ -90,21 +91,27 @@ cs_init (xlator_t *this) ret = 0; } - if (!libpath) { + if (!libname) { gf_msg (this->name, GF_LOG_WARNING, 0, 0, "no plugin enabled"); ret = 0; goto out; } + ret = gf_asprintf (&libpath, "%s/%s", CS_PLUGINDIR, libname); + if (ret == -1) { + goto out; + } + handle = dlopen (libpath, RTLD_NOW); if (!handle) { - gf_msg (this->name, GF_LOG_ERROR, 0, 0, "could not load" - " the required library. %s", dlerror ()); + gf_msg (this->name, GF_LOG_WARNING, 0, 0, "could not " + "load the required library. %s", dlerror ()); + ret = 0; goto out; } else { gf_msg (this->name, GF_LOG_INFO, 0, 0, - "loading library:%s successful", libpath); + "loading library:%s successful", libname); } @@ -166,6 +173,8 @@ cs_init (xlator_t *this) } } + ret = 0; + out: if (ret == -1) { if (this->local_pool) |