I am using Openstack Icehouse running on Ubuntu.

After rebooting Compute node all instances that were running there will be in shutoff state. Is there way to restart them all at once?

Only thing I found from the documentation was starting them individually with

nova start instance_id

which is really impractical if I have large number of instances.

Web interface Dashboard is no better. I would still have to click each instances individually to get them started.

What would be the best way to handle this?


Why is it impractical to use the 'nova start' command to start the instances? You don't have to do lots of typing, if that's what you're thinking. You could always pipe the output of 'nova list' to grep to find the instances you want to start, then pipe to a tool like cut, awk, sed or perl to obtain just the UUIDs, then 'nova start' each UUID. Something like:

nova list | grep SHUTOFF | cut '-d|' -fFIELDNUM | xargs nova start

  • I considered it impractical because I don't have sufficient knowledge to create command to do it and was unable to find existing ones. Example above solves that tough. – Madoc Comadrin Dec 3 '14 at 7:59
  • 1
    Suggested command needs editing to make it work. This will work: nova list | grep SHUTOFF | cut '-d|' -f3 | xargs -I '{}' bash -c 'nova start {}' – Madoc Comadrin Dec 3 '14 at 9:33
  • Nice work! Glad you got it working mate. – AnotherSmellyGeek Jan 2 '15 at 4:35
  • In my case I needed something like nova list | grep SHUTOFF | cut -d '|' -f 2 | xargs -n 1 nova start, could be due to different version: 2.17.0 that the output may be different, and for xargs I needed the -n 1 because nova start <server> only supports one server per call. – Ray Burgemeestre Jul 13 '15 at 13:21
nova list | grep SHUTOFF | cut '-d|' -fFIELDNUM

as the same as

openstack server list --status SHUTOFF -f value -c ID

use one call without grep, cut and pipes.

Call to exec all instances:

openstack server list --status SHUTOFF -f value -c ID|xargs nova start

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.