Add Libvirt Hypervisor slave support to Jenkins

libvirt-slaves 1.8 uses a newer libvirt java binding. If you are upgrading from an earlier version of this plugin, you will have to reconfigure your hypervisor settings and thus also all libvirt-controlled nodes!
The least painful approach (especially for larger setups) is to properly set up the Hypervisor first, followed by editing each node, pointing it to the reconfigured Hypervisor. It is not necessary to delete node configurations!


This plugin for Jenkins CI adds a way to control guest domains hosted on Xen or QEMU/KVM. You configure a Jenkins Slave, selecting the guest domain and hypervisor. When you need to build a job on a specific Slave, its guest domain is started, then the job is run. When the build process is finished, the guest domain is shut down, ready to be used again as required.


For a communication with Hypervisors you need to install libvirt library on Jenkins machine. This plugin comes with libvirt java binding, but is just an interface to the "real" C libvirt library. In your distribution you should have a package to install libvirt (ie yum install libvirt on RedHat/Fedora/Centos distributions).



The first step is the Hypervisor configuration. To create a new Hypervisor you need to add a new "Cloud" in the Jenkins "Manage Jenkins" menu.


The required parameters to setup are:

The connection to Hypervisor will be done using ssh, so you don't need to setup libvirt, exposing your services on tcp that could be a security hole in your infrastructure. Here an example of connection string will be used by Libvirt Slaves Plugin to create a connection with the hypervisor:


you can test you connection typing, from your Jenkins Server:

 virsh connect xen+ssh://username@hostname:port/system

An important thing is the RSA public key exchange between Jenkins Server and Hypervisor Machine: you need to add to .ssh/known_hosts file the rsa.pub file of your jenkins user. This because, for an actual limitation in libvirt java library, it's impossible to provide via code the ssh password, that means Jenkins could not establish a connection if password request will be prompted.

To verify all you parameters you can click on Test Connection button and check the output reported.


Now you can setup your nodes in Jenkins and use them to build your projects.

Once the node is created, you'll see the configuration page as shown below:

Here you can configure the following details:

Change Log

Version 1.8.5 (Apr 01, 2015)
Version 1.8.1 (Mar 21, 2013)
Version 1.8 (Mar 20, 2013)
Version 1.7 (Jan 31, 2013)
Version 1.6 (Apr 2, 2010)
Version 1.5 (Mar 30, 2010)
Version 1.4 (Mar 25, 2010)
Version 1.3 (Mar 20, 2010)
Version 1.2 (Mar 10, 2010)
Version 1.1 (Mar 08, 2010)
Version 1.0 (Mar 07, 2010)