In order to allow MAAS to be able to boot KVM virtual machines (via libvirt
), these are the steps that one has to follow. They are intended for a Ubuntu system, but you can easily figure out how to make them work on Fedora or CentOS:
$ sudo apt-get install libvirt-bin
When adding nodes to MAAS that run as KVM virtual machines, the node configuration in MAAS will have to be updated to properly reflect the power type. In this case, the power type will be virsh
. The virsh
power type requires two fields: the “address” and the “power ID”. The “address” is just a libvirt
URL. For example, qemu:///system
for accessing libvirt
on the local host, or qemu+ssh://root@hostname/system
to access libvirt
as root
over SSH. The “power ID” field is just the virtual machine name or identifier.
In order to use SSH to access libvirt
from MAAS, an SSH private key will have to be generated, and the public key uploaded to the host where the libvirt
server is running:
$ sudo mkdir -p /home/maas sudo chown maas:maas /home/maas sudo chsh -s /bin/bash maas sudo -u maas ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/maas/.ssh/id_rsa): Created directory '/home/maas/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/maas/.ssh/id_rsa. Your public key has been saved in /home/maas/.ssh/id_rsa.pub.
Finally, add the public key to /root/.ssh/authorized_keys2 where the libvirt
server is running, so that virsh
can SSH into it without a password:
$ sudo -u maas ssh-copy-id root@hostname
Finally, as the maas
user, test the connection:
$ sudo -u maas virsh -c qemu+ssh://root@hostname/system list -all