Forum
Welcome, Guest
Username: Password: Remember me

TOPIC:

HA (Lizard) and shutdown via USV/APCUPSD 8 years 3 months ago #647

  • Salvatore Costantino
  • Salvatore Costantino's Avatar
  • Offline
  • Posts: 722
Joshua,

You are correct with respect to the proper ordering of events.

- disable HA
- shutdown ALL VMs on slave
- slave can be safely shutdown
- shutdown ALL VMs on master
- master can be shutdown

To ensure that the above is executed in the correct order - you could consider having the master perform each of the steps (rather than a third machine).. This way you can make sure the slave is shutdown first. To be safe - you could place such a shutdown script on both machines - but craft it so that it can only be run from a master.. This way if your servers ever swap roles you need not worry about the slave running the script.

Please Log in or Create an account to join the conversation.

HA (Lizard) and shutdown via USV/APCUPSD 8 years 3 months ago #648

Thanks for the info.

I'll give this all a go when I get a chance.

Josh

Please Log in or Create an account to join the conversation.

HA (Lizard) and shutdown via USV/APCUPSD 8 years 3 months ago #655

Hi,

here is the script i am using

---------------------------- 8< ------------------------ 8< ----------
#!/bin/bash

# Turn off HA-Lizard HA
XC_FIELD_NAME='ha-lizard-enabled'
# Put your POOL_UUID here
POOL_UUID="92f8f98f-45f9-fad0-712d-54a5c73b20af"

# This is supposed to switch off ha-lizard VM restart
# Not sure if its correct
xe pool-param-set uuid=$POOL_UUID other-config:XenCenter.CustomFields.$XC_FIELD_NAME=false

###enumerate uuid's of all _running_ VMs in the pool
for VM in `xe vm-list is-control-domain=false power-state=running params=uuid | egrep -o "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"`
do
    ###(uncomment following line to perform actual shutdown)
    xe vm-shutdown vm=$VM
    echo xe vm-shutdown vm=$VM 
done

###get uuid of pool master - it must be the very last to shut down
MASTER_UUID=`xe pool-list params=master --minimal`

echo Master is $MASTER_UUID

###enumerate of all xen hosts in the pool except master
for HOST in `xe host-list params=uuid --minimal | egrep -o "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"`
do
    if [ $HOST != $MASTER_UUID ]
    then
        ###(uncomment following line to perform actual shutdown)
        xe host-shutdown host=$HOST
        echo xe host-shutdown host=$HOST
    fi
done

###finally shutdown pool master
###(uncomment following line to perform actual shutdown)
xe host-shutdown host=$HOST
echo xe host-shutdown host=$HOST

---------------------------- 8< ------------------------ 8< ----------

Please Log in or Create an account to join the conversation.

HA (Lizard) and shutdown via USV/APCUPSD 8 years 2 weeks ago #741

So how did the testing go?
How do you put it together with apcupsd?
Thanks

Please Log in or Create an account to join the conversation.

HA (Lizard) and shutdown via USV/APCUPSD 8 years 2 weeks ago #742

This is going back a little while so excuse the memory but I did test a few things, didn't quite get it going but didn't really spend a lot of time on it mainly as I moved away from High Availability.

Didn't really need it (Test bed) and I started getting some issues with it. Can't remember what exactly though.

Josh

Please Log in or Create an account to join the conversation.

HA (Lizard) and shutdown via USV/APCUPSD 8 years 2 weeks ago #745

Hi,

i got it working with "NUT" instead of apcupsd. Apcupsd didnt work via (HP) serial interface with the UPS we bought, "NUT" did.

networkupstools.org/

It should be easy to locate an installable NUT package for Xenserver.

cheers,

Arnd

Please Log in or Create an account to join the conversation.