1. Home
  2. Linux
  3. How to start a VM on a Specified Host/Compute Node in OpenStack Mitaka?

How to start a VM on a Specified Host/Compute Node in OpenStack Mitaka?

With the appropriate permissions, the user can launch VM on a specified host/compute node in OpenStack Mitaka. All you need to do is to use –availability_zone zone:host argument while executing openstack server create command as shown below:

$openstack server create --image  --flavor m1.tiny --key_name test --availability-zone nova:compute3

In order to perform this operation, you need to set which roles can launch an instance on a specified host using create:forced_host option in policy.json under nova configuration folder. By default this option is enabled for only the admin role.

So, open the file /etc/nova/policy.json file and change the below line:

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


"compute:create:forced_host": "",

Then list the valid compute hosts using the below command:

start vm specific host

$ openstack hypervisor list
| ID | Hypervisor Hostname        |
|  1 | compute2                   |
|  2 | compute3                   |

Now using the server’s name from the above list and force an instance on a specific host.

$ openstack server create --flavor m1.small --image cirros --key-name mykey --nic net-id=9381abae-e0c5-4844-b605-da6b04ce9a36 --security-group default --availability-zone nova:compute3 ubuntu1-on-compute3

Ok! Wait. The above command with an error message:

Policy doesn't allow os_compute_api:servers:create:forced_host to be performed. (HTTP 403) (Request-ID: req-993cd21d-e546-4e68-bad7-3ebc70bfd18a)

It clearly shows that the policy set by administrator doesn’t allow a normal user to schedule an instance onto a particular node. The solution is to create a rule that allows even a normal user to schedule a VM onto a particular host as shown below:

Open the file /etc/nova/policy.json file on the controller node and change to the below:

"os_compute_api:servers:create:forced_host": "rule:admin_api",


"os_compute_api:servers:create:forced_host": "",

And restart the nova-api service as shown below:

#/etc/init.d/nova-api restart

Note: These changes need not be made in compute nodes.

Now as a normal user, you should be able to start a VM on a particular host.

Updated on September 2, 2017

Was this article helpful?

Related Articles

Leave a Comment