Cluster failover rules / VM priorities?

n1nj4888

Active Member
Jan 13, 2019
162
21
38
44
Hi there,

I currently have 2 standalone PVE nodes (pointing to the same NFS storage) and am thinking of clustering them with a 3rd qdevice node for HA.

Both standalone nodes are (different versions of) Intel NUC, both with Intel IGP GPU which appears to Proxmox as the same ID. Currenty I run VM1 (with IGP passthrough) on Node 1 and VM2 (with IGP passthrough) on Node 2.

I can start VM1 on either Node 1 OR Node 2 and can start VM2 on either Node 1 or Node 2 but both VM1 AND VM2 cannot run on the same host (since both passthrough the host’s IGP)...

If I were to cluster these hosts and set VM1 to run on host 1 and VM2 to run on host 2, Could I configure a rule such that VM1 is the priority and, in the event of Node 1 going down, VM2 is automatically stopped on Node 2 and VM1 is brought up on Node2 (and when Node 1 becomes available again, VM1 moves back to Node 1 and VM2 is started again on Node2)?

Thanks!
 
hi,

not directly no, but you can workaround this

first you could enable ha on vm1, this would try to start vm1 on node2 in case node1 goes down, which will obviously fail if vm2 is already running...
now you can add a hookscript to vm1 (which is ideally on the nfs server so it can be read from both nodes) which will stop vm2 in the 'pre-start' part of the hook iff vm1 is to be started on node2

a hookscript would roughly look like this (in perl):

Code:
my $vmid = shift;
my $phase = shift;

my $hostname = <some way to read the hostname>;

if ($phase eq 'pre-start' && $vmid == VMID-OF-VM1 && $hostname eq 'node2' ) {
system("qm shutdown VMID-OF-VM2");
}
exit(0);

for a better and more complete example for the hookscripts, see the example in /usr/share/pve-docs/examples/guest-example-hookscript.pl
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!