> For the complete documentation index, see [llms.txt](https://platform9.com/kb/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://platform9.com/kb/pmo/solution/no-valid-host-from-host-aggregates-resulted-in-instance-spawnin.md).

# No Valid Host From Host Aggregates Resulted in Instance Spawning Failure

## Problem

* Cold Migration for the instance failed as it could not find any valid host for the instance to be deployed on.
* It queried the hosts available within host aggregates, however, since the flavor used for the instance did not match with any of the host aggregate metadata, migration failed.

{% tabs %}
{% tab title="None" %}

```none
# less nova-scheduler.log | grep [UUID]
INFO nova.filters [req-XYZ [UUID] [PROJECTUUID] - - -] Filtering removed all hosts for the request with instance ID '[UUID]'. Filter results: ['RetryFilter: (start: 8, end: 8)', 'AggregateMultiTenancyIsolation: (start: 8, end: 6)', 'AvailabilityZoneFilter: (start: 6, end: 6)', 'ServerGroupAffinityFilter: (start: 6, end: 6)', 'ServerGroupAntiAffinityFilter: (start: 6, end: 6)', 'AggregateInstanceExtraSpecsFilter: (start: 6, end: 0)']
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="None" %}

```none
# openstack server show [UUID] --fit-width
+-------------------------------------+------------------------------------------------------
|Field                              | Value                                                
+-------------------------------------+------------------------------------------------------
| OS-DCF:diskConfig                  | MANUAL                                                
| OS-EXT-AZ:availability_zone        | nova                                                  
| OS-EXT-PF9-SRV-RES-INFO:res_info    | {u'cfg_disk_gb': 150.0, u'vcpus': 4, u'cfg_memory_mb': 65536, u'cpu_mhz': 1000}                    |
| OS-EXT-SRV-ATTR:host                | [HOST]                  
| OS-EXT-SRV-ATTR:hypervisor_hostname | [HOSTNAME]                                  
| OS-EXT-SRV-ATTR:instance_name      | [INSTANCE_NAME]                 
| OS-EXT-STS:fault                    | {u'message': u'No valid host was found. <br>6 hosts failed with error: Can not find a host aggregate | matching instance extra spec requirement', u'code': 500, u'details': u'  File
| OS-EXT-STS:power_state              | Shutdown            
| OS-EXT-STS:task_state              | None                                                  
| OS-EXT-STS:vm_state                | stopped
```

{% endtab %}
{% endtabs %}

## Environment

* Platform9 Managed OpenStack - All Versions

## Cause

Host aggregate to match the instance flavor specifications is not present.

{% tabs %}
{% tab title="None" %}

```none
# openstack flavor show SampleFlavor
+----------------------------+-----------------------+
| Field                      | Value                 |
+----------------------------+-----------------------+
| OS-FLV-DISABLED:disabled   | False                 |
| OS-FLV-EXT-DATA:ephemeral  | 0                     |
| access_project_ids         | None                  |
| disk                       | 80                    |
| id                         | 6                     |
| name                       | SampleFlavor          |
| os-flavor-access:is_public | True                  |
| properties                 | host='AggregateMatch' |
| ram                        | 8192                  |
| rxtx_factor                | 1.0                   |
| swap                       |                       |
| vcpus                      | 4                     |
+----------------------------+-----------------------+
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="None" %}

```none
# openstack aggregate list | grep sampleagg
```

{% endtab %}
{% endtabs %}

## Resolution

1. Create a host aggregate matching the Instance flavor specifications.

{% tabs %}
{% tab title="None" %}

```none
$ openstack aggregate create sampleagg 
$ openstack aggregate set --property host='AggregateMatch'
$ openstack aggregate add host 1 [HOST ID]
```

{% endtab %}
{% endtabs %}

2. If the flavor properties is not set, it is mandatory to specify one or more key-value pairs that match the key-value pairs on the host aggregates with the scope ***aggregate\_instance\_extra\_specs***. For our case, it is the ***aggregate\_instance\_extra\_specs*****:** ***host='AggregateMatch'*** key-value pair.
3. Set the key-value pair using the following command.

{% tabs %}
{% tab title="None" %}

```none
$ openstack flavor set SampleFlavor --property host='AggregateMatch'
```

{% endtab %}
{% endtabs %}

## Additional Information

[OpenStack Host Aggregate Document](https://docs.openstack.org/nova/latest/admin/aggregates.html)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://platform9.com/kb/pmo/solution/no-valid-host-from-host-aggregates-resulted-in-instance-spawnin.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
