Add command: shutdown
This patch adds a new command, shutdown, which allows us to shut down a machine without having another VM execute a script. The patch also removes the now obsolete shutdown_controller.sh. Change-Id: Ie7f4b4104b807d0157abd2e72d6e273f7268d8a1
This commit is contained in:
parent
f096ab6a57
commit
41d39d2ba0
@ -70,15 +70,13 @@ cmd snapshot_cycle -n compute1 cinder-volume_installed
|
|||||||
|
|
||||||
cmd queue ubuntu/setup_telemetry_compute.sh
|
cmd queue ubuntu/setup_telemetry_compute.sh
|
||||||
cmd snapshot_cycle -n compute1 telemetry-compute_installed
|
cmd snapshot_cycle -n compute1 telemetry-compute_installed
|
||||||
|
cmd boot -n compute1
|
||||||
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Take snapshot of database changes on controller VM, too
|
# Take snapshot of database changes on controller VM, too
|
||||||
cmd queue shutdown_controller.sh
|
cmd shutdown -n controller
|
||||||
cmd boot -n compute1
|
|
||||||
|
|
||||||
cmd wait_for_shutdown -n controller
|
|
||||||
cmd snapshot -n controller controller_-_compute1_node_installed
|
cmd snapshot -n controller controller_-_compute1_node_installed
|
||||||
#cmd boot -n controller
|
|
||||||
#==============================================================================
|
#==============================================================================
|
||||||
cmd queue config_public_network.sh
|
cmd queue config_public_network.sh
|
||||||
cmd queue config_private_network.sh
|
cmd queue config_private_network.sh
|
||||||
|
@ -424,6 +424,15 @@ function command_from_config {
|
|||||||
echo >&2 vm_conditional_snapshot "$vm_name" "$shot_name"
|
echo >&2 vm_conditional_snapshot "$vm_name" "$shot_name"
|
||||||
vm_conditional_snapshot "$vm_name" "$shot_name"
|
vm_conditional_snapshot "$vm_name" "$shot_name"
|
||||||
;;
|
;;
|
||||||
|
shutdown)
|
||||||
|
# Format: shutdown [-n <node_name>]
|
||||||
|
get_cmd_options $args
|
||||||
|
echo >&2 "vm_acpi_shutdown $vm_name"
|
||||||
|
vm_acpi_shutdown "$vm_name"
|
||||||
|
echo >&2 vm_wait_for_shutdown "$vm_name"
|
||||||
|
vm_wait_for_shutdown "$vm_name"
|
||||||
|
conditional_sleep 1
|
||||||
|
;;
|
||||||
wait_for_shutdown)
|
wait_for_shutdown)
|
||||||
# Format: wait_for_shutdown [-n <node_name>]
|
# Format: wait_for_shutdown [-n <node_name>]
|
||||||
get_cmd_options $args
|
get_cmd_options $args
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -o errexit -o nounset
|
|
||||||
TOP_DIR=$(cd "$(dirname "$0")/.." && pwd)
|
|
||||||
source "$TOP_DIR/config/paths"
|
|
||||||
source "$LIB_DIR/functions.guest.sh"
|
|
||||||
|
|
||||||
indicate_current_auto
|
|
||||||
|
|
||||||
exec_logfile
|
|
||||||
|
|
||||||
# At this point in the cluster build, we just rebooted the compute VM to take
|
|
||||||
# a snapshot, and we are about to reboot the controller node for the same
|
|
||||||
# purpose.
|
|
||||||
#
|
|
||||||
# About a minute after we reboot the controller, the status of nova-compute
|
|
||||||
# (according to nova-manage service list) becomes "XXX".
|
|
||||||
#
|
|
||||||
# If we sleep for 2 seconds now, before rebooting the controller, the
|
|
||||||
# nova-compute service on the compute node will keep running and the status
|
|
||||||
# will automatically return to ":-)" after some time (may take several
|
|
||||||
# minutes). If we don't sleep here, the nova-compute service on compute will
|
|
||||||
# die within a few minutes (needs manual service restart or a compute node
|
|
||||||
# reboot).
|
|
||||||
sleep 2
|
|
||||||
|
|
||||||
echo "Shutting down the controller node."
|
|
||||||
ssh \
|
|
||||||
-o "UserKnownHostsFile /dev/null" \
|
|
||||||
-o "StrictHostKeyChecking no" \
|
|
||||||
-i "$HOME/.ssh/osbash_key" \
|
|
||||||
controller \
|
|
||||||
sudo /sbin/shutdown -P now
|
|
Loading…
x
Reference in New Issue
Block a user