NovaEvacuate: Support the new split-out IHA fence agents with backwards compatibility
Change-Id: Ib43294fa1fe3e814d041167aabbfe46140032e24
This commit is contained in:
parent
416e6d8853
commit
b8b9a733ae
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright 2015 Red Hat, Inc.
|
||||
#
|
||||
|
@ -50,7 +50,6 @@ Authorization URL for connecting to keystone in admin context
|
|||
Username for connecting to keystone in admin context
|
||||
</longdesc>
|
||||
<shortdesc lang="en">Username</shortdesc>
|
||||
<content type="string" default="" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="password" unique="0" required="1">
|
||||
|
@ -70,14 +69,6 @@ Note that with Keystone V3 tenant names are only unique within a domain.
|
|||
<content type="string" default="" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="domain" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
DNS domain in which hosts live, useful when the cluster uses short names and nova uses FQDN
|
||||
</longdesc>
|
||||
<shortdesc lang="en">DNS domain</shortdesc>
|
||||
<content type="string" default="" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="endpoint_type" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
Nova API location (internal, public or admin URL)
|
||||
|
@ -106,12 +97,7 @@ This option should be used with caution.
|
|||
|
||||
<parameter name="no_shared_storage" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
Indicate that nova storage for instances is not shared across compute
|
||||
nodes. This must match the reality of how nova storage is configured!
|
||||
Otherwise VMs could end up in error state upon evacuation. When
|
||||
storage is non-shared, instances on dead hypervisors will be rebuilt
|
||||
from their original image or volume, so anything on ephemeral storage
|
||||
will be lost.
|
||||
Disable shared storage recovery for instances. Use at your own risk!
|
||||
</longdesc>
|
||||
<shortdesc lang="en">Disable shared storage recovery for instances</shortdesc>
|
||||
<content type="boolean" default="0" />
|
||||
|
@ -159,7 +145,7 @@ evacuate_start() {
|
|||
}
|
||||
|
||||
update_evacuation() {
|
||||
attrd_updater -p -n evacuate -Q -N ${1} -U ${2}
|
||||
attrd_updater -p -n evacuate -Q -N ${1} -v ${2}
|
||||
arc=$?
|
||||
if [ ${arc} != 0 ]; then
|
||||
ocf_log warn "Can not set evacuation state of ${1} to ${2}: ${arc}"
|
||||
|
@ -188,24 +174,26 @@ handle_evacuations() {
|
|||
now=$(date +%s)
|
||||
|
||||
if [ $(($now - $when)) -gt 60 ]; then
|
||||
ocf_log info "Processing partial evacuation of $node by" \
|
||||
"$where at $when"
|
||||
ocf_log info "Processing partial evacuation of $node by $where at $when"
|
||||
need_evacuate=1
|
||||
else
|
||||
# Give some time for any in-flight evacuations to either
|
||||
# complete or fail Nova won't react well if there are two
|
||||
# overlapping requests
|
||||
ocf_log info "Deferring processing partial evacuation of" \
|
||||
"$node by $where at $when"
|
||||
# Give some time for any in-flight evacuations to either complete or fail
|
||||
# Nova won't react well if there are two overlapping requests
|
||||
ocf_log info "Deferring processing partial evacuation of $node by $where at $when"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ $need_evacuate = 1 ]; then
|
||||
found=0
|
||||
ocf_log notice "Initiating evacuation of $node"
|
||||
fence_agent="fence_compute"
|
||||
|
||||
fence_compute ${fence_options} -o status -n ${node}
|
||||
if have_binary fence_evacuate
|
||||
then
|
||||
fence_agent="fence_evacuate"
|
||||
fi
|
||||
|
||||
ocf_log notice "Initiating evacuation of $node with $fence_agent"
|
||||
$fence_agent ${fence_options} -o status -n ${node}
|
||||
if [ $? = 1 ]; then
|
||||
ocf_log info "Nova does not know about ${node}"
|
||||
# Dont mark as no because perhaps nova is unavailable right now
|
||||
|
@ -217,7 +205,7 @@ handle_evacuations() {
|
|||
return $OCF_SUCCESS
|
||||
fi
|
||||
|
||||
fence_compute ${fence_options} -o off -n $node
|
||||
$fence_agent ${fence_options} -o off -n $node
|
||||
rc=$?
|
||||
|
||||
if [ $rc = 0 ]; then
|
||||
|
@ -239,8 +227,7 @@ evacuate_monitor() {
|
|||
fi
|
||||
|
||||
handle_evacuations $(
|
||||
attrd_updater -n evacuate -A \
|
||||
2> >(grep -v "attribute does not exist" 1>&2) |
|
||||
attrd_updater -n evacuate -A |
|
||||
sed 's/ value=""/ value="no"/' |
|
||||
tr '="' ' ' |
|
||||
awk '{print $4" "$6}'
|
||||
|
@ -252,7 +239,10 @@ evacuate_validate() {
|
|||
rc=$OCF_SUCCESS
|
||||
fence_options=""
|
||||
|
||||
|
||||
if ! have_binary fence_evacuate
|
||||
check_binary fence_compute
|
||||
fi
|
||||
|
||||
# Is the state directory writable?
|
||||
state_dir=$(dirname $statefile)
|
||||
|
@ -291,10 +281,6 @@ evacuate_validate() {
|
|||
|
||||
fence_options="${fence_options} -t ${OCF_RESKEY_tenant_name}"
|
||||
|
||||
if [ -n "${OCF_RESKEY_domain}" ]; then
|
||||
fence_options="${fence_options} -d ${OCF_RESKEY_domain}"
|
||||
fi
|
||||
|
||||
if [ -n "${OCF_RESKEY_region_name}" ]; then
|
||||
fence_options="${fence_options} \
|
||||
--region-name ${OCF_RESKEY_region_name}"
|
||||
|
@ -314,11 +300,9 @@ evacuate_validate() {
|
|||
|
||||
if [ -n "${OCF_RESKEY_endpoint_type}" ]; then
|
||||
case ${OCF_RESKEY_endpoint_type} in
|
||||
adminURL|publicURL|internalURL)
|
||||
;;
|
||||
adminURL|publicURL|internalURL) ;;
|
||||
*)
|
||||
ocf_exit_reason "endpoint_type ${OCF_RESKEY_endpoint_type}" \
|
||||
"not valid. Use adminURL or publicURL or internalURL"
|
||||
ocf_exit_reason "endpoint_type ${OCF_RESKEY_endpoint_type} not valid. Use adminURL or publicURL or internalURL"
|
||||
exit $OCF_ERR_CONFIGURED
|
||||
;;
|
||||
esac
|
||||
|
|
Loading…
Reference in New Issue