How can I start an instance in a stopped status? [closed]
I want to be able to create an instance with an initial status of "SHUTOFF". More accurately I want to allocate resources on any compute node so I know what node this will start up on and have an instance id to run commands against.
I am currently using the following to achieve what I want, but it is not ideal.
nova stop $(nova boot --flavor 2 --image test --nic net-id=XXX --poll test | grep -oe "[0-9a-f]\{8\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{12\}")
This will start the instance and wait for the build process to be finished (thanks to the --poll option). The output is parsed by grep to search for the instance id. The instance id is then used in the nova stop $id
command.
EDIT:
I also wanted to add why this isn't a good solution for me. This needs to be done for Horizon launched instances. They need to stop immediately after creation, or preferably be created in a shutdown state.