quickly restart all nova-compute nodes in a mirantis openstack cluster

whytewolf's picture

description: 

sometimes you need to run a command on ALL of a type of node in openstack, and if you have miantirs openstack you have a fuel server you can run these commands from. using this quick one liner for example will restart every nova-compute process on all up and active nodes.

One liner: 

for i in `fuel node | grep compute | grep -v False | awk '{print$1}'`; do ssh node-$i service nova-compute restart;done

Output: 

Warning: Permanently added 'node-26' (RSA) to the list of known hosts.
nova-compute stop/waiting
nova-compute start/running, process 48023
Warning: Permanently added 'node-19' (RSA) to the list of known hosts.
nova-compute stop/waiting
nova-compute start/running, process 37375
Warning: Permanently added 'node-23' (RSA) to the list of known hosts.
nova-compute stop/waiting
nova-compute start/running, process 41464
Warning: Permanently added 'node-27' (RSA) to the list of known hosts.
nova-compute stop/waiting
nova-compute start/running, process 37917
Warning: Permanently added 'node-20' (RSA) to the list of known hosts.
nova-compute stop/waiting
nova-compute start/running, process 34713
Warning: Permanently added 'node-25' (RSA) to the list of known hosts.
nova-compute stop/waiting
nova-compute start/running, process 5311
Warning: Permanently added 'node-17' (RSA) to the list of known hosts.
nova-compute stop/waiting
nova-compute start/running, process 9502
Warning: Permanently added 'node-29' (RSA) to the list of known hosts.
nova-compute stop/waiting
nova-compute start/running, process 16975
Warning: Permanently added 'node-18' (RSA) to the list of known hosts.
nova-compute stop/waiting
nova-compute start/running, process 40560
Warning: Permanently added 'node-33' (RSA) to the list of known hosts.
nova-compute stop/waiting
nova-compute start/running, process 30204

Tags: 

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <br> <p>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.