Manage allocations

Sometimes in the Nova logfile you may encounter messages like:

```
2019-02-20 08:22:08.049 35147 INFO nova.compute.resource_tracker [req-9e28335a-c24a-4508-a7f1-7edb03962d5c - - - - -] Instance ed7110a9-9139-4e0b-99df-c20199f61e3f has allocations against this compute host but is not found in the database.
```

If a migration is ongoing, the above message is absolutely normal: every minute Nova performs an inventory of allocated resources and will possibly print out similar lines. In some cases, though, for example in case a migration is aborted, a resource allocation may fail to be deleted: when this happens, since the allocated resources are effectively equivalent to actually used resources, the node may refuse scheduling of new instances.

Hence, it is important to perform some cleanup.

Cleanup dangling allocations

At time of writing (02/2019) the default openstack-client is still missing the plugin needed to manage allocations, so you should:

  • create a virtual environment, install an updated client:

    virtualenv myEnv
    cd myEnv/
    . ./bin/activate
    pip install python-openstackclient
    
  • get the uuid of the compute node:

    openstack resource provider list
    
  • check the detail of all allocations defined on a given compute:

    openstack resource provider show --allocations <uuid>
    
  • remove the allocations, using the serverUUID (the one found in the logfile “Instance <serverUUID>…”, not the compute node’s one:

    openstack resource provider allocation delete <uuid>