[Libguestfs] [PATCH nbdkit] python: Implement can_extents + extents.

Richard W.M. Jones rjones at redhat.com
Mon Aug 10 11:18:55 UTC 2020


On Mon, Aug 10, 2020 at 11:50:59AM +0100, Richard W.M. Jones wrote:
> +    def test_extents_1 (self):
> +        """Test extents."""
> +
> +        offset = None
> +        entries = []
> +
> +        def f(meta_context, o, e, err):
> +            nonlocal offset, entries
> +            if meta_context != "base:allocation": return
> +            offset = o
> +            entries = e
> +
> +        self.h.add_meta_context ("base:allocation")
> +        self.connect ({"size": 512,
> +                       "can_extents": True,
> +                       "extents":
> +                       [ (0, 512, self.EXTENT_HOLE|self.EXTENT_ZERO) ]})
> +
> +        self.h.block_status (512, 0, lambda *args : f (*args))

This can of course just be "f" instead of using the pointless
lambda (and in other places).  I updated my copy.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list