Skip to content

Commit

Permalink
pybind: return error message when ceph_mds_command() returns error
Browse files Browse the repository at this point in the history
Returned the error message when ceph_mds_command() returns error.

Signed-off-by: Jos Collin <jcollin@redhat.com>
  • Loading branch information
joscollin committed Nov 24, 2017
1 parent 10f93cf commit 941b58c
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/pybind/cephfs/cephfs.pyx
Expand Up @@ -962,10 +962,10 @@ cdef class LibCephFS(object):
char *_inbuf = input_data
size_t _inbuf_len = len(input_data)

char *_outbuf
size_t _outbuf_len
char *_outs
size_t _outs_len
char *_outbuf = NULL
size_t _outbuf_len = 0
char *_outs = NULL
size_t _outs_len = 0

try:
with nogil:
Expand All @@ -974,15 +974,12 @@ cdef class LibCephFS(object):
<const char*>_inbuf, _inbuf_len,
&_outbuf, &_outbuf_len,
&_outs, &_outs_len)
if ret == 0:
my_outs = decode_cstr(_outs[:_outs_len])
my_outbuf = _outbuf[:_outbuf_len]
if _outs_len:
ceph_buffer_free(_outs)
if _outbuf_len:
ceph_buffer_free(_outbuf)
return (ret, my_outbuf, my_outs)
else:
return (ret, b"", "")
my_outs = decode_cstr(_outs[:_outs_len])
my_outbuf = _outbuf[:_outbuf_len]
if _outs_len:
ceph_buffer_free(_outs)
if _outbuf_len:
ceph_buffer_free(_outbuf)
return (ret, my_outbuf, my_outs)
finally:
free(_cmd)

0 comments on commit 941b58c

Please sign in to comment.