OpenStack: Launching an instance on a specific compute host

OpenStack takes care of Instance scheduling automatically for us depending on flavour selected during Nova instance boot, however, many times, we might need to populate the instance on a specific hypervisor / Nova compute node.

To achieve this we need to specify the compute node at the stage, you select Flavour, Image etc.

First step would be to find out the nova availability-zone.

Next, List the hypervisors in your OpenStack cluster.

For example, we wish to launch an Instance, specifically to host server-osp2.example.com.

Source to the user managing the particular tenant and run command -

# nova boot --nic net-id=8df4cd26-9fb2-445a-a0ed-f5f7ffce5ade --flavor m1.tiny --image web Web-inst-osp2 --availability-zone nova:server-osp2.example.com

Option –availability-zone takes nova availability zone along with Compute hostname on which the instance is to be populated.

In this case, as we are trying with a non-admin user and so we get error message. This is a privileged operation by default and is allowed only by admin user. This prevents OpenStack users from hosting a compute host by scheduling all of their resources there.

If this command still needs to be run as a regular user, we need to edit Nova policy, which imposes this restriction.

Edit /etc/nova/policy.json file and change

"compute:create:forced_host": "is_admin:True",

to

"compute:create:forced_host": "",

and restart OpenStack Nova Service.

Now you should be able to run the command successfully and see the instance up and running.

Run the below mentioned command to check on which hypervisor / Compute node, the instance is running

# nova hypervisor-servers server-osp2.example.com

Happy Cloud Computing :)


Like it? Click here to Tweet your feedback

Daleep Singh Bais

Red Hat Certified Architect (RHCA) with 12 years of technical experience in implementing various projects in India and overseas. Passionate about OpenSource Products and Technologies.