Whenever I used a good software before, I never bothered or thought about what are all difficulties the software faced during its
development. And now working on PyTI for over a month, I came to realize that there is a lot of sweat behind any good project.
This reminded me to write a blog on what difficulties we faced for PyTI.
If you have been following my blog , you already know that PyTI uses libvirt for virtualization and libguestfs for mounting the
file system on host. There have been couple of problems we faced using these libraries and I will illustrate how we tackled those problems. Also mentioned is the lessons I learnt through the journey.
1) Snapshot Error:
PyTI is interfaced to Virtualbox using libvirt. There was once a problem occurred that I couldnt take snapshots of any disks , except VMs attached to live boot images. After some amount of searching here and there, I realized that the disk which I was taking snapshot was already to more than one VM . So disconnecting the VM from one of the disk solved the problem .
Lesson learnt : Its always easy to blame others for mistakes. (in this case the “library” libvirt)
2) Support for shared folders:
One of the initial solution we thought of implementing for transferring data from host and guest was
by using shared folders. As you might be aware that Virtual Box has a feature of “shared folders” which allows you to access a host
folder from guest machine. Since any VM used in PyTI does not have network access, this we thought as the most viable solution.We were relying on it a big time. Soon, we realized that libvirt library does not yet support shared folder(at that time). Then we decided to
scrap the idea and go for Flux based solutions . Now we use libguestfs library.
Lesson learnt : Its easy to have a solution and assume that it will always work out.
3) Downloading files from virtual hard disk:
We had a problem downloading files from Virtual Hard disk . After some searches, we realized that VirtualBox creates a diff image
when a snapshot is taken and libguestfs tries to access from diff image and not the original disk. Having two disks solved our problem
one for IO , which we dont take snapshot and another for testing purposes which we take snapshot of (but dont require to access data from it on the host)
Lesson learnt : Read the documentation first