A Test Kitchen Driver for Libvirt
-
Install ChefDK.
-
Install libvirt.
-
Build the images.
-
Add Libvirt configuration to the
driver
section of your.kitchen.yml
-
Existing configuration
driver: name: libvirt uri: qemu:///session
-
New configuration
kitchen init --driver libvirt
-
Run
kitchen test
.
- Libvirt (
4.0.0
)
The Libvirt connection URI
Default: qemu:///system
The username to use when connecting to libvirt.
Default: nil
The password to use when connecting to libvirt.
Default: nil
The instance cpu count
Default: 1
The instance memory in Megabytes
Default: 1024
Determines ephemerality of the instance
Default: true
The bridge device to use for networking.
Default: virbr0
The network name to attach to the instance
Default: default
The type of instance to crate
Default: kvm
Specify the image by leaving image_id
and image_search
blank, and specifying a standard platform name.
platforms:
- name: ubuntu-14.04
You may leave versions off, specify partial versions, and you may specify architecture to distinguish 32- and 64-bit.
platforms:
- name: centos-7
- name: ubuntu-16.04-i386
We always pick the highest released stable version that matches your regex, and
follow the other image_search
rules for preference.
When using an existing key, or keys that exist on the instance through some other means, ensure that the private key is configured in your Test Kitchen transport
section, either directly or made available via ssh-agent
:
transport:
ssh_key: ~/.ssh/vagrant_insecure_private_key
For standard platforms we automatically provide the SSH username, but when specifying your own AMI you may need to configure that as well.
A list of block device mappings for the machine. An example of all available keys looks like:
volumes:
- format: raw
pool: default
size: 20G
backing_volume: /var/lib/libvirt/golden.img
The following could be used in a .kitchen.yml
or in a .kitchen.local.yml
to override default configuration.
---
driver:
name: libvirt
uri: qemu:///session
transport:
username: vagrant
ssh_key: ~/.vagrant.d/insecure_private_key
platforms:
- name: ubuntu-16.04
- name: centos-7
driver:
cpus: 2
memory: 2048
transport:
username: centos
suites:
- name: default
driver:
volumes:
- format: qcow2
pool: default
size: 10G
- format: qcow2
pool: default
size: 10G
run_list:
attributes:
- Source hosted at GitHub
- Report issues/questions/feature requests on GitHub Issues
Pull requests are very welcome! Make sure your patches are well tested. Ideally create a topic branch for every separate change you make. For example:
- Fork the repo
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request