From 8abcf2ebfebec4e3c26fc659978a0227d6f75ef0 Mon Sep 17 00:00:00 2001 From: R-Vaishnavi Date: Wed, 13 Jan 2016 09:09:08 +0000 Subject: [PATCH] Config variable to configure [glance] section Some drivers require glance with swift backend to be able to store some deployment artifacts, e.g. in case of iscsi_ilo driver it may be boot_iso that is constructed from user image kernel and ramdisk. This requires some configuration and this change is intended for such drivers. This commit adds a new config variable IRONIC_CONFIGURE_GLANCE_WITH_SWIFT, which can be set to True to configure the Swift related config parameters of [glance] section in ironic.conf. This patch is required for iLO ThirdParty CI. Change-Id: I1bad2b06b268825e181b7b3125d08c977f54f7b8 --- devstack/lib/ironic | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/devstack/lib/ironic b/devstack/lib/ironic index 4b57fd416b..d519a0f3f3 100644 --- a/devstack/lib/ironic +++ b/devstack/lib/ironic @@ -223,6 +223,11 @@ IRONIC_VBMC_PORT_RANGE_START=${IRONIC_VBMC_PORT_RANGE_START:-6230} IRONIC_VBMC_CONFIG_FILE=${IRONIC_VBMC_CONFIG_FILE:-$HOME/.vbmc/virtualbmc.conf} IRONIC_VBMC_LOGFILE=${IRONIC_VBMC_LOGFILE:-$IRONIC_VM_LOG_DIR/virtualbmc.log} +# To explicitly enable configuration of Glance with Swift +# (which is required by some vendor drivers), set this +# variable to true. +IRONIC_CONFIGURE_GLANCE_WITH_SWIFT=$(trueorfalse False IRONIC_CONFIGURE_GLANCE_WITH_SWIFT) + # The path to the libvirt hooks directory, used if IRONIC_VM_LOG_ROTATE is True IRONIC_LIBVIRT_HOOKS_PATH=${IRONIC_LIBVIRT_HOOKS_PATH:-/etc/libvirt/hooks/} @@ -301,6 +306,11 @@ function is_deployed_by_ilo { return 1 } +function is_glance_configuration_required { + is_deployed_by_agent || [[ "$IRONIC_CONFIGURE_GLANCE_WITH_SWIFT" == "True" ]] && return 0 + return 1 +} + function is_deploy_iso_required { [[ "$IRONIC_IS_HARDWARE" == "True" && "$IRONIC_DEPLOY_ISO_REQUIRED" == "True" ]] && return 0 return 1 @@ -556,11 +566,15 @@ function configure_ironic_conductor { # Set these options for scenarios in which the agent fetches the image # directly from glance, and don't set them where the image is pushed # over iSCSI. - if is_deployed_by_agent; then + if is_glance_configuration_required; then if [[ "$SWIFT_ENABLE_TEMPURLS" == "True" ]] ; then iniset $IRONIC_CONF_FILE glance swift_temp_url_key $SWIFT_TEMPURL_KEY else - die $LINENO "SWIFT_ENABLE_TEMPURLS must be True to use agent_* driver in Ironic." + die $LINENO "SWIFT_ENABLE_TEMPURLS must be True. This is " \ + "required either because IRONIC_DEPLOY_DRIVER was " \ + "set to some agent_* driver OR configuration of " \ + "Glance with Swift was explicitly requested with " \ + "IRONIC_CONFIGURE_GLANCE_WITH_SWIFT=True" fi iniset $IRONIC_CONF_FILE glance swift_endpoint_url http://${HOST_IP}:${SWIFT_DEFAULT_BIND_PORT:-8080} iniset $IRONIC_CONF_FILE glance swift_api_version v1 @@ -569,6 +583,9 @@ function configure_ironic_conductor { iniset $IRONIC_CONF_FILE glance swift_account AUTH_${tenant_id} iniset $IRONIC_CONF_FILE glance swift_container glance iniset $IRONIC_CONF_FILE glance swift_temp_url_duration 3600 + fi + + if is_deployed_by_agent; then iniset $IRONIC_CONF_FILE agent heartbeat_timeout 30 fi