Nova compute - how to recover from the ‘failed to creare resource provider’ error

In some circumstances, a nova compute can encounter the following error: ‘failed to creare resource provider’. When this error occurs, the nova compute is unable to migrate/create/reboot VMs.

Here is the procedure to recover from this error:

  1. Identify the resource provider that matches the nova compute in error:

    $ openstack resource provider list --name <compute-node-host>
    
  2. List all the allocations for this resource provider:

    $  openstack resource provider show --allocations <resource-provider-id>
    
  3. For all the allocations UUIDs from the previous step, execute the following commands:

       Get and **SAVE** the allocation for the server
    $ openstack --os-placement-api-version 1.12 resource provider allocation show <allocation-id>
    $ openstack server show <allocation-id>  // check in which compute node the VM is running
    
    If the 'resource provider allocation show' command shows that there is ONLY ONE resource provider in the allocation (AND this resource provider is the one that matches the nova compute in error), delete the allocation
    $ openstack resource provider delete <allocation-id>
    
    If there were multiple resource provider in the allocation, delete only the allocation for the compute node in error by omitting the resouce provider that matches the nova computer in error
    $ openstack --os-placement-api-version 1.12 resource provider allocation set <allocation-id> --project-id <project-id> --user-id <user-id> --allocation rp=<other-resource-provider>,MEMORY_MB=<ram-quota>,VCPU=<cpu-quota>,DISK_GB=<disk-quota>
    
  4. Once you have deleted and SAVED all the allocations, delete the resource provider:

    $ openstack resource provider delete <allocation-id>
    
  5. Restart nova-compute. The resource providers should be re-created successfully:

  6. Get the (new) resource provider UUID using the compute host name:

    $ openstack resource provider list --name <compute-node-host>
    
  7. If necessary (meaning, ‘openstack server show’ from step 3 shows that the VM is running on the nova compute previously in error), restore all of the previously saved allocations for the servers on the compute node:

    $ openstack --os-placement-api-version 1.12 resource provider allocation set <allocation-id> --project-id <project-id> --user-id <user-id> --allocation rp=<new-resource-provider>,MEMORY_MB=<ram-quota>,VCPU=<cpu-quota>,DISK_GB=<disk-quota>