[CentOS] KVM HA

Wed Jun 22 05:20:10 UTC 2016
Digimer <lists at alteeve.ca>

On 22/06/16 01:01 AM, Tom Robinson wrote:
> Hi,
> 
> I have two KVM hosts (CentOS 7) and would like them to operate as High Availability servers,
> automatically migrating guests when one of the hosts goes down.
> 
> My question is: Is this even possible? All the documentation for HA that I've found appears to not
> do this. Am I missing something?

Very possible. It's all I've done for years now.

https://alteeve.ca/w/AN!Cluster_Tutorial_2

That's for EL 6, but the basic concepts port perfectly. In EL7, just
change out cman + rgmanager for pacemaker. The commands change, but the
concepts don't. Also, we use DRBD but you can conceptually swap that for
"SAN" and the logic is the same (though I would argue that a SAN is less
reliable).

There is an active mailing list for HA clustering, too:

http://clusterlabs.org/mailman/listinfo/users

> My configuration so fare includes:
> 
>  * SAN Storage Volumes for raw device mappings for guest vms (single volume per guest).
>  * multipathing of iSCSI and Infiniband paths to raw devices
>  * live migration of guests works
>  * a cluster configuration (pcs, corosync, pacemaker)
> 
> Currently when I migrate a guest, I can all too easily start it up on both hosts! There must be some
> way to fence these off but I'm just not sure how to do this.

Fencing, exactly.

What we do is create a small /shared/definitions (on gfs2) to host the
VM XML definitions and then undefine the VMs from the nodes. This makes
the servers disappear on non-cluster aware tools, like
virsh/virt-manager. Pacemaker can still start the servers just fine and
pacemaker, with fencing, makes sure that the server is only ever running
on one node at a time.

> Any help is appreciated.
> 
> Kind regards,
> Tom

We also have an active freenode IRC channel; #clusterlabs. Stop on by
and say hello. :)

-- 
Digimer
Papers and Projects: https://alteeve.ca/w/
What if the cure for cancer is trapped in the mind of a person without
access to education?