Affinity: ensures instances are in the same compute node
Anti-Affinity: ensures that the instances are not in the same compute node.

 

nova server-group-list

 

nova server-group-create far-apart anti-affinity  ##  ‘far-apart’ is just an arbitrary name I used

 

nova server-group-list

 

nova image-list

 

nova flavor-list

 

nova network-list

 

nova boot –image  “cirros-0.3.3” –flavor “Standard 1”  –nic net-id=2bc06339-90df-4558-9768-c41170474021 test01

 

nova show  d5c99895-5adb-4d67-b7ab-4d17afd9454f

note down the host id#

nova boot –image  “cirros-0.3.3” –flavor “Standard 1”  –nic net-id=2bc06339-90df-4558-9768-c41170474021 test02

 

nova show bdc869cc-2f74-4c28-903d-a33132fb26bd

## same host id as above.

nova boot –image  “cirros-0.3.3” –flavor “Standard 1”  –nic net-id=2bc06339-90df-4558-9768-c41170474021 –hint group=9c7cfb99-8c00-4e4c-a0af-83e076ecaca4  test03

 

nova show efc1e9db-5153-461d-ae4d-937f3001cc25

its on a different node now .. hostId is different.

nova boot –image  “cirros-0.3.3” –flavor “Standard 1”  –nic net-id=2bc06339-90df-4558-9768-c41170474021 –hint group=9c7cfb99-8c00-4e4c-a0af-83e076ecaca4  test04

 

nova show f33eedc4-dc54-4e8d-91bf-3b092ff5d01e

yet another different host

nova list

 

If you get a host-not-found, it means there are no eligible hosts for the new instance, and used up or have some instances of that project.

About The Author