On 4 Jul 2014, at 3:16 pm, Giuseppe Ragusa <giuseppe.rag...@hotmail.com> wrote:

> Hi all,
> I'm trying to create a script as per subject (on CentOS 6.5, CMAN+Pacemaker, 
> only DRBD+KVM active/passive resources; SNMP-UPS monitored by NUT).
> 
> Ideally I think that each node should stop (disable) all locally-running 
> VirtualDomain resources (doing so cleanly demotes than downs the DRBD 
> resources underneath), then put itself in standby and finally shutdown.

Since the end goal is shutdown, why not just run 'pcs cluster stop' ?
Possibly with 'pcs cluster standby' first if you're worried that stopping the 
resources might take too long.

Pacemaker will stop everything in the required order and stop the node when 
done... problem solved?

> 
> On further startup, manual intervention would be required to unstandby all 
> nodes and enable resources (nodes already in standby and resources already 
> disabled before blackout should be manually distinguished).
> 
> Is this strategy conceptually safe?
> 
> Unfortunately, various searches have turned out no "prior art" :)
> 
> This is my tentative script (consider it in the public domain):
> 
> ------------------------------------------------------------------------------------------------------------------------------------
> #!/bin/bash
> 
> # Note: "pcs cluster status" still has a small bug vs. CMAN-controlled 
> Corosync and would always return != 0
> pcs status > /dev/null 2>&1
> STATUS=$?
> 
> # Detect if cluster is running at all on local node
> # TODO: detect node already in standby and bypass this
> if [ "${STATUS}" = 0 ]; then
>     local_node="$(cman_tool status | grep -i 'Node[[:space:]]*name:' | sed -e 
> 's/^.*Node\s*name:\s*\([^[:space:]]*\).*$/\1/i')"
>     for local_resource in $(pcs status 2>/dev/null | grep 
> "ocf::heartbeat:VirtualDomain.*${local_node}\\s*\$" | awk '{print $1}'); do
>         pcs resource disable "${local_resource}"
>     done
>     # TODO: each resource disabling above may return without waiting for 
> complete stop - wait here for "no more resources active"? (but avoid endless 
> loops)
>     pcs cluster standby "${local_node}"
> fi
> 
> # Shut down gracefully anyway at the end
> /sbin/shutdown -h +0
> 
> ------------------------------------------------------------------------------------------------------------------------------------
> 
> Comments/suggestions/improvements are more than welcome.
> 
> Many thanks in advance.
> 
> Regards,
> Giuseppe
> 
> _______________________________________________
> Pacemaker mailing list: Pacemaker@oss.clusterlabs.org
> http://oss.clusterlabs.org/mailman/listinfo/pacemaker
> 
> Project Home: http://www.clusterlabs.org
> Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
> Bugs: http://bugs.clusterlabs.org

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
Pacemaker mailing list: Pacemaker@oss.clusterlabs.org
http://oss.clusterlabs.org/mailman/listinfo/pacemaker

Project Home: http://www.clusterlabs.org
Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
Bugs: http://bugs.clusterlabs.org

Reply via email to