|
|
ba40ba |
From bd60deaa906cc5fe1cd46549b1318d2b940395ef Mon Sep 17 00:00:00 2001
|
|
|
ba40ba |
From: David Vossel <dvossel@redhat.com>
|
|
|
ba40ba |
Date: Thu, 11 Jun 2015 08:41:50 -0500
|
|
|
ba40ba |
Subject: [PATCH] NovaCompute agent
|
|
|
ba40ba |
|
|
|
ba40ba |
---
|
|
|
ba40ba |
doc/man/Makefile.am | 1 +
|
|
|
ba40ba |
heartbeat/Makefile.am | 4 +
|
|
|
ba40ba |
heartbeat/NovaCompute | 363 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
ba40ba |
3 files changed, 368 insertions(+)
|
|
|
ba40ba |
create mode 100644 heartbeat/NovaCompute
|
|
|
ba40ba |
|
|
|
ba40ba |
diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am
|
|
|
ba40ba |
index 653e818..69acf3a 100644
|
|
|
ba40ba |
--- a/doc/man/Makefile.am
|
|
|
ba40ba |
+++ b/doc/man/Makefile.am
|
|
|
ba40ba |
@@ -73,6 +73,7 @@ man_MANS = ocf_heartbeat_AoEtarget.7 \
|
|
|
ba40ba |
ocf_heartbeat_MailTo.7 \
|
|
|
ba40ba |
ocf_heartbeat_ManageRAID.7 \
|
|
|
ba40ba |
ocf_heartbeat_ManageVE.7 \
|
|
|
ba40ba |
+ ocf_heartbeat_NovaCompute.7 \
|
|
|
ba40ba |
ocf_heartbeat_Pure-FTPd.7 \
|
|
|
ba40ba |
ocf_heartbeat_Raid1.7 \
|
|
|
ba40ba |
ocf_heartbeat_Route.7 \
|
|
|
ba40ba |
diff --git a/heartbeat/Makefile.am b/heartbeat/Makefile.am
|
|
|
ba40ba |
index e4ed4fd..b77c589 100644
|
|
|
ba40ba |
--- a/heartbeat/Makefile.am
|
|
|
ba40ba |
+++ b/heartbeat/Makefile.am
|
|
|
ba40ba |
@@ -29,6 +29,8 @@ halibdir = $(libexecdir)/heartbeat
|
|
|
ba40ba |
|
|
|
ba40ba |
ocfdir = $(OCF_RA_DIR_PREFIX)/heartbeat
|
|
|
ba40ba |
|
|
|
ba40ba |
+ospdir = $(OCF_RA_DIR_PREFIX)/openstack
|
|
|
ba40ba |
+
|
|
|
ba40ba |
dtddir = $(datadir)/$(PACKAGE_NAME)
|
|
|
ba40ba |
dtd_DATA = ra-api-1.dtd
|
|
|
ba40ba |
|
|
|
ba40ba |
@@ -50,6 +52,8 @@ send_ua_SOURCES = send_ua.c IPv6addr_utils.c
|
|
|
ba40ba |
IPv6addr_LDADD = -lplumb $(LIBNETLIBS)
|
|
|
ba40ba |
send_ua_LDADD = $(LIBNETLIBS)
|
|
|
ba40ba |
|
|
|
ba40ba |
+osp_SCRIPTS = NovaCompute
|
|
|
ba40ba |
+
|
|
|
ba40ba |
ocf_SCRIPTS = ClusterMon \
|
|
|
ba40ba |
CTDB \
|
|
|
ba40ba |
Dummy \
|
|
|
ba40ba |
diff --git a/heartbeat/NovaCompute b/heartbeat/NovaCompute
|
|
|
ba40ba |
new file mode 100644
|
|
|
ba40ba |
index 0000000..f71abeb
|
|
|
ba40ba |
--- /dev/null
|
|
|
ba40ba |
+++ b/heartbeat/NovaCompute
|
|
|
ba40ba |
@@ -0,0 +1,363 @@
|
|
|
ba40ba |
+#!/bin/sh
|
|
|
ba40ba |
+#
|
|
|
ba40ba |
+#
|
|
|
ba40ba |
+# NovaCompute agent manages compute daemons.
|
|
|
ba40ba |
+#
|
|
|
ba40ba |
+# Copyright (c) 2015
|
|
|
ba40ba |
+#
|
|
|
ba40ba |
+# This program is free software; you can redistribute it and/or modify
|
|
|
ba40ba |
+# it under the terms of version 2 of the GNU General Public License as
|
|
|
ba40ba |
+# published by the Free Software Foundation.
|
|
|
ba40ba |
+#
|
|
|
ba40ba |
+# This program is distributed in the hope that it would be useful, but
|
|
|
ba40ba |
+# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ba40ba |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
ba40ba |
+#
|
|
|
ba40ba |
+# Further, this software is distributed without any warranty that it is
|
|
|
ba40ba |
+# free of the rightful claim of any third person regarding infringement
|
|
|
ba40ba |
+# or the like. Any license provided herein, whether implied or
|
|
|
ba40ba |
+# otherwise, applies only to this software file. Patent licenses, if
|
|
|
ba40ba |
+# any, provided herein do not apply to combinations of this program with
|
|
|
ba40ba |
+# other software, or any other product whatsoever.
|
|
|
ba40ba |
+#
|
|
|
ba40ba |
+# You should have received a copy of the GNU General Public License
|
|
|
ba40ba |
+# along with this program; if not, write the Free Software Foundation,
|
|
|
ba40ba |
+# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
|
|
|
ba40ba |
+#
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+#######################################################################
|
|
|
ba40ba |
+# Initialization:
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+###
|
|
|
ba40ba |
+: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
|
|
|
ba40ba |
+. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
|
|
|
ba40ba |
+###
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+: ${__OCF_ACTION=$1}
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+#######################################################################
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+meta_data() {
|
|
|
ba40ba |
+ cat <
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+<resource-agent name="NovaCompute" version="1.0">
|
|
|
ba40ba |
+<version>1.0</version>
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+<longdesc lang="en">
|
|
|
ba40ba |
+OpenStack Nova Compute Server.
|
|
|
ba40ba |
+</longdesc>
|
|
|
ba40ba |
+<shortdesc lang="en">OpenStack Nova Compute Server</shortdesc>
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+<parameters>
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+<parameter name="auth_url" unique="0" required="1">
|
|
|
ba40ba |
+<longdesc lang="en">
|
|
|
ba40ba |
+Authorization URL for connecting to keystone in admin context
|
|
|
ba40ba |
+</longdesc>
|
|
|
ba40ba |
+<shortdesc lang="en">Authorization URL</shortdesc>
|
|
|
ba40ba |
+<content type="string" default="" />
|
|
|
ba40ba |
+</parameter>
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+<parameter name="username" unique="0" required="1">
|
|
|
ba40ba |
+<longdesc lang="en">
|
|
|
ba40ba |
+Username for connecting to keystone in admin context
|
|
|
ba40ba |
+</longdesc>
|
|
|
ba40ba |
+<shortdesc lang="en">Username</shortdesc>
|
|
|
ba40ba |
+</parameter>
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+<parameter name="password" unique="0" required="1">
|
|
|
ba40ba |
+<longdesc lang="en">
|
|
|
ba40ba |
+Password for connecting to keystone in admin context
|
|
|
ba40ba |
+</longdesc>
|
|
|
ba40ba |
+<shortdesc lang="en">Password</shortdesc>
|
|
|
ba40ba |
+<content type="string" default="" />
|
|
|
ba40ba |
+</parameter>
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+<parameter name="tenant_name" unique="0" required="1">
|
|
|
ba40ba |
+<longdesc lang="en">
|
|
|
ba40ba |
+Tenant name for connecting to keystone in admin context.
|
|
|
ba40ba |
+Note that with Keystone V3 tenant names are only unique within a domain.
|
|
|
ba40ba |
+</longdesc>
|
|
|
ba40ba |
+<shortdesc lang="en">Tenant name</shortdesc>
|
|
|
ba40ba |
+<content type="string" default="" />
|
|
|
ba40ba |
+</parameter>
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+<parameter name="domain" unique="0" required="0">
|
|
|
ba40ba |
+<longdesc lang="en">
|
|
|
ba40ba |
+DNS domain in which hosts live, useful when the cluster uses short names and nova uses FQDN
|
|
|
ba40ba |
+</longdesc>
|
|
|
ba40ba |
+<shortdesc lang="en">DNS domain</shortdesc>
|
|
|
ba40ba |
+<content type="string" default="" />
|
|
|
ba40ba |
+</parameter>
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+<parameter name="endpoint_type" unique="0" required="0">
|
|
|
ba40ba |
+<longdesc lang="en">
|
|
|
ba40ba |
+Nova API location (internal, public or admin URL)
|
|
|
ba40ba |
+</longdesc>
|
|
|
ba40ba |
+<shortdesc lang="en">Nova API location (internal, public or admin URL)</shortdesc>
|
|
|
ba40ba |
+<content type="string" default="" />
|
|
|
ba40ba |
+</parameter>
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+<parameter name="no_shared_storage" unique="0" required="0">
|
|
|
ba40ba |
+<longdesc lang="en">
|
|
|
ba40ba |
+Disable shared storage recovery for instances. Use at your own risk!
|
|
|
ba40ba |
+</longdesc>
|
|
|
ba40ba |
+<shortdesc lang="en">Disable shared storage recovery for instances</shortdesc>
|
|
|
ba40ba |
+<content type="boolean" default="0" />
|
|
|
ba40ba |
+</parameter>
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+</parameters>
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+<actions>
|
|
|
ba40ba |
+<action name="start" timeout="120" />
|
|
|
ba40ba |
+<action name="stop" timeout="300" />
|
|
|
ba40ba |
+<action name="monitor" timeout="20" interval="10" depth="0"/>
|
|
|
ba40ba |
+<action name="validate-all" timeout="20" />
|
|
|
ba40ba |
+<action name="meta-data" timeout="5" />
|
|
|
ba40ba |
+<action name="notify" timeout="600" />
|
|
|
ba40ba |
+</actions>
|
|
|
ba40ba |
+</resource-agent>
|
|
|
ba40ba |
+END
|
|
|
ba40ba |
+}
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+#######################################################################
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+# don't exit on TERM, to test that lrmd makes sure that we do exit
|
|
|
ba40ba |
+trap sigterm_handler TERM
|
|
|
ba40ba |
+sigterm_handler() {
|
|
|
ba40ba |
+ ocf_log info "They use TERM to bring us down. No such luck."
|
|
|
ba40ba |
+ return
|
|
|
ba40ba |
+}
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+nova_usage() {
|
|
|
ba40ba |
+ cat <
|
|
|
ba40ba |
+usage: $0 {start|stop|monitor|notify|validate-all|meta-data}
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+Expects to have a fully populated OCF RA-compliant environment set.
|
|
|
ba40ba |
+END
|
|
|
ba40ba |
+}
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+nova_pid() {
|
|
|
ba40ba |
+ ps axf | grep python.*nova-compute | grep -v grep | awk '{print $1}'
|
|
|
ba40ba |
+}
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+nova_start() {
|
|
|
ba40ba |
+ nova_monitor
|
|
|
ba40ba |
+ if [ $? = $OCF_SUCCESS ]; then
|
|
|
ba40ba |
+ return $OCF_SUCCESS
|
|
|
ba40ba |
+ fi
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ export LIBGUESTFS_ATTACH_METHOD=appliance
|
|
|
ba40ba |
+ su nova -s /bin/sh -c /usr/bin/nova-compute &
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ rc=$OCF_NOT_RUNNING
|
|
|
ba40ba |
+ ocf_log info "Waiting for nova to start"
|
|
|
ba40ba |
+ while [ $rc != $OCF_SUCCESS ]; do
|
|
|
ba40ba |
+ nova_monitor
|
|
|
ba40ba |
+ rc=$?
|
|
|
ba40ba |
+ done
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+## TEMPORARY disable call to "service enable" that seems to create
|
|
|
ba40ba |
+## issues and it is unnecessary since fence_compute doesn't disable
|
|
|
ba40ba |
+## the service
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+# if [ "x${OCF_RESKEY_domain}" != x ]; then
|
|
|
ba40ba |
+# export service_host="${NOVA_HOST}.${OCF_RESKEY_domain}"
|
|
|
ba40ba |
+# else
|
|
|
ba40ba |
+# export service_host="${NOVA_HOST}"
|
|
|
ba40ba |
+# fi
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+# python -c "import os; from novaclient import client as nova_client; nova = nova_client.Client('2', os.environ.get('OCF_RESKEY_username'), os.environ.get('OCF_RESKEY_password'), os.environ.get('OCF_RESKEY_tenant_name'), os.environ.get('OCF_RESKEY_auth_url')); nova.services.enable(os.environ.get('service_host'), 'nova-compute');"
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+# rc=$?
|
|
|
ba40ba |
+# if [ $rc != 0 ]; then
|
|
|
ba40ba |
+# ocf_exit_reason "nova.services.enable failed $rc"
|
|
|
ba40ba |
+# exit $OCF_NOT_RUNNING
|
|
|
ba40ba |
+# fi
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ return $OCF_SUCCESS
|
|
|
ba40ba |
+}
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+nova_stop() {
|
|
|
ba40ba |
+ pid=$(nova_pid)
|
|
|
ba40ba |
+ if [ "x$pid" != x ]; then
|
|
|
ba40ba |
+ su nova -c "kill -TERM $pid" -s /bin/bash
|
|
|
ba40ba |
+ fi
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ while [ "x$pid" != x ]; do
|
|
|
ba40ba |
+ sleep 1
|
|
|
ba40ba |
+ pid=$(nova_pid)
|
|
|
ba40ba |
+ done
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ return $OCF_SUCCESS
|
|
|
ba40ba |
+}
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+nova_monitor() {
|
|
|
ba40ba |
+ pid=$(nova_pid)
|
|
|
ba40ba |
+ if [ "x$pid" != x ]; then
|
|
|
ba40ba |
+ ## TEMPORARY disable call to fence_compute to avoid noise on first
|
|
|
ba40ba |
+ ## first startup due to nova-compute not being fast enough to populate
|
|
|
ba40ba |
+ ## the db and fence_compute checking if node exists and it's enabled
|
|
|
ba40ba |
+ #state=$(fence_compute ${fence_options} -o status -n $NOVA_HOST | grep Status)
|
|
|
ba40ba |
+ #if [ "x$state" = "xStatus: ON" ]; then
|
|
|
ba40ba |
+ return $OCF_SUCCESS
|
|
|
ba40ba |
+ #else
|
|
|
ba40ba |
+ # ocf_exit_reason "Nova status: $state"
|
|
|
ba40ba |
+ # return $OCF_ERR_GENERIC
|
|
|
ba40ba |
+ #fi
|
|
|
ba40ba |
+ fi
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ return $OCF_NOT_RUNNING
|
|
|
ba40ba |
+}
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+nova_notify() {
|
|
|
ba40ba |
+ if [ "x${OCF_RESKEY_CRM_meta_notify_operation}" != "xstop" ]; then
|
|
|
ba40ba |
+ return $OCF_SUCCESS
|
|
|
ba40ba |
+ elif [ "x${OCF_RESKEY_CRM_meta_notify_type}" != "xpost" ]; then
|
|
|
ba40ba |
+ return $OCF_SUCCESS
|
|
|
ba40ba |
+ fi
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ # Only the first node not stopping performs evacuates for now
|
|
|
ba40ba |
+ # Can we allow all of them to do it? It would make this block much simpler.
|
|
|
ba40ba |
+ for host in ${OCF_RESKEY_CRM_meta_notify_active_uname}; do
|
|
|
ba40ba |
+ for stop in ${OCF_RESKEY_CRM_meta_notify_stop_uname}; do
|
|
|
ba40ba |
+ if [ "$stop" = "$host" ]; then
|
|
|
ba40ba |
+ : $host is one of the nodes that is stopping
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ elif [ "x$(echo ${host} | awk -F. '{print $1}')" != "x$(uname -n | awk -F. '{print $1}')" ]; then
|
|
|
ba40ba |
+ : We are not the first non-stopping node
|
|
|
ba40ba |
+ return $OCF_SUCCESS
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ else
|
|
|
ba40ba |
+ # Also repeat for any peer NOT in active_uname somehow?
|
|
|
ba40ba |
+ for node in $OCF_RESKEY_CRM_meta_notify_stop_uname; do
|
|
|
ba40ba |
+ ocf_log info "Performing evacuations for $node"
|
|
|
ba40ba |
+ fence_compute ${fence_options} -o reboot -n $node
|
|
|
ba40ba |
+ done
|
|
|
ba40ba |
+ return $OCF_SUCCESS
|
|
|
ba40ba |
+ fi
|
|
|
ba40ba |
+ done
|
|
|
ba40ba |
+ done
|
|
|
ba40ba |
+}
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+nova_validate() {
|
|
|
ba40ba |
+ rc=$OCF_SUCCESS
|
|
|
ba40ba |
+ fence_options=""
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ check_binary openstack-config
|
|
|
ba40ba |
+ check_binary fence_compute
|
|
|
ba40ba |
+ check_binary nova-compute
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ if [ ! -f /etc/nova/nova.conf ]; then
|
|
|
ba40ba |
+ ocf_exit_reason "/etc/nova/nova.conf not found"
|
|
|
ba40ba |
+ exit $OCF_ERR_CONFIGURED
|
|
|
ba40ba |
+ fi
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ if [ -z "${OCF_RESKEY_auth_url}" ]; then
|
|
|
ba40ba |
+ ocf_exit_reason "auth_url not configured"
|
|
|
ba40ba |
+ exit $OCF_ERR_CONFIGURED
|
|
|
ba40ba |
+ fi
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ fence_options="${fence_options} -k ${OCF_RESKEY_auth_url}"
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ if [ -z "${OCF_RESKEY_username}" ]; then
|
|
|
ba40ba |
+ ocf_exit_reason "username not configured"
|
|
|
ba40ba |
+ exit $OCF_ERR_CONFIGURED
|
|
|
ba40ba |
+ fi
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ fence_options="${fence_options} -l ${OCF_RESKEY_username}"
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ if [ -z "${OCF_RESKEY_password}" ]; then
|
|
|
ba40ba |
+ ocf_exit_reason "password not configured"
|
|
|
ba40ba |
+ exit $OCF_ERR_CONFIGURED
|
|
|
ba40ba |
+ fi
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ fence_options="${fence_options} -p ${OCF_RESKEY_password}"
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ if [ -z "${OCF_RESKEY_tenant_name}" ]; then
|
|
|
ba40ba |
+ ocf_exit_reason "tenant_name not configured"
|
|
|
ba40ba |
+ exit $OCF_ERR_CONFIGURED
|
|
|
ba40ba |
+ fi
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ fence_options="${fence_options} -t ${OCF_RESKEY_tenant_name}"
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ if [ -n "${OCF_RESKEY_domain}" ]; then
|
|
|
ba40ba |
+ fence_options="${fence_options} -d ${OCF_RESKEY_domain}"
|
|
|
ba40ba |
+ fi
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ if [ -n "${OCF_RESKEY_no_shared_storage}" ]; then
|
|
|
ba40ba |
+ if ocf_is_true "${OCF_RESKEY_no_shared_storage}"; then
|
|
|
ba40ba |
+ fence_options="${fence_options} --no-shared-storage"
|
|
|
ba40ba |
+ fi
|
|
|
ba40ba |
+ fi
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ if [ -n "${OCF_RESKEY_endpoint_type}" ]; then
|
|
|
ba40ba |
+ case ${OCF_RESKEY_endpoint_type} in
|
|
|
ba40ba |
+ adminURL|publicURL|internalURL) ;;
|
|
|
ba40ba |
+ *)
|
|
|
ba40ba |
+ ocf_exit_reason "endpoint_type ${OCF_RESKEY_endpoint_type} not valid. Use adminURL or publicURL or internalURL"
|
|
|
ba40ba |
+ exit $OCF_ERR_CONFIGURED
|
|
|
ba40ba |
+ ;;
|
|
|
ba40ba |
+ esac
|
|
|
ba40ba |
+ fence_options="${fence_options} -e ${OCF_RESKEY_endpoint_type}"
|
|
|
ba40ba |
+ fi
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ # we take a chance here and hope that host is either not configured
|
|
|
ba40ba |
+ # or configured in nova.conf
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ NOVA_HOST=$(openstack-config --get /etc/nova/nova.conf DEFAULT host 2>/dev/null)
|
|
|
ba40ba |
+ if [ $? = 1 ]; then
|
|
|
ba40ba |
+ if [ "x${OCF_RESKEY_domain}" != x ]; then
|
|
|
ba40ba |
+ NOVA_HOST=$(uname -n | awk -F. '{print $1}')
|
|
|
ba40ba |
+ else
|
|
|
ba40ba |
+ NOVA_HOST=$(uname -n)
|
|
|
ba40ba |
+ fi
|
|
|
ba40ba |
+ fi
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ # We only need to check a configured value, calculated ones are fine
|
|
|
ba40ba |
+ openstack-config --get /etc/nova/nova.conf DEFAULT host 2>/dev/null
|
|
|
ba40ba |
+ if [ $? = 0 ]; then
|
|
|
ba40ba |
+ if [ "x${OCF_RESKEY_domain}" != x ]; then
|
|
|
ba40ba |
+ short_host=$(uname -n | awk -F. '{print $1}')
|
|
|
ba40ba |
+ if [ "x$NOVA_HOST" != "x${short_host}" ]; then
|
|
|
ba40ba |
+ ocf_exit_reason "Invalid Nova host name, must be ${short_host} in order for instance recovery to function"
|
|
|
ba40ba |
+ rc=$OCF_ERR_CONFIGURED
|
|
|
ba40ba |
+ fi
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ elif [ "x$NOVA_HOST" != "x$(uname -n)" ]; then
|
|
|
ba40ba |
+ ocf_exit_reason "Invalid Nova host name, must be $(uname -n) in order for instance recovery to function"
|
|
|
ba40ba |
+ rc=$OCF_ERR_CONFIGURED
|
|
|
ba40ba |
+ fi
|
|
|
ba40ba |
+ fi
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+ if [ $rc != $OCF_SUCCESS ]; then
|
|
|
ba40ba |
+ exit $rc
|
|
|
ba40ba |
+ fi
|
|
|
ba40ba |
+ return $rc
|
|
|
ba40ba |
+}
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+case $__OCF_ACTION in
|
|
|
ba40ba |
+meta-data) meta_data
|
|
|
ba40ba |
+ exit $OCF_SUCCESS
|
|
|
ba40ba |
+ ;;
|
|
|
ba40ba |
+usage|help) nova_usage
|
|
|
ba40ba |
+ exit $OCF_SUCCESS
|
|
|
ba40ba |
+ ;;
|
|
|
ba40ba |
+esac
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+nova_validate
|
|
|
ba40ba |
+
|
|
|
ba40ba |
+case $__OCF_ACTION in
|
|
|
ba40ba |
+start) nova_start;;
|
|
|
ba40ba |
+stop) nova_stop;;
|
|
|
ba40ba |
+monitor) nova_monitor;;
|
|
|
ba40ba |
+notify) nova_notify;;
|
|
|
ba40ba |
+validate-all) exit $OCF_SUCCESS;;
|
|
|
ba40ba |
+*) nova_usage
|
|
|
ba40ba |
+ exit $OCF_ERR_UNIMPLEMENTED
|
|
|
ba40ba |
+ ;;
|
|
|
ba40ba |
+esac
|
|
|
ba40ba |
+rc=$?
|
|
|
ba40ba |
+ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc"
|
|
|
ba40ba |
+exit $rc
|
|
|
ba40ba |
--
|
|
|
ba40ba |
1.8.4.2
|
|
|
ba40ba |
|