Merge pull request #777 from ceph/wip-scripts

Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
This commit is contained in:
Josh Durgin 2013-10-28 17:12:26 -07:00
commit 702234d7a2
7 changed files with 26 additions and 7 deletions

View File

@ -3,6 +3,7 @@ This module is a thin wrapper around libcephfs.
"""
from ctypes import CDLL, c_char_p, c_size_t, c_void_p, c_int, c_long, c_uint, c_ulong, \
create_string_buffer, byref, Structure
from ctypes.util import find_library
import errno
class Error(Exception):
@ -124,7 +125,10 @@ class LibCephFS(object):
"CephFS object in state %s." % (self.state))
def __init__(self, conf=None, conffile=None):
self.libcephfs = CDLL('libcephfs.so.1')
libcephfs_path = find_library('cephfs')
if not libcephfs_path:
raise EnvironmentError("Unable to find libcephfs")
self.libcephfs = CDLL(libcephfs_path)
self.cluster = c_void_p()
if conffile is not None and not isinstance(conffile, str):

View File

@ -6,6 +6,7 @@ Copyright 2011, Hannu Valtonen <hannu.valtonen@ormod.com>
from ctypes import CDLL, c_char_p, c_size_t, c_void_p, c_char, c_int, c_long, \
c_ulong, create_string_buffer, byref, Structure, c_uint64, c_ubyte, \
pointer, CFUNCTYPE
from ctypes.util import find_library
import ctypes
import errno
import threading
@ -194,7 +195,10 @@ Rados object in state %s." % (self.state))
def __init__(self, rados_id=None, name=None, clustername=None,
conf_defaults=None, conffile=None, conf=None, flags=0):
self.librados = CDLL('librados.so.2')
librados_path = find_library('rados')
if not librados_path:
raise EnvironmentError("Unable to find librados")
self.librados = CDLL(librados_path)
self.cluster = c_void_p()
self.rados_id = rados_id
if rados_id is not None and not isinstance(rados_id, str):

View File

@ -18,6 +18,7 @@ methods, a :class:`TypeError` will be raised.
from ctypes import CDLL, c_char, c_char_p, c_size_t, c_void_p, c_int, \
create_string_buffer, byref, Structure, c_uint64, c_int64, c_uint8, \
CFUNCTYPE
from ctypes.util import find_library
import ctypes
import errno
@ -116,12 +117,21 @@ class rbd_snap_info_t(Structure):
("size", c_uint64),
("name", c_char_p)]
def load_librbd():
"""
Load the librbd shared library.
"""
librbd_path = find_library('rbd')
if not librbd_path:
raise EnvironmentError("Unable to find librbd")
return CDLL(librbd_path)
class RBD(object):
"""
This class wraps librbd CRUD functions.
"""
def __init__(self):
self.librbd = CDLL('librbd.so.1')
self.librbd = load_librbd()
def version(self):
"""
@ -330,7 +340,7 @@ class Image(object):
:type read_only: bool
"""
self.closed = True
self.librbd = CDLL('librbd.so.1')
self.librbd = load_librbd()
self.image = c_void_p()
self.name = name
if not isinstance(name, str):

View File

@ -14,7 +14,7 @@ echo "numgen type"
for type in `./ceph-dencoder list_types`; do
num=`./ceph-dencoder type $type count_tests`
echo "$num $type"
for n in `seq 1 $num`; do
for n in `seq 1 1 $num 2>/dev/null`; do
if ! ./ceph-dencoder type $type select_test $n encode decode; then
echo "**** $type test $n encode+decode check failed ****"
echo " ceph-dencoder type $type select_test $n encode decode"

View File

@ -42,7 +42,7 @@ FAILED=0
for tool in "$SRCDIR"/cli/*; do
toolname="$(basename "$tool")"
install -d -m0755 -- "$BUILDDIR/cli/$toolname"
if ! env --ignore-environment \
if ! env -i \
PATH="$BUILDDIR_ABS/..:$SRCDIR_ABS/..:$PATH" \
CEPH_CONF=/dev/null \
CCACHE_DIR="$CCACHE_DIR" \

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
#
# Ceph - scalable distributed file system
#

View File

@ -2,6 +2,7 @@
export PYTHONPATH=./pybind
export LD_LIBRARY_PATH=.libs
export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH
# abort on failure