Playing around with libvirt and Open VirtualSwitch
Some time ago, we had a couple of inquiries about support for running KVM hypervisors with Open vSwitch (OVS). Older versions of OVS included the brcompat module, which made OVS work with regular Linux bridges instead of its own virtual switches. This meant Abiquo would behave as if it were using regular bridges. However, with recent versions of OVS, this brcompat module has been deprecated and it is not working as well as it should. Support for OVS is in our development roadmap, but in the meantime, we will explain how to “hack” an unsupported version of this feature using libvirt “domain events”.
One of the KEY points of Abiquo is that you can use its API to access ALL resources and actions available from the graphical user interface. This enables us to create an infinite number of external applications that you can integrate with your environment or platform. All the API resources are documented on our wiki.
In this article, we are going to present the Abiquo Events Notifier, a Python tool that monitors events performed in Abiquo and based on a configurable list of rules, sends notifications by email to the cloud administrators, enterprise administrators, etc. This tool can be very useful for the cloud administrator in tracking errors on the platform. Also, you can configure the tool to notify your users when a deploy is finished or if a virtual appliance they own has been undeployed. You can find the full documentation on Abiquo DevOps wiki
In their day-to-day work, developers often have to perform the same task over and over, losing valuable time that could be spent on more productive things.
As good geeks/developers, the first thing that comes to mind is to automate those tasks, and writing small scripts or programs to perform them is the most common solution. However, it is easy to end up with a bunch of scripts which are difficult to maintain and share. To be more effective, we have written a little pluggable command line tool, to aggregate all these scripts and to provide an easy way to add and remove features. This post describes the core parts of this simple tool so anyone can build their own command line tool in seconds and complete it with their own plugins.
The command line tool has the following syntax: cli <plugin> <command> [<arguments>]
So for example, we could build a couple of plugins and invoke them as follows:
- cli environment generate
- cli image upload –target=<url>
Our tool will invoke the appropriate method of the referenced plugin, providing all the command line arguments, so the plugin has all it needs to run.
Ok, this seems cool. Let’s get into the code!