search for: libnbdmod

Displaying 20 results from an estimated 32 matches for "libnbdmod".

2019 Jun 28
1
[PATCH libnbd] python: Raise a custom exception containing error string and errno.
I spent a good few hours this morning trying to make this work and came up with the following patch. It's not quite right though. The exception I've created exists in the libnbdmod module (ie. the underlying C module that we use for the Python bindings). Ideally we'd define and throw an exception from the normal nbd module, but I couldn't work out how to do that. Probably someone who knows a bit more about Python might find this easy to do. Rich.
2019 Aug 10
0
[PATCH libnbd 1/5] python: Change aio_buffer into nbd.Buffer class.
...lloc_aio_buffer"; + "aio_buffer_from_bytearray"; + "aio_buffer_to_bytearray"; + "aio_buffer_size" ] @ List.map fst handle_calls); pr "\n"; pr "#endif /* LIBNBD_METHODS_H */\n" @@ -4009,8 +4011,10 @@ let generate_python_libnbdmod_c () = pr " { (char *) \"%s\", nbd_internal_py_%s, METH_VARARGS, NULL },\n" name name; ) ([ "create"; "close"; - "alloc_aio_buffer"; "aio_buffer_from_bytearray"; - "aio_buffer_to_bytearray" ] @ Li...
2019 Jun 28
3
[PATCH libnbd v2] python: Raise a custom exception containing error string and errno.
This kind of fixes the problems in v1. The exception still primarily lives in the libnbdmod and you could still refer to it using libnbdmod.Error (but don't do that). However when the exception is printed it now appears as nbd.Error, and you can catch it also using the same name. Other problems: - There is no "nice" interface to accessing the exception fields. You hav...
2019 Aug 10
7
[PATCH libnbd 0/5] WIP: python: Add test for doing asynch copy.
This doesn't yet work. However it does make me more convinced than ever that we really need to sort out persistent buffer lifetimes in the library (similar to what we did for closures). Rich.
2019 Jun 28
2
Re: [PATCH libnbd v3] python: Raise a custom exception containing error string and errno.
...<module> > nbdsh.shell() > File "/home/rjones/d/libnbd/python/nbdsh.py", line 62, in shell > exec (c) > File "<string>", line 1, in <module> > File "/home/rjones/d/libnbd/python/nbd.py", line 483, in pread > return libnbdmod.pread (self._o, count, offset, flags) > nbd.Error: nbd_pread: invalid state: START: the handle must be connected and finished handshaking with the server: Transport endpoint is not connected (ENOTCONN) Cool - in the time I spent writing my reply to v2 1/1, your reaction to my reply on 0/1 figur...
2019 Jun 28
3
[PATCH libnbd v3] python: Raise a custom exception containing error string and errno.
Following Eric's suggestions from v2, this adds .string, .errno and .__str__ properties. The .string property returns the error string. The .errno property returns the errno (from the errno module), or None. The __str__ property makes the exception nicely printable. Rich.
2019 Jun 28
0
Re: [PATCH libnbd v3] python: Raise a custom exception containing error string and errno.
...nbdsh.shell() > > File "/home/rjones/d/libnbd/python/nbdsh.py", line 62, in shell > > exec (c) > > File "<string>", line 1, in <module> > > File "/home/rjones/d/libnbd/python/nbd.py", line 483, in pread > > return libnbdmod.pread (self._o, count, offset, flags) > > nbd.Error: nbd_pread: invalid state: START: the handle must be connected and finished handshaking with the server: Transport endpoint is not connected (ENOTCONN) > > Cool - in the time I spent writing my reply to v2 1/1, your reaction to > m...
2019 Jun 28
0
[PATCH libnbd v2] python: Raise a custom exception containing error string and errno.
...on/nbd.py", line 1136, in <module> nbdsh.shell() File "/home/rjones/d/libnbd/python/nbdsh.py", line 62, in shell exec (c) File "<string>", line 1, in <module> File "/home/rjones/d/libnbd/python/nbd.py", line 456, in pread return libnbdmod.pread (self._o, count, offset, flags) nbd.Error: ('nbd_pread: invalid state: START: the handle must be connected and finished handshaking with the server: Transport endpoint is not connected', 107) --- generator/generator | 34 +++++++++++++++++++++++++++++++++- python/t/610-exceptio...
2019 Jun 28
0
[PATCH libnbd v3] python: Raise a custom exception containing error string and errno.
...on/nbd.py", line 1163, in <module> nbdsh.shell() File "/home/rjones/d/libnbd/python/nbdsh.py", line 62, in shell exec (c) File "<string>", line 1, in <module> File "/home/rjones/d/libnbd/python/nbd.py", line 483, in pread return libnbdmod.pread (self._o, count, offset, flags) nbd.Error: nbd_pread: invalid state: START: the handle must be connected and finished handshaking with the server: Transport endpoint is not connected (ENOTCONN) --- generator/generator | 53 ++++++++++++++++++++++++++++++++++++++- python/t/610-exception...
2019 Jun 28
1
Re: [PATCH libnbd v3] python: Raise a custom exception containing error string and errno.
...ble no matter what). Maybe as simple as this (or with one further tweak to __str__ to at least output .errnum when .errno is None): diff --git i/generator/generator w/generator/generator index 7c2fb59..9192988 100755 --- i/generator/generator +++ w/generator/generator @@ -3944,11 +3944,14 @@ from libnbdmod import Error Error.__doc__ = ''' Exception thrown when the underlying libnbd call fails. -This exception has two properties to query the error. Use +This exception has three properties to query the error. Use the .string property to return a printable string containing -the error...
2019 Jun 17
2
[nbdkit PATCH] extents: Cap maximum reply length
...24*1024,0,0,f) Traceback (most recent call last): File "/usr/lib64/python3.7/code.py", line 90, in runcode exec(code, self.locals) File "<console>", line 1, in <module> File "/home/eblake/libnbd/python/nbd.py", line 577, in block_status return libnbdmod.block_status (self._o, count, offset, data, extent, flags) RuntimeError: nbd_block_status: invalid server reply length Signed-off-by: Eric Blake <eblake@redhat.com> --- server/extents.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/server/extents.c b/server/...
2019 Aug 13
2
Re: [PATCH libnbd 5/6] generator: Implement OClosure.
On 8/13/19 5:06 AM, Richard W.M. Jones wrote: > An optional Closure parameter, but otherwise works the same way as > Closure. > @@ -3778,6 +3777,7 @@ let generate_lib_api_c () = > ) args; > List.iter ( > function > + | OClosure { cbname } -> pr ", %s_callback ? \"<fun>\" : \"NULL\"" cbname Well, it also permits a
2019 Jun 03
3
[PATCH libnbd] api: nbd_get_version, nbd_supports_uri and nbd_get_package_name.
...et_package_name"; "get_package_version"; + ) ([ "create"; "close"; "alloc_aio_buffer"; "aio_buffer_from_bytearray"; "aio_buffer_to_bytearray" ] @ List.map fst handle_calls); @@ -3035,7 +3078,7 @@ let generate_python_libnbdmod_c () = fun name -> pr " { (char *) \"%s\", nbd_internal_py_%s, METH_VARARGS, NULL },\n" name name; - ) ([ "create"; "close"; "get_package_name"; "get_package_version"; + ) ([ "create"; "close&quot...
2019 Aug 11
4
[PATCH libnbd v2 0/3] python: Add test for doing asynch copy.
v1 was here: https://www.redhat.com/archives/libguestfs/2019-August/msg00103.html In v2 I've made several changes: - Fix Python callbacks so if they don't return something which is int-like, we assume they mean to return 0. - Add nbd.Buffer free() method. Read commit message in patch 2 to see what this is about. - Fixed the asynch copy test to deal with the unbelievably
2019 Jul 22
1
[libnbd] ImportError: cannot import name 'Error'
13:38 < mkletzan> rjones: Not sure where to look, but when I do just `import nbd` from python on the clean installation of libnbd, I just get `ImportError: cannot import name 'Error'` I can't reproduce it: $ rpm -q python3-libnbd python3-libnbd-0.1.8-1.fc30.x86_64 $ python3 Python 3.7.3 (default, May 11 2019, 00:38:04) [GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]
2019 Aug 13
0
Re: [PATCH libnbd 5/6] generator: Implement OClosure.
...t;, line 1417, in <module> nbdsh.shell() File "/home/rjones/d/libnbd/python/nbdsh.py", line 62, in shell exec (c) File "<string>", line 1, in <module> File "/home/rjones/d/libnbd/python/nbd.py", line 923, in aio_pread_callback return libnbdmod.aio_pread_callback (self._o, buf._o, offset, completion, flags) TypeError: callback parameter completion is not callable It seems like the "if (%_user_data) {" test at the top is not sufficient to tell me if the value is None and I've got to do something else instead. Rich. -- Ric...
2020 Jan 30
2
[PATCH libnbd] python: Add AIO buffer is_zero method.
..."; - "aio_buffer_size" ] @ List.map fst handle_calls); + "aio_buffer_size"; + "aio_buffer_is_zero" ] @ List.map fst handle_calls); pr "\n"; pr "#endif /* LIBNBD_METHODS_H */\n" @@ -5044,7 +5045,8 @@ let generate_python_libnbdmod_c () = "alloc_aio_buffer"; "aio_buffer_from_bytearray"; "aio_buffer_to_bytearray"; - "aio_buffer_size" ] @ List.map fst handle_calls); + "aio_buffer_size"; + "aio_buffer_is_zero" ] @ List.map fst h...
2020 Aug 14
0
[libnbd PATCH v2 12/13] wip: api: Give aio_opt_go a completion callback
...opt_mode(True) Traceback (most recent call last): File "/usr/lib64/python3.8/code.py", line 90, in runcode exec(code, self.locals) File "<console>", line 1, in <module> File "/home/eblake/libnbd/python/nbd.py", line 570, in set_opt_mode return libnbdmod.set_opt_mode (self._o, enable) nbd.Error: nbd_set_opt_mode: invalid state: NEGOTIATING: the handle must be newly created: Invalid argument (EINVAL) nbd> quit() --- generator/API.ml | 12 ++++++++++-- generator/states-newstyle-opt-go.c | 19 +++++++++++++------ lib/opt.c...
2019 Jun 18
0
[libnbd RFC PATCH 9/8] wip: generator: Add ReadStatus enum type
...| Int64 _ -> () | Opaque _ -> () | Path n -> pr " free (%s);\n" n + | ReadStatus _ -> () | SockAddrAndLen _ -> () | String n -> () | StringList n -> pr " nbd_internal_py_free_string_list (%s);\n" n @@ -3795,6 +3820,7 @@ import libnbdmod "; List.iter (fun (n, i) -> pr "%-30s = %d\n" n i) constants; + (* how to represent enums? *) pr "\ @@ -3839,6 +3865,7 @@ class NBD (object): | Int64 n -> n, None | Opaque n -> n, None | Path n...
2019 Jun 20
1
Re: [libnbd RFC PATCH 9/8] wip: generator: Add ReadStatus enum type
...aque _ -> () > | Path n -> pr " free (%s);\n" n > + | ReadStatus _ -> () > | SockAddrAndLen _ -> () > | String n -> () > | StringList n -> pr " nbd_internal_py_free_string_list (%s);\n" n > @@ -3795,6 +3820,7 @@ import libnbdmod > "; > > List.iter (fun (n, i) -> pr "%-30s = %d\n" n i) constants; > + (* how to represent enums? *) > > pr "\ > > @@ -3839,6 +3865,7 @@ class NBD (object): > | Int64 n -> n, None > | Opa...