NovaCompute: Use variable to avoid calling crudini a second time
We don't need to run crudini twice to get the same config item; instead, just remember the result of the first time. Change-Id: I7591f5c7d1474447e29861e499d04b4b5bdb2a27
This commit is contained in:
parent
5b5c080a0b
commit
7a01081e73
@ -323,6 +323,7 @@ nova_validate() {
|
|||||||
# we take a chance here and hope that host is either not configured
|
# we take a chance here and hope that host is either not configured
|
||||||
# or configured in nova.conf
|
# or configured in nova.conf
|
||||||
|
|
||||||
|
local validate_host=1
|
||||||
NOVA_HOST=$(crudini --get /etc/nova/nova.conf DEFAULT host 2>/dev/null)
|
NOVA_HOST=$(crudini --get /etc/nova/nova.conf DEFAULT host 2>/dev/null)
|
||||||
if [ $? = 1 ]; then
|
if [ $? = 1 ]; then
|
||||||
if [ "x${OCF_RESKEY_domain}" != x ]; then
|
if [ "x${OCF_RESKEY_domain}" != x ]; then
|
||||||
@ -330,11 +331,11 @@ nova_validate() {
|
|||||||
else
|
else
|
||||||
NOVA_HOST=$(uname -n)
|
NOVA_HOST=$(uname -n)
|
||||||
fi
|
fi
|
||||||
|
validate_host=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# We only need to check a configured value, calculated ones are fine
|
# We only need to check a configured value, calculated ones are fine
|
||||||
crudini --get /etc/nova/nova.conf DEFAULT host 2>/dev/null
|
if [ $validate_host -eq 1 ]; then
|
||||||
if [ $? = 0 ]; then
|
|
||||||
if [ "x${OCF_RESKEY_domain}" != x ]; then
|
if [ "x${OCF_RESKEY_domain}" != x ]; then
|
||||||
short_host=$(uname -n | awk -F. '{print $1}')
|
short_host=$(uname -n | awk -F. '{print $1}')
|
||||||
if [ "x$NOVA_HOST" != "x${short_host}" ]; then
|
if [ "x$NOVA_HOST" != "x${short_host}" ]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user