[Pacemaker] Manging Virtual Machine's resource

Lon Hohberger lhh at redhat.com
Fri May 16 13:28:07 UTC 2008


On Fri, 2008-05-16 at 18:34 +0530, Nitin wrote:
> Hello,
> 
> I would like to make my virtual machines (DomUs) resources to
> participate in the HA cluster. Dom0 (Physical Host) may or may not have
> resources. 
> 
> To do this I would like to treat DomUs as *resource* in the cluster as
> opposed to treating them as *nodes*. I am planning to write OCF resource
> agents for virtual machines. But I am not very sure about how to make a
> resource's resource to participate in the cluster.

>From a different project, I have a simplistic resource agent for this if
Pacemaker doesn't yet; you can use it as a starting point:

http://sources.redhat.com/git/?p=cluster.git;a=history;f=rgmanager/src/resources/vm.sh;h=f192e2d652674e6f023d560c8c33ca308ee85394;hb=STABLE2

Because rgmanager and pacemaker diverged slightly on the OCF RA API
metadata bits, there might be some small tweaks required.


I also have a domU -> dom0 fencing bridge via libvirt, but I *haven't*
written a STONITH module for it (just linux-cluster style fencing agent;
maybe we could use the external plugin in the short term?).  This agent
is unrelated to the resource-agent above, but certainly can be used in
conjunction with it.

For the fencing agent to work with domUs (that are moving around), dom0s
need to be in a CMAN+openais cluster right now, but we could drop this
and make this an openais-only requirement if you'd like (it shouldn't be
hard, but we'd lose physical node fencing information in the
short-term).

Here's the design:

http://sources.redhat.com/git/?p=cluster.git;a=blob;f=fence/agents/xvm/README;h=401666d9ce329a566561207cf7049b5744cc4c57;hb=STABLE2

Note that the design (or more specifically, use of libvirt)
theoretically allows the fencing/STONITH agent to be automatically
extended to support KVM, UML, or any other virtual machine class for
which libvirt has a plugin. ;)  Everything works in theory, though
(probably tweaks required to make it work with non-Xen virtual machines;
heck, tweaks were required to make it work with full-virt Xen...)


Here's the agent and the server side (again, no STONITH module, but it
shouldn't be hard):

http://sources.redhat.com/git/?p=cluster.git;a=tree;f=fence/agents/xvm;h=cfa4dd8ce90b9bd0e748a582decfb96b44458680;hb=STABLE2


> Is there any configuration in existing structure to achieve this?? If
> no
> then please tell me how to go about creating a "container" resource in
> CRM.

So, because the above are not fully in-tune with pacemaker yet, there's
no good examples.  I'll work with you to get either or both of the above
working on pacemaker (obviously, if there's already an agent written for
pacemaker, there's no need to do much on the vm agent).


If you'd like to work with me on it, I'm sure we can get one or both of
the above working on pacemaker, but it'll take a few days.

-- Lon





More information about the Pacemaker mailing list