Difference between revisions of "BiteSizedTasks"

From Libvirt Wiki
Jump to: navigation, search
(Done upstream as v6.2.0-40-g08071ec0f1)
(Move validation checks out of domain XML parsing)
Line 5: Line 5:
  
 
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
 
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 <crobinso@redhat.com>
 
 
The code that handles domain/VM XML parsing (<code>virDomainDefParseXML</code> in <code>src/domain/domain_conf.c</code>) has various validation checks sprinkled within it. Many of these checks should be moved out of the parse step and into <code>virDomainDefPostParse</code>, 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 <code>virDomainDefPostParse</code>:
 
* All the checks against dom->os.type and dom->virtType in <code>virDomainInputDefParseXML</code> should go into a <code>virDomainInputDefValidate</code> function
 
* The error "tray is only valid for cdrom and floppy" in <code>virDomainDiskDefParseXML</code>
 
* 'disk vendor' and 'disk product' errors in <code>virDomainDiskDefParseXML</code>
 
* <code>host->socket</code> checks in <code>virDomainStorageNetworkParseHost</code>
 
* all the option collision 'total and...' error messages in <code>virDomainDiskDefIotuneParse</code>
 
* 'pci-root and pcie-root controllers should not' in <code>virDomainControllerDefParseXML</code>
 
* PCI <code>chassisNr</code>, <code>chassis</code>, <code>port</code>, <code>busNr</code>, <code>numaNode</code> range checks in <code>virDomainControllerDefParseXML</code>
 
* "Controllers must use the 'ccid' address type" in <code>virDomainSmartcardDefParseXML</code>
 
* any 'not available' or 'valid only' errors in <code>virDomainGraphicsListenDefParseXML</code>
 
* All the 'only supported' errors in <code>virDomainVideoDefParseXML</code>
 
* size validation in <code>virDomainMemoryTargetDefParseXML</code>
 
* 'must be in range' errors in <code>virDomainDefParseBootXML</code>
 
* 'You must map the root user of container' in <code>virDomainIdmapDefParseXML</code>
 
* '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
 
  
 
== Slightly-less-beginner tasks ==
 
== Slightly-less-beginner tasks ==

Revision as of 15:02, 17 April 2020

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


Beginner tasks

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

Slightly-less-beginner tasks

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 <crobinso@redhat.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 <mprivozn@redhat.com>

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

GLib replacements

In 2019 libvirt began using GLib internally. We can use GLib APIs to drop some libvirt-specific code.

Path functions

Functions in 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

Replace virfile.c XAttr and ACL handling with GFileAttribute APIs

Threads

The callers of the various virMutex, virThread, virCond, 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_autofree or g_autoptr. Similarly, any usage of VIR_FREE under a cleanup: can likely be converted.

virObject to GObject conversions

Our internal virObject implementation can be relatively easily replaced with GLib's GObject.