DevStack: Configure retrieving logs from the deploy ramdisk

This patch changes the devstack plugin to allow users to configure the
ironic service to retrieve (or not) the logs from the deploy ramdisk. By
default this feature is enabled in Ironic to collect the logs upon a
deployment failure but in DevStack we've set it to *always* to help us
with troubleshooting.

Three new configuration were added to devstack:

1. $IRONIC_DEPLOY_LOGS_COLLECT - When Ironic should collect the logs,
   possible values are:

   * on_failure: Collect the ramdisk logs upon a deployment failure
   * always: Collect the ramdisk logs from the deployment on success or
     failure
   * never: Never collect the ramdisk logs

2. $IRONIC_DEPLOY_LOGS_STORAGE_BACKEND - Where should Ironic store the
   logs, possible values are:

   * local: To store the logs in the local filesystem
   * swift: To store the logs in Swift

3. $IRONIC_DEPLOY_LOGS_LOCAL_PATH - The path to the directory where
   Ironic should put the logs when $IRONIC_DEPLOY_LOGS_STORAGE_BACKEND is
   set to "local". Defaults to /opt/stack/ironic-bm-logs/deploy_logs

Change-Id: Iedd0858a84eff03d9b5074c04c9e132a90cea1cf
Closes-Bug: #1616969
This commit is contained in:
Lucas Alvares Gomes 2016-08-25 16:29:41 +01:00
parent dbf9662df4
commit 8b1b946d18

View File

@ -198,8 +198,8 @@ fi
# are ``pxe_ssh``, ``pxe_ipmitool``, ``agent_ssh`` and ``agent_ipmitool``.
#
# Additional valid choices if IRONIC_IS_HARDWARE == true are:
# ``pxe_iscsi_cimc``, ``pxe_agent_cimc``, ``pxe_ucs``, ``pxe_cimc``,
# ``*_pxe_oneview`` and ``pxe_drac``
# ``pxe_iscsi_cimc``, ``pxe_agent_cimc``, ``pxe_ucs``, ``pxe_cimc``,
# ``*_pxe_oneview`` and ``pxe_drac``
IRONIC_DEPLOY_DRIVER=${IRONIC_DEPLOY_DRIVER:-pxe_ssh}
# Support entry points installation of console scripts
@ -278,6 +278,22 @@ IRONIC_PROVISION_SUBNET_GATEWAY=${IRONIC_PROVISION_SUBNET_GATEWAY:-}
# Example: IRONIC_PROVISION_SUBNET_PREFIX=10.0.5.0/24
IRONIC_PROVISION_SUBNET_PREFIX=${IRONIC_PROVISION_SUBNET_PREFIX:-}
# Retrieving logs from the deploy ramdisk
#
# IRONIC_DEPLOY_LOGS_COLLECT possible values are:
# * always: Collect the ramdisk logs from the deployment on success or
# failure (Default in DevStack for debugging purpose).
# * on_failure: Collect the ramdisk logs upon a deployment failure
# (Default in Ironic).
# * never: Never collect the ramdisk logs.
IRONIC_DEPLOY_LOGS_COLLECT=${IRONIC_DEPLOY_LOGS_COLLECT:-always}
# IRONIC_DEPLOY_LOGS_STORAGE_BACKEND possible values are:
# * local: To store the logs in the local filesystem (Default in Ironic and DevStack).
# * swift: To store the logs in Swift.
IRONIC_DEPLOY_LOGS_STORAGE_BACKEND=${IRONIC_DEPLOY_LOGS_STORAGE_BACKEND:-local}
# The path to the directory where Ironic should put the logs when IRONIC_DEPLOY_LOGS_STORAGE_BACKEND is set to "local"
IRONIC_DEPLOY_LOGS_LOCAL_PATH=${IRONIC_DEPLOY_LOGS_LOCAL_PATH:-$IRONIC_VM_LOG_DIR/deploy_logs}
# get_pxe_boot_file() - Get the PXE/iPXE boot file path
function get_pxe_boot_file {
local relpath=syslinux/pxelinux.0
@ -483,6 +499,11 @@ function configure_ironic_dirs {
# More info: http://www.syslinux.org/wiki/index.php/Library_modules
cp -aR $(dirname $IRONIC_PXE_BOOT_IMAGE)/*.{c32,0} $IRONIC_TFTPBOOT_DIR
fi
# Create the logs directory when saving the deploy logs to the filesystem
if [ "$IRONIC_DEPLOY_LOGS_STORAGE_BACKEND" = "local"] && [ "$IRONIC_DEPLOY_LOGS_COLLECT" != "never" ]; then
sudo install -d -o $STACK_USER $IRONIC_DEPLOY_LOGS_LOCAL_PATH
fi
}
function configure_ironic_provision_network {
@ -548,6 +569,11 @@ function configure_ironic {
iniset $IRONIC_CONF_FILE DEFAULT use_syslog $SYSLOG
# NOTE(vsaienko) with multinode each conductor should have its own host.
iniset $IRONIC_CONF_FILE DEFAULT host $LOCAL_HOSTNAME
# Retrieve deployment logs
iniset $IRONIC_CONF_FILE agent deploy_logs_collect $IRONIC_DEPLOY_LOGS_COLLECT
iniset $IRONIC_CONF_FILE agent deploy_logs_storage_backend $IRONIC_DEPLOY_LOGS_STORAGE_BACKEND
iniset $IRONIC_CONF_FILE agent deploy_logs_local_path $IRONIC_DEPLOY_LOGS_LOCAL_PATH
# Configure Ironic conductor, if it was enabled.
if is_service_enabled ir-cond; then
configure_ironic_conductor