Forum
Welcome, Guest
Username: Password: Remember me

TOPIC:

HA (Lizard) and shutdown via USV/APCUPSD 7 years 11 months ago #758

Hi,

in my new 2node noSAN HA-Lizard cluster I have successfully installed and setup the apcupcd service.

This was done as mentioned here:

pantsmanuk.org/2015/04/apcupsd-running-on-citrix-xenserver-6-5/

According to a user comment you should do the local install with:

To ease the yum command, you can add : –disablerepo citrix –enablerepo base

This will reduce the work needed and the chance to do unwanted changes in repository config files.


After these steps you could configure the service.

I have modified the included vm_shutdown.sh script to my needs.

The base for this scipt was from posting #655, thanks to Robin.

----------------------------

#!/bin/bash

# Turn off HA-Lizard HA
XC_FIELD_NAME=ha-lizard-enabled

# Put your POOL_UUID here
POOL_UUID="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
# This is supposed to switch off ha-lizard VM restart
    xe pool-param-set uuid=$POOL_UUID other-config:XenCenter.CustomFields.$XC_FIELD_NAME=false
    echo xe pool-param-set uuid=$POOL_UUID other-config:XenCenter.CustomFields.$XC_FIELD_NAME=false

sleep 10s

###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

sleep 20s

###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 put master in maintenance)
        xe host-disable uuid=$HOST
        echo xe host-disable host=$HOST
sleep 20s

    elif [ $HOST = $MASTER_UUID ]
    then
        ###(uncomment following line to put master in maintenance)
        xe host-disable uuid=$HOST
        echo xe host-disable host=$HOST
    fi
done

sleep 20s

### before we perform the shutdown sequence we turn on again the HA-Lizard HA
### as after restarting the pool we want to have the VM#s running again!!!
        xe pool-param-set uuid=$POOL_UUID other-config:XenCenter.CustomFields.$XC_FIELD_NAME=true
    echo xe pool-param-set uuid=$POOL_UUID other-config:XenCenter.CustomFields.$XC_FIELD_NAME=true

###Shutdown all xen hosts in the pool exept 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

sleep 20

###finally shutdown pool master

   elif [ $HOST = $MASTER_UUID ]
    then
        ###(uncomment following line to perform actual shutdown)
        xe host-shutdown host=$HOST
       echo xe host-shutdown host=$HOST
    fi
done
----------------------------


One problem still persists after restarting the cluster. I have setup HA-Lizard to manage only vApps in order get the ability to boot vm's in a certain order and time.

This is not yet working as I assume that the HA-Lizard watchdog performs a killall before all vm's are fired up and does not wait the time the group of vm's need to fire up. They all come up but not in my requested order.

Maybe someone could advise me in the right direction.

Finally, thank you for such a great piece of software!

Andreas

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

HA (Lizard) and shutdown via USV/APCUPSD 7 years 11 months ago #759

Nice!
How is this script triggered?
How do you solve master/slave and switching of the roles?

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

HA (Lizard) and shutdown via USV/APCUPSD 7 years 11 months ago #760

  • Salvatore Costantino
  • Salvatore Costantino's Avatar
  • Offline
  • Posts: 722
Andreas,
Can you try setting OP_MODE=1 in this file and then try your test again:
/etc/ha-lizard/scripts/install.params

We verified the VAPP logic and it is working fine under normal HA. On a fresh boot, it is possible that your config cache is empty, in which case the params in /etc/ha-lizard/scripts/install.params would be loaded as a failsafe.

Please post your results.

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

HA (Lizard) and shutdown via USV/APCUPSD 7 years 11 months ago #761

The apcupcd service polls the battery according to the configuration file. Depending on the setting in this file various messages and triggers are fired. One is to perform a vm_shutdown.sh script.

The service and script is placed on both nodes but I have decided to wait on the slave a little bit longer before the script starts. Regardless were it is fired first all vm's are stopped, secnond the nodes are put in maintenance and finally they are shutdown, were the master stops as the last node.

It is surley not yet perfect but im working on it :)

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

HA (Lizard) and shutdown via USV/APCUPSD 7 years 11 months ago #762

We have tested again the vApps logic.

The setup is for 4 vm's in one group with the start order below

0 Ubuntu 14.04 LTS server
1 Windows XP IT1BLUE
2 Windows Server 2012r2 IT1FS3
3 Windows XP PR1MABO1

On each VM we have a start delay of 240s.

VM 0 and 2 having the master as homeserver VM 1 and 3 are put on the slave.

We have shutdown the cluster with disabled HA-Lizard custom field, but all four vm's do have this field set=true.

After a fresh reboot of both nodes we have set this cutom field on pool level true.

Result:

VM 0 starts on homeserver (master)
After 240s delay vm 1 and two are starting on the indended node at the same time.
After 240s delay VM 3 starts on hoemserver (slave).

I will change the setup with a total new vApps Group an put the Windows XP machines on two different homeservers and on position 0 and 3.

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

HA (Lizard) and shutdown via USV/APCUPSD 7 years 11 months ago #763

After disabling the HA-Lizard service, I have started the vApps group new, but the same behaviour. VM 1 and 2 are starting at the same time, even using different delays and numbers.

After removing the homeserver they start all at the same time???? :-(

It is obvious that this has nothing to do with HA-Lizard. I will check in the Citrix forum if this is a known bug or soemthing is wrong at my setup.

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

Last edit: by ajmind.