This page tracks introductory tasks for new libvirt contributors. Code cleanups, bugs, and small features are listed with difficulty ranging from trivial to intermediate.
- 1 Beginner tasks
- 2 Slightly-less-beginner tasks
- 3 Bugs and feature requests from bugzilla (LibvirtFirstBug)
- 4 Ongoing code transitions
These tasks are good first introductions to libvirt code. You will be required to get things building and make sure the test suite passes, but not necessarily need to understand the details of what libvirt is doing. Mostly these are following existing example changes that are already in the code. Contact the listed mentor with any questions
Move validation checks out of domain XML parsing
Mentor: Cole Robinson <email@example.com>
The code that handles domain/VM XML parsing (
src/domain/domain_conf.c) has various validation checks sprinkled within it. Many of these checks should be moved out of the parse step and into
virDomainDefPostParse, so they can be shared by various places in the code that build a domain definition without XML, such as converting from native vmware/virtualbox/xen formats.
Not all validation checks can or should be moved. You'll need to determine if the check is specific to the actual XML parsing, or is it general for all VM configurations. So anything that throws an error if it hits unexpected XML should not be moved.
Just a few of the candidates for moving to
- All the checks against dom->os.type and dom->virtType in
virDomainInputDefParseXMLshould go into a
- The error "tray is only valid for cdrom and floppy" in
- 'disk vendor' and 'disk product' errors in
- all the option collision 'total and...' error messages in
- 'pci-root and pcie-root controllers should not' in
numaNoderange checks in
- "Controllers must use the 'ccid' address type" in
- any 'not available' or 'valid only' errors in
- All the 'only supported' errors in
- size validation in
- 'must be in range' errors in
- 'You must map the root user of container' in
- 'duplicate blkio device path' error
- 'Only one primary video device is supported' error
You can see an example commit here: https://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=265e6924f569431d431981c4c0d8d68baf0fb2a2
Clean up variables in tools/libvirt-guests.sh.in
Mentor: Martin Kletzander <firstname.lastname@example.org>
The script has many functions that just redeclare variables all over the place instead of making them local to the function using the
local keyword. There might be some errors due to the rewriting of the variables and it's also prone to error, so all such variables should be marked
local. There is at least one function that returns an information in a variable. Such occurrences might be fixed up or kept that way.
These tasks are slightly more involved than the beginner tasks, but still don't require extensive libvirt knowledge. If any of the beginner tasks seem too simple, maybe try one of these. Talk with the listed mentor if you have questions.
Move default Input bus logic to PostParse handling
Mentor: Cole Robinson <email@example.com>
Similar to what was started with default video model logic in these commits:
Break out the default bus setting logic from
virDomainInputDefParseXML and move it to PostParse handling. Look for anything that sets a def->bus value in that function, it's grounds for removal
Add additional virsh command line completion functions
Mentor: Michal Privoznik <firstname.lastname@example.org>
Completers are small functions that are called from the virsh command line tool whenever the user started typing something and hit TAB TAB. Their purpose is to offer list of strings that suit entered input. If there is only one item on the list then it's entered in automatically. For instance:
virsh # dom<TAB><TAB> domblkerror domblkstat domcontrol domfsinfo .. virsh # start --domain <TAB><TAB> fedora fedora.i686 freebsd gentoo ...
Additional functions are needed to improve other commands.
An example patch:
A series of example patches:
Bugs and feature requests from bugzilla (LibvirtFirstBug)
Some bugs in the libvirt bugzilla tracker are marked as good introductory bug reports or features for new contributors. These bugs have the 'LibvirtFirstBug' tag. Each bug report contains info and sample commits to point you in the right direction. You can open the list in your browser bugzilla here.
Failed to load RSS feed from 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=4999130&o1=substring&o2=anywordssubstr&order=bug_id&product=Virtualization%20Tools&query_based_on=&query_format=advanced&v1=LibvirtFirstBug&v2=libvirt&ctype=atom: Error parsing XML for RSS
Ongoing code transitions
In 2019 libvirt began using GLib internally. We can use GLib APIs to drop some libvirt-specific code.
virfile.c related to path handling can be replaced with g_path_* APIs. The callers should be made to invoke the GLib APIS directly.
XAttr / ACLs
virfile.c XAttr and ACL handling with GFileAttribute APIs
The callers of the various
virOnce, etc APIs should be switched to use the GLib threading APIs.
g_autofree and g_autoptr usage
g_autofree is a feature provided by GLib and the C compiler which will free a variable when it goes out of scope.
g_autoptr works similarly, but it will call a custom registred
free function instead.
We are slowly converting the code to use these new patterns. Any variable that is allocated and free'd within a single function can likely be converted to use
g_autoptr. Similarly, any usage of
VIR_FREE under a
cleanup: can likely be converted.
- Example series of g_autofree cleanups
- Example registering a g_autoptr function
- Example g_autoptr code coversions
virObject to GObject conversions
virObject implementation can be relatively easily replaced with GLib's
virObjectusers by running:
git grep 'virObject parent'
- Example conversion commit: https://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=16121a88a7ef933220bcf9eff6575367278a06f7;hp=b74a95d6a2950a7b9168d772b49e07a5d20a3f63