Google Summer of Code 2021 (3)

Introduction

Project Goal

The test driver (as accessed via the test:/// URI scheme) is a fake virt driver designed to let applications test against libvirt with fake data and not have any effect on the host. As can be seen from the API coverage report http://libvirt.org/hvsupport.html there are quite a few APIs not yet implemented in the test driver. Ideally, the test driver would have 100% API coverage, and so the goal of the project is to address gaps in the API coverage.

And my work is trying to expand API coverage as much as possible.

Why do we have to implement these things?

With the test driver, we don't have to run a daemon, we don't have to care about what virtualization tech does current system support, we can just test libvirt's APIs with virsh or other tools and get to know what the API behavior is. And when the test driver shares some common code with other drivers, when can test the code using the test driver and don't have to create a real virtual machine with that virtualization tech, that's pretty convenient. At the same time, the API implementations of the test driver are also references for other drivers, as the test driver's implementation does not have all the unrelated handling. So far, there are a lot of APIs remain unimplemented, so we have to expand the API coverage.

What I've done

In the past 10 weeks, I have implemented 19 APIs, 6 of them merged and 13 of them still need review or adjustment. They are listed below

All (19)

GitLab link

Merged (12)

Not merged yet (6)

Blogs about GSoC and Libvirt

Planning to write another or more blogs to describe how to implement one test API in the future.

Conclusion & Acknowledgments

In the past 10 weeks, I learned a lot about libvirt's codebase and how the community runs, I have to say that the project is not as easy as I thought weeks ago. We need to keep the code clear and de-duplicate some code so that we can reuse them. We also have to write a lot of tests, that ensure everything runs correctly and once there is something wrong, we can quickly find it. And memory safe is pretty important too. I have to care about all these things when submitting patches to the community, and try to write some high-quality code really improves my C skill. Sometimes I thought I was careful enough, but when my mentors review my patches, they can always find some shortcomings, thank them, and that teaches me the importance of review and cooperation, also reminds me that I have a lot to learn.

So, what's next? First, I would like to complete my current patches and make them merged. Though the GSoC has ended, I will still contribute to libvirt and implement more test driver APIs in the future, I think it's a pretty nice experience to work with the libvirt community, and I'm also interested in implementing these APIs.

I really appreciate my mentors, Martin Kletzander and Michal Prívozník, thank them for answering my questions, spending time reviewing my patches, and sharing their knowledge with me, without their help, I won't complete these works. I also would like to express my gratitude towards other devs, I learned a lot from them too.