From 954f8ff8cb4a57fbf68781cf51bce37a9a3a10e3 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Thu, 9 Apr 2015 15:46:30 +0100 Subject: [PATCH] Add AIO diagnostics and better gate scripts consistency Implements extra diagnostic information for gate check failure analysis and also appends DNS settings instead of replacing them for the AIO bootstrap. Some extra settings are added to the DNS to try to catch edge cases for DNS resolution. The DNS `resolv.conf` was being overwritten on every run using google name servers however we need to add google name servers to the existing resolver not overwrite the whole conf so a conditional was added. The gate scripts were attempting to create a symlink to logs on every run. While this is fine for the gate which is creates a new node on every run the link will cause failures on recheck when doing more local testing. The ansible log entry was being appended to the `ansible.cfg` file on every run which should also be limited to one entry. The conditional added is helpful when doing local testing with the gate scripts. Closes-Bug: #1442630 Change-Id: I25aac98d7408ba32f94befea22da4471bd1697b6 --- scripts/bootstrap-aio.sh | 10 +++++++--- scripts/scripts-library.sh | 6 +++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/bootstrap-aio.sh b/scripts/bootstrap-aio.sh index fd53097009..18ddcb7f74 100755 --- a/scripts/bootstrap-aio.sh +++ b/scripts/bootstrap-aio.sh @@ -51,12 +51,14 @@ info_block "Checking for required libraries." 2> /dev/null || source $(dirname $ mkdir -p /openstack/log # Implement the log directory link for openstack-infra log publishing -ln -s /openstack/log $SYMLINK_DIR +ln -sf /openstack/log $SYMLINK_DIR # Create ansible logging directory and add in a log file entry into ansible.cfg if [ -f "playbooks/ansible.cfg" ];then mkdir -p /openstack/log/ansible-logging - sed -i '/\[defaults\]/a log_path = /openstack/log/ansible-logging/ansible.log' playbooks/ansible.cfg + if [ ! "$(grep -e '^log_path\ =\ /openstack/log/ansible-logging/ansible.log' playbooks/ansible.cfg)" ];then + sed -i '/\[defaults\]/a log_path = /openstack/log/ansible-logging/ansible.log' playbooks/ansible.cfg + fi fi # Check that the link creation was successful @@ -80,7 +82,9 @@ fi info_block "Running AIO Setup" # Set base DNS to google, ensuring consistent DNS in different environments -echo -e 'nameserver 8.8.8.8\nnameserver 8.8.4.4' | tee /etc/resolv.conf +if [ ! "$(grep -e '^nameserver 8.8.8.8' -e '^nameserver 8.8.4.4' /etc/resolv.conf)" ];then + echo -e '\n# Adding google name servers\nnameserver 8.8.8.8\nnameserver 8.8.4.4' | tee -a /etc/resolv.conf +fi # Update the package cache and install required packages apt-get update diff --git a/scripts/scripts-library.sh b/scripts/scripts-library.sh index 2b1c142d9b..fea13200f0 100755 --- a/scripts/scripts-library.sh +++ b/scripts/scripts-library.sh @@ -217,6 +217,8 @@ function log_instance_info() { # Get instance info function get_instance_info() { set +x + info_block 'Current User' + whoami info_block 'Available Memory' free -mt || true info_block 'Available Disk Space' @@ -224,7 +226,7 @@ function get_instance_info() { info_block 'Mounted Devices' mount || true info_block 'Block Devices' - lsblk || true + lsblk -i || true info_block 'Block Devices Information' blkid || true info_block 'Block Device Partitions' @@ -253,6 +255,8 @@ function get_instance_info() { ip a || true info_block 'Network Routes' ip r || true + info_block 'DNS Configuration' + cat /etc/resolv.conf info_block 'Trace Path from google' tracepath 8.8.8.8 -m 5 || true info_block 'XEN Server Information'