Difference between revisions of "BiteSizedTasks"

From Libvirt Wiki
Jump to: navigation, search
(Move duplicated code from multiple drivers into private library functions)
(We already have new VIR_DOMAIN_VIRT_NONE enum 62569e45ea060b44e8cae0984c40966559690dfd)
Line 3: Line 3:
  
 
This page aims to summarize small, trivial contributions that should help starting libvirt contributor to get to know the libvirt source code. The other source for trivial bugs can be found [https://bugzilla.redhat.com/show_bug.cgi?id=libvirtFirstBug here].
 
This page aims to summarize small, trivial contributions that should help starting libvirt contributor to get to know the libvirt source code. The other source for trivial bugs can be found [https://bugzilla.redhat.com/show_bug.cgi?id=libvirtFirstBug here].
 
=== Introduce new virtType enum item ===
 
'''Description''': Introduce VIR_DOMAIN_VIRT_NONE to give name the default value of zero. The rest of the code should be updated as it currently expects -1 as an alias for 'not specified'.
 
 
'''URL''': https://www.redhat.com/archives/libvir-list/2015-June/msg00608.html
 
  
 
=== Don't include .c file for editing support ===
 
=== Don't include .c file for editing support ===

Revision as of 13:32, 2 October 2015

BiteSizedTasks

This page aims to summarize small, trivial contributions that should help starting libvirt contributor to get to know the libvirt source code. The other source for trivial bugs can be found here.

Don't include .c file for editing support

Description: When editing an XML of a domain, network or anything else, it is implemented in virsh-edit.c and currently included as a C file with the behaviour being influenced by EDIT_ macros. This should be changed so that the same file is not being included over and over again, but its function is called instead. The behaviour should be affected by callbacks in some control structure.

Abstract the differences of code usage between with and without 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.

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.

Prefer STREQ and STRNEQ

Description: In Libvirt, we use STREQ and STRNEQ for string comparisons. Obviously, the former returns negated value of the latter and vice versa. However, in some places we still use !STREQ while we should have used STRNEQ. Not only replace those, but also introduce a syntax-check rule so that we don't end up in the same situation again.