Re: [patch tabled 8/8] Add Swift back-end

2010-12-13 Thread Jeff Garzik

On 11/28/2010 08:41 PM, Pete Zaitcev wrote:

This patch allows to use tabled with OpenStack Swift object store as if it
were our chunkserver, with some extra tricks. The configuration has to be
entred manually into CLD, just like in case of filesystem back-end.

The code is fairly experimental, so it retains extra messages.

Also, since Swift authorizes by plaintext passwords, support for SSL is
essential, but is currently missing.

There is no build-time test for this, because it would require us to
depend on OpenStack, which is untenable.

Signed-off-by: Pete Zaitcevzait...@redhat.com


applied patches 6-8.  well done, this is a milestone for tabled!


--
To unsubscribe from this list: send the line unsubscribe hail-devel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch tabled 8/8] Add Swift back-end

2010-11-28 Thread Pete Zaitcev
This patch allows to use tabled with OpenStack Swift object store as if it
were our chunkserver, with some extra tricks. The configuration has to be
entred manually into CLD, just like in case of filesystem back-end.

The code is fairly experimental, so it retains extra messages.

Also, since Swift authorizes by plaintext passwords, support for SSL is
essential, but is currently missing.

There is no build-time test for this, because it would require us to
depend on OpenStack, which is untenable.

Signed-off-by: Pete Zaitcev zait...@redhat.com

---
 doc/etc.tabled.conf  |5 
 server/Makefile.am   |7 
 server/object.c  |2 
 server/replica.c |4 
 server/server.c  |8 
 server/stor_swift.c  | 1420 +
 server/storage.c |3 
 server/storparse.c   |7 
 server/tabled.h  |   30 
 test/swift-test.conf |8 
 10 files changed, 1487 insertions(+), 7 deletions(-)

commit f24e2bd00d10f074ca9c6f62794b0838bc2de9b5
Author: Pete Zaitcev zait...@yahoo.com
Date:   Sun Nov 28 18:07:44 2010 -0700

Add Swift back-end. Sadly, no test.

diff --git a/doc/etc.tabled.conf b/doc/etc.tabled.conf
index 5112e8a..6e82fe4 100644
--- a/doc/etc.tabled.conf
+++ b/doc/etc.tabled.conf
@@ -43,8 +43,9 @@
  /CLD
 --
 
-ChunkUsertest/ChunkUser
-ChunkKeytest/ChunkKey
+!-- swift-auth-add-user -K devauth -a tabled tester1 tester1 --
+ChunkUsertester1/ChunkUser
+ChunkKeytester1/ChunkKey
 
 !-- Monitoring interface. Best is not to expose this to Internet. --
 StatusPort8084/StatusPort
diff --git a/server/Makefile.am b/server/Makefile.am
index 71bcb35..5651ec2 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -1,15 +1,16 @@
 
-INCLUDES   = -I$(top_srcdir)/include @GLIB_CFLAGS@ @HAIL_CFLAGS@
+INCLUDES   = -I$(top_srcdir)/include   \
+ @LIBCURL_CPPFLAGS@ @GLIB_CFLAGS@ @HAIL_CFLAGS@
 
 sbin_PROGRAMS  = tabled tdbadm
 
 tabled_SOURCES = tabled.h  \
  bucket.c cldu.c config.c metarep.c object.c replica.c \
  server.c status.c storage.c storparse.c \
- stor_chunk.c stor_fs.c util.c
+ stor_chunk.c stor_fs.c stor_swift.c util.c
 tabled_LDADD   = ../lib/libtdb.a   \
  @HAIL_LIBS@ @PCRE_LIBS@ @GLIB_LIBS@ \
- @CRYPTO_LIBS@ @DB4_LIBS@ @EVENT_LIBS@ @SSL_LIBS@
+ @CRYPTO_LIBS@ @DB4_LIBS@ @EVENT_LIBS@ @LIBCURL@ @SSL_LIBS@
 
 tdbadm_SOURCES = tdbadm.c
 tdbadm_LDADD   = ../lib/libtdb.a @GLIB_LIBS@ @DB4_LIBS@
diff --git a/server/object.c b/server/object.c
index 2920811..44f8d5c 100644
--- a/server/object.c
+++ b/server/object.c
@@ -700,6 +700,8 @@ static struct open_chunk *open_chunk1(struct storage_node 
*stnode,
applog(LOG_ERR, OOM);
goto err_alloc;
}
+   INIT_LIST_HEAD(ochunk-evt_list);
+   INIT_LIST_HEAD(ochunk-buf_list);
 
rc = stor_open(ochunk, stnode, tabled_srv.evbase_main);
if (rc != 0) {
diff --git a/server/replica.c b/server/replica.c
index 7c31112..0d3f7a2 100644
--- a/server/replica.c
+++ b/server/replica.c
@@ -90,6 +90,10 @@ static struct rep_job *job_alloc(size_t klen, struct 
db_obj_key *key)
job = malloc(len);
if (job) {
memset(job, 0, sizeof(struct rep_job));
+   INIT_LIST_HEAD(job-in_ce.evt_list);
+   INIT_LIST_HEAD(job-in_ce.buf_list);
+   INIT_LIST_HEAD(job-out_ce.evt_list);
+   INIT_LIST_HEAD(job-out_ce.buf_list);
memcpy(job+1, key, klen);
job-klen = klen;
job-key = (struct db_obj_key *)(job+1);
diff --git a/server/server.c b/server/server.c
index ba3e00a..de6975f 100644
--- a/server/server.c
+++ b/server/server.c
@@ -46,6 +46,7 @@
 #include openssl/md5.h
 #include openssl/hmac.h
 #include openssl/ssl.h
+#include curl/curl.h
 #include elist.h
 #include chunkc.h
 #include cldc.h
@@ -1245,6 +1246,8 @@ static struct client *cli_alloc(bool is_status)
applog(LOG_ERR, out of memory);
return NULL;
}
+   INIT_LIST_HEAD(cli-in_ce.evt_list);
+   INIT_LIST_HEAD(cli-in_ce.buf_list);
 
atcp_wr_init(cli-wst, libevent_wr_ops, cli-write_ev, cli);
 
@@ -2079,6 +2082,11 @@ int main (int argc, char *argv[])
SSL_library_init();
SSL_load_error_strings();
 
+   if (curl_global_init(CURL_GLOBAL_ALL)) {
+   fprintf(stderr, curl_global_init failed\n);
+   return 1;
+   }
+
stc_init();
 
cld_init();
diff --git a/server/stor_swift.c b/server/stor_swift.c
new file mode 100644
index 000..253c92c
--- /dev/null
+++ b/server/stor_swift.c
@@ -0,0 +1,1420 @@
+
+/*
+ * Copyright 2010 Red Hat, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed