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