From 965fe952b182ab53befc609556ef904e2f83d044 Mon Sep 17 00:00:00 2001 From: Roger Luethi Date: Wed, 25 Nov 2015 18:02:06 +0100 Subject: [PATCH] Add option to skip snapshot cycles This patch adds a new option for ignoring the snapshot_cycle command. Instead of shutting down the machine, taking a snapshot and rebooting it again, the next script in the list is immediately executed. Only snapshots created with the snapshot_cycle command are affected. This speeds up the build time for the cluster considerably. The patch also starts the network interfaces in init_xxx_node to have them ready for the next script without having to reboot the machine. Change-Id: I12a11144113a1fcde60a64a525e2217f4a758577 --- labs/osbash/lib/osbash/functions-host.sh | 4 ++++ labs/osbash/osbash.sh | 8 ++++++++ labs/osbash/scripts/osbash/init_xxx_node.sh | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/labs/osbash/lib/osbash/functions-host.sh b/labs/osbash/lib/osbash/functions-host.sh index fcb25b66..3088ebf4 100644 --- a/labs/osbash/lib/osbash/functions-host.sh +++ b/labs/osbash/lib/osbash/functions-host.sh @@ -345,6 +345,10 @@ function command_from_config { vm_wait_for_shutdown "$vm_name" ;; snapshot_cycle) + # Skip command if user disabled snapshot cycles + if [ "${SNAP_CYCLE:-}" = "no" ]; then + continue + fi # Format: snapshot_cycle [-g ] [-n ] # comprises shutdown, boot, wait_for_shutdown, snapshot get_cmd_options $args diff --git a/labs/osbash/osbash.sh b/labs/osbash/osbash.sh index 220f572e..45199dfc 100755 --- a/labs/osbash/osbash.sh +++ b/labs/osbash/osbash.sh @@ -38,6 +38,7 @@ function usage { echo "-g GUI GUI type during build" #echo "-e EXPORT Export node VMs" echo "--no-color Disables colors during build" + echo "--no-snap-cycle Disables snapshot cycles during build" echo echo "TARGET basedisk: build configured basedisk" echo " cluster : build OpenStack cluster [all nodes]" @@ -60,6 +61,10 @@ function print_config { echo -e "${CInfo:-}Distribution name: ${CData:-} $(get_distro_name "$DISTRO")${CReset:-}" fi + if [ "${SNAP_CYCLE:-}" = "no" ]; then + echo -e "${CInfo:-}Skipping snapshot cycles.${CReset:-}" + fi + if [ -n "${EXPORT_OVA:-}" ]; then echo "Exporting to OVA: ${EXPORT_OVA}" elif [ -n "${EXPORT_VM_DIR:-}" ]; then @@ -115,6 +120,9 @@ while getopts :be:g:-:hnt:w opt; do no-color) unset CError CStatus CInfo CProcess CData CMissing CReset ;; + no-snap-cycle) + SNAP_CYCLE="no" + ;; help) usage ;; diff --git a/labs/osbash/scripts/osbash/init_xxx_node.sh b/labs/osbash/scripts/osbash/init_xxx_node.sh index 6907a116..34c4d9cc 100755 --- a/labs/osbash/scripts/osbash/init_xxx_node.sh +++ b/labs/osbash/scripts/osbash/init_xxx_node.sh @@ -29,3 +29,7 @@ echo "$NODE_NAME" | sudo tee /etc/hostname > /dev/null # Configure network interfaces config_network + +for iface in $(ip -o link show|grep -o "eth[[:digit:]]"); do + sudo ifup "$iface" +done