Skip to content

Instantly share code, notes, and snippets.

@cwolferh
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cwolferh/9374507 to your computer and use it in GitHub Desktop.
Save cwolferh/9374507 to your computer and use it in GitHub Desktop.
#!/bin/bash
# On el6, to be run on the bare metal host after you have virtual networking
# set up.
yum install -y fence-virt fence-virtd fence-virtd-libvirt fence-virtd-multicast
for i in `ls /sys/class/net/*br*/bridge/multicast_querier`; do echo 1 > $i; done
if [ ! -f /etc/cluster/fence_xvm.key ]; then
mkdir -p /etc/cluster
dd if=/dev/random bs=512 count=1 of=/etc/cluster/fence_xvm.key
if [ -d /mnt/vm-share ]; then
cp /etc/cluster/fence_xvm.key /mnt/vm-share
fi
fi
# alternatively, you could generate this file from "fence_virtd -c"
cat > /etc/fence_virt.conf <<EOF
fence_virtd {
listener = "multicast";
backend = "libvirt";
module_path = "/usr/lib64/fence-virt";
}
listeners {
multicast {
key_file = "/etc/cluster/fence_xvm.key";
address = "225.0.0.12";
family = "ipv4";
interface = "virbr0";
port = "1229";
}
}
backends {
libvirt {
uri = "qemu:///system";
}
}
EOF
# you'll need to make this persistent
iptables -A INPUT -d 225.0.0.12/32 -p igmp -j ACCEPT
/sbin/service fence_virtd restart
# verify on your cluster vm's with:
# fence_xvm -o list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment