[Libguestfs] [PATCH 2/2] actions: refactor available & feature_available

Richard W.M. Jones rjones at redhat.com
Fri Nov 6 21:40:53 UTC 2015


On Thu, Nov 05, 2015 at 04:56:43PM +0100, Pino Toscano wrote:
> Refactor the internal_feature_available to return the result for just
> one group, so it is easier to know on the library side what was the
> actual error, and which group refers to; drop internal_available, as no
> more needed after this.
> 
> On the library side, implement in available and feature_available the
> real logic to iterate through the requested group, and error out or
> return whether the groups are available. This also introduces caching
> for the features, so each needs to be queried just once in each
> appliance run.
> 
> The result of this is that there should be much less communication with
> the daemon to know about available features; the downside is that
> queries for more than one group at once, not already cached, will be
> cause more queries to the daemon.

This commit causes the following valgrind failures.  Curiously they
only occur in virt-v2v:

==25905== HEAP SUMMARY:
==25905==     in use at exit: 3,604,364 bytes in 1,663 blocks
==25905==   total heap usage: 83,930 allocs, 82,267 frees, 4,200,256,957 bytes allocated
==25905== 
==25905== 41 (32 direct, 9 indirect) bytes in 1 blocks are definitely lost in loss record 696 of 775
==25905==    at 0x4C2AB9D: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==25905==    by 0x4ECF846: guestfs_int_safe_realloc (alloc.c:80)
==25905==    by 0x4ED05FF: find_or_cache_feature (available.c:48)
==25905==    by 0x4ED073C: guestfs_impl_feature_available (available.c:89)
==25905==    by 0x4EA4B21: guestfs_feature_available (actions-5.c:1131)
==25905==    by 0x4EF9FDF: guestfs_impl_list_filesystems (listfs.c:49)
==25905==    by 0x4E7EDF2: guestfs_list_filesystems (actions-3.c:419)
==25905==    by 0x4EE0FD2: guestfs_impl_inspect_os (inspect.c:62)
==25905==    by 0x4E50E12: guestfs_inspect_os (actions-0.c:500)
==25905==    by 0x4E3292: ocaml_guestfs_inspect_os (guestfs-c-actions.c:9385)
==25905==    by 0x4696C8: camlGuestfs__fun_16039 (guestfs.ml:1242)
==25905==    by 0x423224: camlV2v__inspect_source_1085 (v2v.ml:306)

I've been staring at the code for a long while, and I cannot see what
the problem is ...

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v




More information about the Libguestfs mailing list