Product SiteDocumentation Site

4.3.2. Integrate as Guest Node

If you didn’t already do this earlier in the verify host to guest connection section, add the KVM guest’s IP address to the host’s /etc/hosts file so we can connect by hostname. For this example:
# cat << END >> /etc/hosts
192.168.122.10    guest1
END
We will use the VirtualDomain resource agent for the management of the virtual machine. This agent requires the virtual machine’s XML config to be dumped to a file on disk. To do this, pick out the name of the virtual machine you just created from the output of this list.
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     guest1                         shut off
In my case I named it guest1. Dump the xml to a file somewhere on the host using the following command.
# virsh dumpxml guest1 > /etc/pacemaker/guest1.xml
Now just register the resource with pacemaker and you’re set!
# pcs resource create vm-guest1 VirtualDomain hypervisor="qemu:///system" \
    config="/etc/pacemaker/guest1.xml" meta remote-node=guest1

Note

This example puts the guest XML under /etc/pacemaker because the permissions and SELinux labeling should not need any changes. If you run into trouble with this or any step, try disabling SELinux with setenforce 0. If it works after that, see SELinux documentation for how to troubleshoot, if you wish to reenable SELinux.

Note

Pacemaker will automatically monitor pacemaker_remote connections for failure, so it is not necessary to create a recurring monitor on the VirtualDomain resource.
Once the vm-guest1 resource is started you will see guest1 appear in the pcs status output as a node. The final pcs status output should look something like this.
# pcs status
Cluster name: mycluster
Last updated: Fri Oct  9 18:00:45 2015          Last change: Fri Oct  9 17:53:44 2015 by root via crm_resource on example-host
Stack: corosync
Current DC: example-host (version 1.1.13-a14efad) - partition with quorum
2 nodes and 2 resources configured

Online: [ example-host ]
GuestOnline: [ guest1@example-host ]

Full list of resources:

 vm-guest1      (ocf::heartbeat:VirtualDomain): Started example-host

PCSD Status:
  example-host: Online

Daemon Status:
  corosync: active/disabled
  pacemaker: active/disabled
  pcsd: active/enabled