Displaying 20 results from an estimated 1000 matches similar to: "[PATCH nbdkit 0/2] python: Implement pread passing buffer for v2 API."
2019 Nov 25
7
[PATCH nbdkit v2 0/7] Implement nbdkit API v2 for Python plugins.
v3 was here:
https://www.redhat.com/archives/libguestfs/2019-November/msg00209.html
In v4:
- Rebase on top of current master. Includes various fixes and
updates required because of Nir's patches that went into master.
- Fix api_version() -> API_VERSION in patch 2 noted previously on the
mailing list.
Rich.
2019 Nov 23
8
[PATCH nbdkit v3 0/7] Implement nbdkit API v2 for Python plugins.
v2 was here:
https://www.redhat.com/archives/libguestfs/2019-November/msg00163.html
I pushed patch 1 (with spelling fix), patch 4 and patch 5 since those
were previously ACKed on the list.
Differences in v3:
- Add error checking to PyModule_AddIntConstant.
- Use API_VERSION constant instead of function.
- Add max API version supported to --dump-plugin output.
- Print API_VERSION selected by
2019 Nov 23
1
[PATCH] python: Support buffer protocol for pread() result
pread() can return now any object supporting the buffer protocol[1] such
as bytearray, bytes, or memoryview.
[1] https://docs.python.org/3/c-api/buffer.html
---
When the new python tests will be in master we can add some automated tests.
For now I tested this manually using the example plugin as is and with
these changes:
def pread(h, count, offset):
global disk
return
2019 Nov 25
0
[PATCH nbdkit 1/2] python: For v2 API, avoid copy by passing a buffer to pread.
It's more efficient if we pass the C buffer directly to Python code.
In some cases the Python code will be able to write directly into the
C buffer using functions like file.readinto and socket.recv_into.
This avoids an extra copy.
Thanks: Nir Soffer
---
plugins/python/example.py | 8 ++++---
plugins/python/nbdkit-python-plugin.pod | 16 +++++--------
plugins/python/python.c
2019 Nov 23
2
Re: [PATCH nbdkit v2 10/10] tests: Test the Python plugin thoroughly.
On Sat, Nov 23, 2019 at 3:10 PM Richard W.M. Jones <rjones@redhat.com> wrote:
>
> On Sat, Nov 23, 2019 at 01:42:15AM +0200, Nir Soffer wrote:
> > On Fri, Nov 22, 2019 at 9:55 PM Richard W.M. Jones <rjones@redhat.com> wrote:
> > > +def pread(h, count, offset, flags):
> > > + assert flags == 0
> > > + return
2019 Nov 23
3
[PATCH nbdkit] python: Pass memoryview to pwrite()
Passing a memoryview we avoid unneeded copy of the original buffer. On
the python side memoryview object can be used for slicing, writing to
file, or sending to socket.
This may break plugins assuming that the they get a bytearray, but
good python code should not care about the type of the buffer, only
about the behaviour.
Testing with a plugin writing to /dev/null shows 2.7x speedup. Real
2019 Nov 22
3
Re: [PATCH nbdkit v2 10/10] tests: Test the Python plugin thoroughly.
On Fri, Nov 22, 2019 at 9:55 PM Richard W.M. Jones <rjones@redhat.com> wrote:
>
> This tests the Python plugin thoroughly by issuing client commands
> through libnbd and checking we get the expected results.
> ---
> tests/Makefile.am | 13 +--
> tests/test-python-plugin.py | 134 ++++++++++++++++++++++++++++
> tests/test-python.py | 172
2019 Nov 24
1
Re: [PATCH nbdkit v2 10/10] tests: Test the Python plugin thoroughly.
On Sun, Nov 24, 2019, 12:42 Richard W.M. Jones <rjones@redhat.com> wrote:
> On Sat, Nov 23, 2019 at 06:11:47PM +0200, Nir Soffer wrote:
> > On Sat, Nov 23, 2019 at 3:10 PM Richard W.M. Jones <rjones@redhat.com>
> wrote:
> > >
> > > On Sat, Nov 23, 2019 at 01:42:15AM +0200, Nir Soffer wrote:
> > > > On Fri, Nov 22, 2019 at 9:55 PM Richard W.M.
2019 Nov 22
18
[PATCH nbdkit v2 00/10] Implement nbdkit API v2 for Python plugins.
v1:
https://www.redhat.com/archives/libguestfs/2019-November/msg00153.html
v2:
- Fix implementation of can_cache.
- Add implementation of can_fua.
- Add a very thorough test suite which tests every command + flag
combination.
2018 Dec 07
2
[PATCH] v2v: -o rhv-upload: Fix emulated zero
Replace python 2 only "buffer" with "memoryview".
Falling back to emulated zero would fail with:
NameError: name 'buffer' is not defined
I did not test the changed code but it was not tested before so it is
unlikely to be worse.
Detected by pylint.
---
v2v/rhv-upload-plugin.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git
2019 Nov 21
10
[PATCH nbdkit 0/8] Implement nbdkit API v2 for Python plugins.
And fill out most of the missing bits of the API.
Rich.
2020 Aug 10
5
[PATCH nbdkit] python: Implement can_extents + extents.
---
plugins/python/nbdkit-python-plugin.pod | 19 ++++++-
plugins/python/python.c | 75 +++++++++++++++++++++++++
tests/test-python-plugin.py | 8 ++-
tests/test_python.py | 73 +++++++++++++++++++++++-
4 files changed, 169 insertions(+), 6 deletions(-)
diff --git a/plugins/python/nbdkit-python-plugin.pod b/plugins/python/nbdkit-python-plugin.pod
2019 Nov 25
6
[nbdkit PATCH 0/5] Counterproposal for python v2 interfaces
As mentioned in my reviews, I wonder if we should make our python
callbacks look a bit more Pythonic by having kwargs added for each
new flag that we want to expose. The idea was first floated here:
https://www.redhat.com/archives/libguestfs/2018-April/msg00108.html
Note that with my proposal, there is no need for a python script to
expose a global API_VERSION variable; new flags are added
2016 Sep 26
3
[PATCH] Improve memory management of nbdkit python plugin example
Hi,
the nbdkit python plugin example has suboptimal memory management:
- it creates the disk image as a string on init
- it casts the string to bytearray on every read
- it copies the string before and the string after the written region,
then reassembles those pieces together with the written region to a new
disk image string
This is not a problem as long as the image is small, but in my tests
2018 Apr 11
10
[nbdkit PATCH v2 0/5] FUA support in Python scripts
First out of our four language bindings to add FUA support (for
reference, I added 'zero' support for python, perl, and ruby
back in 1.1.13, then Rich had to add it for ocaml in 1.1.20).
I tested this heavily under python 2, but for now only compile
tested under python 3; I plan to do further testing there and
make any tweaks if necessary.
I wrote patch 5 early on, but then realized I
2019 Nov 22
8
Re: [PATCH nbdkit v2 03/10] python: Implement nbdkit API version 2.
On 11/22/19 1:53 PM, Richard W.M. Jones wrote:
> To avoid breaking existing plugins, Python plugins wishing to use
> version 2 of the API must opt in by declaring:
>
> def api_version():
> return 2
>
> (Plugins which do not do this are assumed to want API version 1).
Could we also permit the python code to declare a global variable
instead of a function? But a
2019 Nov 24
0
Re: [PATCH nbdkit v2 10/10] tests: Test the Python plugin thoroughly.
On Sat, Nov 23, 2019 at 06:11:47PM +0200, Nir Soffer wrote:
> On Sat, Nov 23, 2019 at 3:10 PM Richard W.M. Jones <rjones@redhat.com> wrote:
> >
> > On Sat, Nov 23, 2019 at 01:42:15AM +0200, Nir Soffer wrote:
> > > On Fri, Nov 22, 2019 at 9:55 PM Richard W.M. Jones <rjones@redhat.com> wrote:
> > > > +def pread(h, count, offset, flags):
> > >
2018 Apr 05
5
[nbdkit PATCH 0/3] Test zero callback of python plugin
I'm planning on tweaking the language callbacks to support fua;
first up is the python bindings. I want to move from:
def zero(h, count, offset, may_trim):
to a nicer:
def zero(h, count, offset, may_trim=False, fua=False):
where the C code passes keywords for the flags (we can add new
flags as needed), perhaps by using introspection to learn
whether the plugin has a mandatory may_trim
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.
2015 Oct 29
2
[nbdkit] can't import mmap
Hi,
I'm new to nbdkit and am trying to run a simple "single file block
device using mmap" setup, using this python script:
import mmap
def config(key, value):
print ("ignored parameter %s=%s" % (key, value))
def open(readonly):
print ("open: readonly=%d" % readonly)
f = open("disk","r+")
m = mmap.mmap(f.fileno(), 0,