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

+----+------+----------+---------+----------+
| Id | Name | Policies | Members | Metadata |
+----+------+----------+---------+----------+
+----+------+----------+---------++---------+

 

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

+--------------------------------------+-----------+--------------------+---------+----------+
| Id                                   | Name      | Policies           | Members | Metadata |
+--------------------------------------+-----------+--------------------+---------+----------+
| 9c7cfb99-8c00-4e4c-a0af-83e076ecaca4 | far-apart | [u'anti-affinity'] | []      | {}       |
+--------------------------------------+-----------+--------------------+---------++---------+

 

nova server-group-list

+--------------------------------------+-----------+--------------------+---------+----------+
| Id                                   | Name      | Policies           | Members | Metadata |
+--------------------------------------+-----------+--------------------+---------+----------+
| 9c7cfb99-8c00-4e4c-a0af-83e076ecaca4 | far-apart | [u'anti-affinity'] | []      | {}       |
+--------------------------------------+-----------+--------------------+---------++---------+

 

nova image-list

+--------------------------------------+--------------------------+--------+--------+
| ID                                   | Name                     | Status | Server |
+--------------------------------------+--------------------------+--------+--------+
| a9b90fb0-3aac-497a-8406-232673d28138 | CentOS 6                 | ACTIVE |        |
| bfc2b4b9-fbe6-47ee-81a3-669d9b467423 | CentOS 7                 | ACTIVE |        |
| 2e9cc0e4-ceb6-4835-ba7f-0cef2d258743 | Debian 7                 | ACTIVE |        |
| eec68595-6c2b-42b5-a8d6-23c4a726ff53 | Ubuntu 12.04             | ACTIVE |        |
| 5abd9119-c915-4b82-b12e-acfb3b34510f | Ubuntu 14.04             | ACTIVE |        |
| 7955bc8f-d672-4828-98a4-1418c9f49d92 | CoreOS                   | ACTIVE |        |
| c4ddfa41-bdc2-4071-9193-36b4b5d2f354 | CoreOS - Stable 522.4.0  | ACTIVE |        |
| 890af720-81d1-4f5d-a1ca-8ca06a75d403 | CoreOS 766.4.0           | ACTIVE |        |
| b5dbdbc0-fb90-4751-bed2-e15c20d20dfd | Debian 8                 | ACTIVE |        |
| dfa76e89-6dff-4e42-b976-d3ad6f86116e | Fedora 23 Atomic Cloud   | ACTIVE |        |
| 65d55d62-0385-42aa-9057-f0838d9bb9b8 | Fedora 23 Base           | ACTIVE |        |
| b969e51f-7079-4e83-bfed-c1c40d87bda4 | Fedora 23 Base           | ACTIVE |        |
| 2272fa77-0935-44b7-ab51-cbf5b482e3eb | FreeBSD-10.1             | ACTIVE |        |
| 31352442-1241-4614-b2c5-7244e9fc68cc | OpenSUSE 13.2            | ACTIVE |        |
| 5a8d5b0b-8e12-467e-8f48-6e0d537c88a8 | apple                    | ACTIVE |        |
| e14fb7fd-d841-479f-8ab0-a77e4e7a7d78 | apple1                   | ACTIVE |        |
| 5a78c4b9-f373-484e-b840-2b29441d4d0c | cirros-0.3.3             | ACTIVE |        |
| 87642a6c-0340-4ff4-89d5-ed378b07bd21 | pfSense 2.2              | ACTIVE |        |
| a076ba7e-934b-453b-a37c-e12affe1f9ac | pfSense 2.2              | ACTIVE |        |
+--------------------------------------+--------------------------+--------+--------+

 

nova flavor-list

+-----+------------+-----------+------+-----------+------+-------+-------------+-----------+
| ID  | Name       | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+-----+------------+-----------+------+-----------+------+-------+-------------+-----------+
| 111 | Standard 1 | 1024      | 16   | 0         |      | 1     | 1.0         | True      |
| 112 | Standard 2 | 2048      | 32   | 0         |      | 2     | 1.0         | True      |
| 113 | Standard 3 | 4096      | 64   | 0         |      | 3     | 1.0         | True      |
| 114 | Standard 4 | 8192      | 128  | 0         |      | 4     | 1.0         | True      |
| 115 | Standard 5 | 16384     | 128  | 0         |      | 5     | 1.0         | True      |
| 116 | Standard 6 | 32768     | 128  | 0         |      | 6     | 1.0         | True      |
| 117 | Standard 7 | 65536     | 128  | 0         |      | 8     | 1.0         | True      |
| 211 | Small HD 3 | 4096      | 32   | 0         |      | 3     | 1.0         | True      |
| 212 | Small HD 4 | 8192      | 32   | 0         |      | 4     | 1.0         | True      |
| 213 | Small HD 5 | 16384     | 32   | 0         |      | 5     | 1.0         | True      |
| 214 | Small HD 6 | 32768     | 32   | 0         |      | 6     | 1.0         | True      |
| 215 | Small HD 7 | 65536     | 32   | 0         |      | 8     | 1.0         | True      |
+-----+------------+-----------+------+-----------+------+-------+-------------+-----------+

 

nova network-list

+--------------------------------------+------------+------+
| ID                                   | Label      | Cidr |
+--------------------------------------+------------+------+
| 00000000-0000-0000-0000-000000000000 | net-public | -    |
| 2bc06339-90df-4558-9768-c41170474021 | cyberNet   | -    |
+--------------------------------------+------------+------+

 

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

+--------------------------------------+-----------------------------------------------------+
| Property                             | Value                                               |
+--------------------------------------+-----------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                              |
| OS-EXT-AZ:availability_zone          | NL2                                                 |
| OS-EXT-STS:power_state               | 0                                                   |
| OS-EXT-STS:task_state                | scheduling                                          |
| OS-EXT-STS:vm_state                  | building                                            |
| OS-SRV-USG:launched_at               | -                                                   |
| OS-SRV-USG:terminated_at             | -                                                   |
| accessIPv4                           |                                                     |
| accessIPv6                           |                                                     |
| adminPass                            | BASwxWREvrg7                                        |
| config_drive                         |                                                     |
| created                              | 2015-12-16T13:58:27Z                                |
| flavor                               | Standard 1 (111)                                    |
| hostId                               |                                                     |
| id                                   | d5c99895-5adb-4d67-b7ab-4d17afd9454f                |
| image                                | cirros-0.3.3 (5a78c4b9-f373-484e-b840-2b29441d4d0c) |
| key_name                             | -                                                   |
| metadata                             | {}                                                  |
| name                                 | test01                                              |
| os-extended-volumes:volumes_attached | []                                                  |
| progress                             | 0                                                   |
| security_groups                      | default                                             |
| status                               | BUILD                                               |
| tenant_id                            | d255d10b134146aba4dc21e1283a8992                    |
| updated                              | 2015-12-16T13:58:27Z                                |
| user_id                              | a7add9f9e662400291200a15c7f2ec5d                    |
+--------------------------------------+-----------------------------------------------------+

 

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

+--------------------------------------+----------------------------------------------------------+
| Property                             | Value                                                    |
+--------------------------------------+----------------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                                   |
| OS-EXT-AZ:availability_zone          | NL2                                                      |
| OS-EXT-STS:power_state               | 1                                                        |
| OS-EXT-STS:task_state                | -                                                        |
| OS-EXT-STS:vm_state                  | active                                                   |
| OS-SRV-USG:launched_at               | 2015-12-16T13:59:03.000000                               |
| OS-SRV-USG:terminated_at             | -                                                        |
| accessIPv4                           |                                                          |
| accessIPv6                           |                                                          |
| config_drive                         |                                                          |
| created                              | 2015-12-16T13:58:27Z                                     |
| cyberNet network                     | 10.11.12.8                                               |
| flavor                               | Standard 1 (111)                                         |
| hostId                               | 097d84fc7ade671a7b1e012a6be05669b486620549c1aa3737dfa0f1 |  
| id                                   | d5c99895-5adb-4d67-b7ab-4d17afd9454f                     |
| image                                | cirros-0.3.3 (5a78c4b9-f373-484e-b840-2b29441d4d0c)      |
| key_name                             | -                                                        |
| metadata                             | {}                                                       |
| name                                 | test01                                                   |
| os-extended-volumes:volumes_attached | []                                                       |
| progress                             | 0                                                        |
| security_groups                      | default                                                  |
| status                               | ACTIVE                                                   |
| tenant_id                            | d255d10b134146aba4dc21e1283a8992                         |
| updated                              | 2015-12-16T13:59:03Z                                     |
| user_id                              | a7add9f9e662400291200a15c7f2ec5d                         |
+--------------------------------------+----------------------------------------------------------+

note down the host id#

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

+--------------------------------------+-----------------------------------------------------+
| Property                             | Value                                               |
+--------------------------------------+-----------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                              |
| OS-EXT-AZ:availability_zone          | NL2                                                 |
| OS-EXT-STS:power_state               | 0                                                   |
| OS-EXT-STS:task_state                | scheduling                                          |
| OS-EXT-STS:vm_state                  | building                                            |
| OS-SRV-USG:launched_at               | -                                                   |
| OS-SRV-USG:terminated_at             | -                                                   |
| accessIPv4                           |                                                     |
| accessIPv6                           |                                                     |
| adminPass                            | ag5SqpQooMAM                                        |
| config_drive                         |                                                     |
| created                              | 2015-12-16T13:59:33Z                                |
| flavor                               | Standard 1 (111)                                    |
| hostId                               |                                                     |
| id                                   | bdc869cc-2f74-4c28-903d-a33132fb26bd                |
| image                                | cirros-0.3.3 (5a78c4b9-f373-484e-b840-2b29441d4d0c) |
| key_name                             | -                                                   |
| metadata                             | {}                                                  |
| name                                 | test02                                              |
| os-extended-volumes:volumes_attached | []                                                  |
| progress                             | 0                                                   |
| security_groups                      | default                                             |
| status                               | BUILD                                               |
| tenant_id                            | d255d10b134146aba4dc21e1283a8992                    |
| updated                              | 2015-12-16T13:59:33Z                                |
| user_id                              | a7add9f9e662400291200a15c7f2ec5d                    |
+--------------------------------------+-----------------------------------------------------+

 

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

+--------------------------------------+----------------------------------------------------------+
| Property                             | Value                                                    |
+--------------------------------------+----------------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                                   |
| OS-EXT-AZ:availability_zone          | NL2                                                      |
| OS-EXT-STS:power_state               | 0                                                        |
| OS-EXT-STS:task_state                | spawning                                                 |
| OS-EXT-STS:vm_state                  | building                                                 |
| OS-SRV-USG:launched_at               | -                                                        |
| OS-SRV-USG:terminated_at             | -                                                        |
| accessIPv4                           |                                                          |
| accessIPv6                           |                                                          |
| config_drive                         |                                                          |
| created                              | 2015-12-16T13:59:33Z                                     |
| flavor                               | Standard 1 (111)                                         |
| hostId                               | 097d84fc7ade671a7b1e012a6be05669b486620549c1aa3737dfa0f1 |
| id                                   | bdc869cc-2f74-4c28-903d-a33132fb26bd                     |
| image                                | cirros-0.3.3 (5a78c4b9-f373-484e-b840-2b29441d4d0c)      |
| key_name                             | -                                                        |
| metadata                             | {}                                                       |
| name                                 | test02                                                   |
| os-extended-volumes:volumes_attached | []                                                       |
| progress                             | 0                                                        |
| status                               | BUILD                                                    |
| tenant_id                            | d255d10b134146aba4dc21e1283a8992                         |
| updated                              | 2015-12-16T13:59:34Z                                     |
| user_id                              | a7add9f9e662400291200a15c7f2ec5d                         |
+--------------------------------------+----------------------------------------------------------+

## 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

+--------------------------------------+-----------------------------------------------------+
| Property                             | Value                                               |
+--------------------------------------+-----------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                              |
| OS-EXT-AZ:availability_zone          | NL2                                                 |
| OS-EXT-STS:power_state               | 0                                                   |
| OS-EXT-STS:task_state                | scheduling                                          |
| OS-EXT-STS:vm_state                  | building                                            |
| OS-SRV-USG:launched_at               | -                                                   |
| OS-SRV-USG:terminated_at             | -                                                   |
| accessIPv4                           |                                                     |
| accessIPv6                           |                                                     |
| adminPass                            | kNAkq5gtpYiF                                        |
| config_drive                         |                                                     |
| created                              | 2015-12-16T14:00:39Z                                |
| flavor                               | Standard 1 (111)                                    |
| hostId                               |                                                     |
| id                                   | efc1e9db-5153-461d-ae4d-937f3001cc25                |
| image                                | cirros-0.3.3 (5a78c4b9-f373-484e-b840-2b29441d4d0c) |
| key_name                             | -                                                   |
| metadata                             | {}                                                  |
| name                                 | test03                                              |
| os-extended-volumes:volumes_attached | []                                                  |
| progress                             | 0                                                   |
| security_groups                      | default                                             |
| status                               | BUILD                                               |
| tenant_id                            | d255d10b134146aba4dc21e1283a8992                    |
| updated                              | 2015-12-16T14:00:39Z                                |
| user_id                              | a7add9f9e662400291200a15c7f2ec5d                    |
+--------------------------------------+-----------------------------------------------------+

 

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

+--------------------------------------+----------------------------------------------------------+
| Property                             | Value                                                    |
+--------------------------------------+----------------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                                   |
| OS-EXT-AZ:availability_zone          | NL2                                                      |
| OS-EXT-STS:power_state               | 1                                                        |
| OS-EXT-STS:task_state                | -                                                        |
| OS-EXT-STS:vm_state                  | active                                                   |
| OS-SRV-USG:launched_at               | 2015-12-16T14:01:09.000000                               |
| OS-SRV-USG:terminated_at             | -                                                        |
| accessIPv4                           |                                                          |
| accessIPv6                           |                                                          |
| config_drive                         |                                                          |
| created                              | 2015-12-16T14:00:39Z                                     |
| cyberNet network                     | 10.11.12.10                                              |
| flavor                               | Standard 1 (111)                                         |
| hostId                               | 8ec5fa45ed66ee9d270009fe92930d6a0a0e901d2204e0c1142dce71 | 
| id                                   | efc1e9db-5153-461d-ae4d-937f3001cc25                     |
| image                                | cirros-0.3.3 (5a78c4b9-f373-484e-b840-2b29441d4d0c)      |
| key_name                             | -                                                        |
| metadata                             | {}                                                       |
| name                                 | test03                                                   |
| os-extended-volumes:volumes_attached | []                                                       |
| progress                             | 0                                                        |
| security_groups                      | default                                                  |
| status                               | ACTIVE                                                   |
| tenant_id                            | d255d10b134146aba4dc21e1283a8992                         |
| updated                              | 2015-12-16T14:01:09Z                                     |
| user_id                              | a7add9f9e662400291200a15c7f2ec5d                         |
+--------------------------------------+----------------------------------------------------------+

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

+--------------------------------------+-----------------------------------------------------+
| Property                             | Value                                               |
+--------------------------------------+-----------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                              |
| OS-EXT-AZ:availability_zone          | NL2                                                 |
| OS-EXT-STS:power_state               | 0                                                   |
| OS-EXT-STS:task_state                | scheduling                                          |
| OS-EXT-STS:vm_state                  | building                                            |
| OS-SRV-USG:launched_at               | -                                                   |
| OS-SRV-USG:terminated_at             | -                                                   |
| accessIPv4                           |                                                     |
| accessIPv6                           |                                                     |
| adminPass                            | 9w6mmzeAXhjo                                        |
| config_drive                         |                                                     |
| created                              | 2015-12-16T14:00:45Z                                |
| flavor                               | Standard 1 (111)                                    |
| hostId                               |                                                     |
| id                                   | f33eedc4-dc54-4e8d-91bf-3b092ff5d01e                |
| image                                | cirros-0.3.3 (5a78c4b9-f373-484e-b840-2b29441d4d0c) |
| key_name                             | -                                                   |
| metadata                             | {}                                                  |
| name                                 | test04                                              |
| os-extended-volumes:volumes_attached | []                                                  |
| progress                             | 0                                                   |
| security_groups                      | default                                             |
| status                               | BUILD                                               |
| tenant_id                            | d255d10b134146aba4dc21e1283a8992                    |
| updated                              | 2015-12-16T14:00:45Z                                |
| user_id                              | a7add9f9e662400291200a15c7f2ec5d                    |
+--------------------------------------+-----------------------------------------------------+

 

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

+--------------------------------------+----------------------------------------------------------+
| Property                             | Value                                                    |
+--------------------------------------+----------------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                                   |
| OS-EXT-AZ:availability_zone          | NL2                                                      |
| OS-EXT-STS:power_state               | 1                                                        |
| OS-EXT-STS:task_state                | -                                                        |
| OS-EXT-STS:vm_state                  | active                                                   |
| OS-SRV-USG:launched_at               | 2015-12-16T14:01:22.000000                               |
| OS-SRV-USG:terminated_at             | -                                                        |
| accessIPv4                           |                                                          |
| accessIPv6                           |                                                          |
| config_drive                         |                                                          |
| created                              | 2015-12-16T14:00:45Z                                     |
| cyberNet network                     | 10.11.12.11                                              |
| flavor                               | Standard 1 (111)                                         |
| hostId                               | 09a42bd721cd6cad4c7c251feed65a037320c8fd6d69b18129050254 | 
| id                                   | f33eedc4-dc54-4e8d-91bf-3b092ff5d01e                     |
| image                                | cirros-0.3.3 (5a78c4b9-f373-484e-b840-2b29441d4d0c)      |
| key_name                             | -                                                        |
| metadata                             | {}                                                       |
| name                                 | test04                                                   |
| os-extended-volumes:volumes_attached | []                                                       |
| progress                             | 0                                                        |
| security_groups                      | default                                                  |
| status                               | ACTIVE                                                   |
| tenant_id                            | d255d10b134146aba4dc21e1283a8992                         |
| updated                              | 2015-12-16T14:01:22Z                                     |
| user_id                              | a7add9f9e662400291200a15c7f2ec5d                         |
+--------------------------------------+----------------------------------------------------------+

yet another different host

nova list

+--------------------------------------+--------+--------+------------+-------------+------------------------------------+
| ID                                   | Name   | Status | Task State | Power State | Networks                           |
+--------------------------------------+--------+--------+------------+-------------+------------------------------------+
| d5c99895-5adb-4d67-b7ab-4d17afd9454f | test01 | ACTIVE | -          | Running     | cyberNet=10.11.12.8                |
| bdc869cc-2f74-4c28-903d-a33132fb26bd | test02 | ACTIVE | -          | Running     | cyberNet=10.11.12.9                |
| efc1e9db-5153-461d-ae4d-937f3001cc25 | test03 | ACTIVE | -          | Running     | cyberNet=10.11.12.10               |
| f33eedc4-dc54-4e8d-91bf-3b092ff5d01e | test04 | ACTIVE | -          | Running     | cyberNet=10.11.12.11               |
+--------------------------------------+--------+--------+------------+-------------+------------------------------------+

 

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