Difference between revisions of "BiteSizedTasks"

From Libvirt Wiki
Jump to: navigation, search
(Tweak the virsh-edit.c description)
(Add some details to the WITH_GNUTLS item)
Line 17: Line 17:
 
* files that match this command: git grep virsh-edit.c tools/*.c
 
* files that match this command: git grep virsh-edit.c tools/*.c
  
==== Abstract the differences of code usage between with and without gnutls ====
+
==== Abstract away most usage of WITH_GNUTLS ====
'''Description''': The code is filled with WITH_GNUTLS preprocessor macros.  But in libvirt it is customary to use stub functions and abstract structures for this kind of differentiation. WITH_GNUTLS should be used almost only in virnettlscontext.c or similar.
+
The code is filled with WITH_GNUTLS preprocessor macros sprinkled in the middle of functions, altering function signatures, etc.  But in libvirt it is customary to use stub functions and abstract structures for this kind of differentiation.
 +
 
 +
Check out 'git grep WITH_GNUTLS daemon/libvirtd.c'; you will see many uses of WITH_GNUTLS embedded in functions. Instead, find a way to handle most WITH_GNUTLS usage in src/rpc/virnettlscontext.c or similar, and have this be transparent to the other pieces of libvirt that call functions from that file.
 +
 
 +
For example, 'git grep WIN32 src/util/virfile.c'; you will see how certain functions are entirely stubbed out if we are running on WIN32... this way other places in libvirt code don't need to conditionalize their usage of virfile.c APIs on whether we are WIN32 or not. That should be the example to follow for WITH_GNUTLS as well.
  
 
==== Move duplicated code from multiple drivers into private library functions ====
 
==== Move duplicated code from multiple drivers into private library functions ====
 
'''Description''': Both QEMU and LXC drivers are very similar when dealing with processes, cgroups, etc.  Most of that could be split to modules in src/util/, sometimes even to existing ones, and with near-zero effort, it would only take time.  Take functions virLXCCgroupSetupBlkioTune() and qemuSetupBlkioCgroup() for example.  They do the same thing with one extra check on the qemu side of things.  The goal would be to identify such functions, abstract them into the libvirt.so library (e.g. in src/util/) as private (see src/libvirt_private.syms) and use those from such drivers.  That would shrink the codebase and merge checks and fixes that were introduced in only one of the drivers.
 
'''Description''': Both QEMU and LXC drivers are very similar when dealing with processes, cgroups, etc.  Most of that could be split to modules in src/util/, sometimes even to existing ones, and with near-zero effort, it would only take time.  Take functions virLXCCgroupSetupBlkioTune() and qemuSetupBlkioCgroup() for example.  They do the same thing with one extra check on the qemu side of things.  The goal would be to identify such functions, abstract them into the libvirt.so library (e.g. in src/util/) as private (see src/libvirt_private.syms) and use those from such drivers.  That would shrink the codebase and merge checks and fixes that were introduced in only one of the drivers.

Revision as of 20:07, 18 March 2016

Bite Sized Tasks

This page tracks introductory tasks for new libvirt contributors. Code cleanups, bugs, and small features are listed with difficulty ranging from trivial to intermediate.

Bugs tagged with 'LibvirtFirstBug'

Some bugs in the libvirt bugzilla tracker are marked as 'LibvirtFirstBug'. You can see the full list in bugzilla here.

The full query is https://bugzilla.redhat.com/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=POST&bug_status=MODIFIED&classification=Community&f1=status_whiteboard&f2=component&list_id=4807856&o1=substring&o2=anywordssubstr&product=Virtualization%20Tools&query_format=advanced&v1=LibvirtFirstBug&v2=libvirt

Code Cleanups

virsh: drop usage of #include "virsh-edit.c"

The 'virsh *edit' series of commands (virsh edit, virsh net-edit, virsh pool-edit, ...) use an abnormal coding pattern involving various C macros and #include on the virsh-edit.c file. This should be changed so that the same file is not being included over and over again, but its function is called instead, using code callbacks as necessary. To explore a bit, check out:

  • tools/virsh-edit.c code
  • files that match this command: git grep virsh-edit.c tools/*.c

Abstract away most usage of WITH_GNUTLS

The code is filled with WITH_GNUTLS preprocessor macros sprinkled in the middle of functions, altering function signatures, etc. But in libvirt it is customary to use stub functions and abstract structures for this kind of differentiation.

Check out 'git grep WITH_GNUTLS daemon/libvirtd.c'; you will see many uses of WITH_GNUTLS embedded in functions. Instead, find a way to handle most WITH_GNUTLS usage in src/rpc/virnettlscontext.c or similar, and have this be transparent to the other pieces of libvirt that call functions from that file.

For example, 'git grep WIN32 src/util/virfile.c'; you will see how certain functions are entirely stubbed out if we are running on WIN32... this way other places in libvirt code don't need to conditionalize their usage of virfile.c APIs on whether we are WIN32 or not. That should be the example to follow for WITH_GNUTLS as well.

Move duplicated code from multiple drivers into private library functions

Description: Both QEMU and LXC drivers are very similar when dealing with processes, cgroups, etc. Most of that could be split to modules in src/util/, sometimes even to existing ones, and with near-zero effort, it would only take time. Take functions virLXCCgroupSetupBlkioTune() and qemuSetupBlkioCgroup() for example. They do the same thing with one extra check on the qemu side of things. The goal would be to identify such functions, abstract them into the libvirt.so library (e.g. in src/util/) as private (see src/libvirt_private.syms) and use those from such drivers. That would shrink the codebase and merge checks and fixes that were introduced in only one of the drivers.