UNCLASSIFIED

Skip to content
Snippets Groups Projects

Evacuating instances on a compute hardware failure

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Kenneth Peeples

    Evacuating a whole compute node failed for us so evacuated each instance

    evacuate-instances.sh 1020 B
    # Pass in the hypervisor to get the list of instances
    # Sometimes a whole compute node evacuate may fail
    if [[ -z $1 ]]; then
    	echo "Pass in a hypervisor, such as compute018.bbh.cyberschool.army.mil"
    	exit
    fi
    nova hypervisor-servers $1 > /tmp/hypervisorinstances
    while read line; do
       instanceUUID=`echo $line | cut -d'|' -f2`
       # Only get the Server UUIDs and ignore the header lines, could change to a regex check
       if [[ `echo $instanceUUID | wc -c` -eq 37 ]]; then
           echo "=================================> instance - $instanceUUID"
    	   # depending on the state of the instance only evacuate maybe required
    	   # Ran it without reset-state first which gets active
    	   # nova reset-state --active $instanceUUID
    	   nova evacuate $instanceUUID
    	   # Reboot can be used if there are issues not starting on the new compute
    	   # nova reboot --hard $instanceUUID
    	   openstack server show $instanceUUID
    	   echo "==========================================================="
       fi
    done < /tmp/hypervisorinstances
    0% or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment