Product SiteDocumentation Site

4.3.3. Starting Resources on KVM Guest

The commands below demonstrate how resources can be executed on both the guest node and the cluster node.
Create a few Dummy resources. Dummy resources are real resource agents used just for testing purposes. They actually execute on the host they are assigned to just like an apache server or database would, except their execution just means a file was created. When the resource is stopped, that the file it created is removed.
# pcs resource create FAKE1 ocf:pacemaker:Dummy
# pcs resource create FAKE2 ocf:pacemaker:Dummy
# pcs resource create FAKE3 ocf:pacemaker:Dummy
# pcs resource create FAKE4 ocf:pacemaker:Dummy
# pcs resource create FAKE5 ocf:pacemaker:Dummy
Now check your pcs status output. In the resource section, you should see something like the following, where some of the resources started on the cluster node, and some started on the guest node.
Full list of resources:

 vm-guest1      (ocf::heartbeat:VirtualDomain): Started example-host
 FAKE1  (ocf::pacemaker:Dummy): Started guest1
 FAKE2  (ocf::pacemaker:Dummy): Started guest1
 FAKE3  (ocf::pacemaker:Dummy): Started example-host
 FAKE4  (ocf::pacemaker:Dummy): Started guest1
 FAKE5  (ocf::pacemaker:Dummy): Started example-host
The guest node, guest1, reacts just like any other node in the cluster. For example, pick out a resource that is running on your cluster node. For my purposes, I am picking FAKE3 from the output above. We can force FAKE3 to run on guest1 in the exact same way we would any other node.
# pcs constraint location FAKE3 prefers guest1
Now, looking at the bottom of the pcs status output you’ll see FAKE3 is on guest1.
Full list of resources:

 vm-guest1      (ocf::heartbeat:VirtualDomain): Started example-host
 FAKE1  (ocf::pacemaker:Dummy): Started guest1
 FAKE2  (ocf::pacemaker:Dummy): Started guest1
 FAKE3  (ocf::pacemaker:Dummy): Started guest1
 FAKE4  (ocf::pacemaker:Dummy): Started example-host
 FAKE5  (ocf::pacemaker:Dummy): Started example-host