Fourth week...

Libvirt

Hello,

I started the week with a blast! I quickly got around to the deliverable for the week. I was able to complete the first two without any issue.

The first thing I did was review the pull request I submitted on podman-py's Github repository. Whenever I try running commands in a container, the client hangs; and this is because the API responsible for running the command expects containers to pass through the running condition/state.

Some of the commands I ran were so fast that the running state was skipped. Due to the quick runtime of these commands, it causes the container to skip to an exited/stopped state (indicating that all process in the container have been completed). Even though the container had exited, the API is still waiting for a container in a running condition thereby causing the program to hang.

I initially solved the problem by changing the condition to exited. This way, all workloads in the container will run, and when the container gets to the "exited" state, the API which was waiting for a container in an "exited" state works as expected.

The oversight with this solution was that the container would be left waiting for a long time (nothing happens until the container gets to an exited state) i.e the program will hang since it can't move forward until the container gets to an "exited" state ( which might take a lot of time). This was pointed out in a review by one of the developers in charge of the podman-py module.

The workaround solution was to set the condition to running and exited. This way, the program continues to run if the container is in a running state, and it also works fine if the container has gotten to an exited state (both conditions have been taken care of).

It was a really fun task because it was something fresh( I had been working on libvirt-ci for the last three weeks), and I also had the chance to work on another open-source software.

The issue also gave me a chance to learn about tox (it is used internally in podman-py for testing).

NOTE: I also fixed a linting error on podman-py repository. Open Source Engineer? :)

The second task was to refactor my fork of libvirt-ci i.e prepare the commits to give a very detailed history like I'm about to create a merge request against the main repository. What this task tested was really my git skills ( which have gotten a lot better since the internship started).

The last task was expanding the present usage of argparse in lcitool i.e add another level of command to the lcitool. The present usage of lcitool is lcitool container pynation, and this change will make it possible to run lcitool container build <pynation>, where "container" and "build" are commands.

I couldn't get to this task early in the week because I was mostly occupied with the other two tasks. After tinkering with the argparse module for a while to no avail, a quick search on the internet gave birth to this url which provided the solution. All I really had to do was create a parser called containerparser from the main subparser variable, add a subparser to containerparser which would serve as the base for the new commands to be added. Then, add parsers (which would serve as new commands) to the subparser generated by containerparser. Confusing, right? The diagram below shows this implementation.

lcitool-command.png

I had the weekly meeting with my mentor, and set deliverable for the next week.