summaryrefslogtreecommitdiffstats
path: root/xlators/features/glupy
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/features/glupy')
-rw-r--r--xlators/features/glupy/Makefile.am2
-rw-r--r--xlators/features/glupy/examples/Makefile.am5
-rw-r--r--xlators/features/glupy/examples/debug-trace.py (renamed from xlators/features/glupy/src/debug-trace.py)11
-rw-r--r--xlators/features/glupy/examples/helloworld.py (renamed from xlators/features/glupy/src/helloworld.py)2
-rw-r--r--xlators/features/glupy/examples/negative.py (renamed from xlators/features/glupy/src/negative.py)3
-rw-r--r--xlators/features/glupy/src/Makefile.am13
-rw-r--r--xlators/features/glupy/src/glupy.c24
-rw-r--r--xlators/features/glupy/src/glupy.py (renamed from xlators/features/glupy/src/gluster.py)0
-rw-r--r--xlators/features/glupy/src/setup.py.in24
9 files changed, 67 insertions, 17 deletions
diff --git a/xlators/features/glupy/Makefile.am b/xlators/features/glupy/Makefile.am
index a985f42..060429e 100644
--- a/xlators/features/glupy/Makefile.am
+++ b/xlators/features/glupy/Makefile.am
@@ -1,3 +1,3 @@
-SUBDIRS = src
+SUBDIRS = src examples
CLEANFILES =
diff --git a/xlators/features/glupy/examples/Makefile.am b/xlators/features/glupy/examples/Makefile.am
new file mode 100644
index 0000000..c26abea
--- /dev/null
+++ b/xlators/features/glupy/examples/Makefile.am
@@ -0,0 +1,5 @@
+xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/features
+
+glupyexamplesdir = $(xlatordir)/glupy
+
+glupyexamples_PYTHON = negative.py helloworld.py debug-trace.py
diff --git a/xlators/features/glupy/src/debug-trace.py b/xlators/features/glupy/examples/debug-trace.py
index 53e7654..6eef1b5 100644
--- a/xlators/features/glupy/src/debug-trace.py
+++ b/xlators/features/glupy/examples/debug-trace.py
@@ -2,12 +2,13 @@ import sys
import stat
from uuid import UUID
from time import strftime, localtime
-from gluster import *
+from gluster.glupy import *
+
# This translator was written primarily to test the fop entry point definitions
-# and structure definitions in 'gluster.py'.
-# It is similar to the debug-trace translator, one of the already available
-# translator types written in C, that logs the arguments passed to the fops and
-# their corresponding cbk functions.
+# and structure definitions in 'glupy.py'.
+
+# It is similar to the C language debug-trace translator, which logs the
+# arguments passed to the fops and their corresponding cbk functions.
dl.get_id.restype = c_long
dl.get_id.argtypes = [ POINTER(call_frame_t) ]
diff --git a/xlators/features/glupy/src/helloworld.py b/xlators/features/glupy/examples/helloworld.py
index 8fe4037..b565a4e 100644
--- a/xlators/features/glupy/src/helloworld.py
+++ b/xlators/features/glupy/examples/helloworld.py
@@ -1,5 +1,5 @@
import sys
-from gluster import *
+from gluster.glupy import *
class xlator (Translator):
diff --git a/xlators/features/glupy/src/negative.py b/xlators/features/glupy/examples/negative.py
index 1023602..e7a4fc0 100644
--- a/xlators/features/glupy/src/negative.py
+++ b/xlators/features/glupy/examples/negative.py
@@ -1,6 +1,6 @@
import sys
from uuid import UUID
-from gluster import *
+from gluster.glupy import *
# Negative-lookup-caching example. If a file wasn't there the last time we
# looked, it's probably still not there. This translator keeps track of
@@ -89,4 +89,3 @@ class xlator (Translator):
dl.unwind_create(frame,cookie,this,op_ret,op_errno,fd,inode,buf,
preparent,postparent,xdata)
return 0
-
diff --git a/xlators/features/glupy/src/Makefile.am b/xlators/features/glupy/src/Makefile.am
index 21b91a1..ae7b6d1 100644
--- a/xlators/features/glupy/src/Makefile.am
+++ b/xlators/features/glupy/src/Makefile.am
@@ -1,11 +1,12 @@
xlator_LTLIBRARIES = glupy.la
+# Ensure GLUSTER_PYTHON_PATH is passed to glupy.so
xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/features
-
glupydir = $(xlatordir)/glupy
+AM_CPPFLAGS = $(PYTHONDEV_CPPFLAGS) $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src -isystem $(BUILD_PYTHON_INC)
+AM_CFLAGS = $(PYTHONDEV_CFLAGS) -Wall -fno-strict-aliasing -DGLUSTER_PYTHON_PATH=\"$(glupydir)\" $(GF_CFLAGS)
-glupy_PYTHON = gluster.py negative.py helloworld.py debug-trace.py
-
+# Flags to build glupy.so with
glupy_la_LDFLAGS = $(PYTHONDEV_LDFLAGS) -module -avoid-version -shared -nostartfiles
glupy_la_SOURCES = glupy.c
glupy_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
@@ -13,8 +14,8 @@ glupy_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
noinst_HEADERS = glupy.h
-AM_CPPFLAGS = $(PYTHONDEV_CPPFLAGS) $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src -isystem $(BUILD_PYTHON_INC)
-
-AM_CFLAGS = $(PYTHONDEV_CFLAGS) -Wall -fno-strict-aliasing -DGLUSTER_PYTHON_PATH=\"$(glupydir)\" $(GF_CFLAGS)
+# Install glupy.py into the Python site-packages area
+pyglupydir = $(pythondir)/gluster
+pyglupy_PYTHON = glupy.py
CLEANFILES =
diff --git a/xlators/features/glupy/src/glupy.c b/xlators/features/glupy/src/glupy.c
index dc86c00..7492124 100644
--- a/xlators/features/glupy/src/glupy.c
+++ b/xlators/features/glupy/src/glupy.c
@@ -2314,6 +2314,25 @@ get_rootunique (call_frame_t *frame)
}
int32_t
+mem_acct_init (xlator_t *this)
+{
+ int ret = -1;
+
+ if (!this)
+ return ret;
+
+ ret = xlator_mem_acct_init (this, gf_glupy_mt_end);
+
+ if (ret != 0) {
+ gf_log(this->name, GF_LOG_ERROR, "Memory accounting init"
+ " failed");
+ return ret;
+ }
+
+ return ret;
+}
+
+int32_t
init (xlator_t *this)
{
glupy_private_t *priv = NULL;
@@ -2365,7 +2384,7 @@ init (xlator_t *this)
goto *err_cleanup;
}
- gf_log (this->name, GF_LOG_ERROR, "py_mod_name = %s", module_name);
+ gf_log (this->name, GF_LOG_DEBUG, "py_mod_name = %s", module_name);
priv->py_module = PyImport_Import(py_mod_name);
Py_DECREF(py_mod_name);
if (!priv->py_module) {
@@ -2375,6 +2394,7 @@ init (xlator_t *this)
}
goto *err_cleanup;
}
+ gf_log (this->name, GF_LOG_INFO, "Import of %s succeeded", module_name);
err_cleanup = &&err_deref_module;
py_init_func = PyObject_GetAttrString(priv->py_module, "xlator");
@@ -2407,7 +2427,7 @@ init (xlator_t *this)
}
goto *err_cleanup;
}
- gf_log (this->name, GF_LOG_INFO, "init returned %p", priv->py_xlator);
+ gf_log (this->name, GF_LOG_DEBUG, "init returned %p", priv->py_xlator);
return 0;
diff --git a/xlators/features/glupy/src/gluster.py b/xlators/features/glupy/src/glupy.py
index a5daa77..a5daa77 100644
--- a/xlators/features/glupy/src/gluster.py
+++ b/xlators/features/glupy/src/glupy.py
diff --git a/xlators/features/glupy/src/setup.py.in b/xlators/features/glupy/src/setup.py.in
new file mode 100644
index 0000000..1aea987
--- /dev/null
+++ b/xlators/features/glupy/src/setup.py.in
@@ -0,0 +1,24 @@
+from distutils.core import setup
+
+DESC = """GlusterFS is a clustered file-system capable of scaling to
+several petabytes. It aggregates various storage bricks over Infiniband
+RDMA or TCP/IP interconnect into one large parallel network file system.
+GlusterFS is one of the most sophisticated file systems in terms of
+features and extensibility. It borrows a powerful concept called
+Translators from GNU Hurd kernel. Much of the code in GlusterFS is in
+user space and easily manageable.
+
+This package contains Glupy, the Python translator interface for GlusterFS."""
+
+setup(
+ name='glusterfs-glupy',
+ version='@PACKAGE_VERSION@',
+ description='Glupy is the Python translator interface for GlusterFS',
+ long_description=DESC,
+ author='Gluster Community',
+ author_email='gluster-devel@nongnu.org',
+ license='LGPLv3',
+ url='http://gluster.org/',
+ package_dir={'gluster':''},
+ packages=['gluster']
+)