]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind: return error message when ceph_mds_command() returns error 19505/head
authorJos Collin <jcollin@redhat.com>
Wed, 22 Nov 2017 11:50:58 +0000 (17:20 +0530)
committerShinobu Kinjo <shinobu@redhat.com>
Wed, 13 Dec 2017 23:08:53 +0000 (18:08 -0500)
Returned the error message when ceph_mds_command() returns error.

Signed-off-by: Jos Collin <jcollin@redhat.com>
(cherry picked from commit 941b58c968f6b0e359f279c8bc9e7decf51e75d1)

src/pybind/cephfs/cephfs.pyx

index 806e0ab4c3756365a09d0fc63ed629a7628206fe..3f106c4dfc6a9922a97b8d8272b5281b595d3cc1 100644 (file)
@@ -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:
@@ -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)