Here are more details about the workaround. If the provider deletion fails because it still has allocations, you need to clean those up first.
Connect to the nova_api db, then:
Find the resource provider id mysql> select * from resource_providers where name='<hypervisor>';
Find allocations for that provider id (or use a join) mysql> select * from allocations where resource_provider_id='<id>'; +---------------------+------------+--------+----------------------+--------------------------------------+-------------------+------+ | created_at | updated_at | id | resource_provider_id | consumer_id | resource_class_id | used | +---------------------+------------+--------+----------------------+--------------------------------------+-------------------+------+ | 2019-10-09 08:59:27 | NULL | 124441 | 17 | 0b48fced-2ed2-4cbc-8ac7-78c71227924c | 0 | 1 | | 2019-10-09 09:00:01 | NULL | 124459 | 17 | fddeeafa-b460-4103-b561-86dff5f78125 | 0 | 1 | | 2019-10-09 09:00:25 | NULL | 124477 | 17 | 47c5c56e-c901-40ea-9df3-293c30d9721f | 0 | 1 | | 2019-10-09 08:59:27 | NULL | 124444 | 17 | 0b48fced-2ed2-4cbc-8ac7-78c71227924c | 1 | 512 | | 2019-10-09 09:00:01 | NULL | 124462 | 17 | fddeeafa-b460-4103-b561-86dff5f78125 | 1 | 512 | | 2019-10-09 09:00:25 | NULL | 124480 | 17 | 47c5c56e-c901-40ea-9df3-293c30d9721f | 1 | 512 | | 2019-10-09 08:59:27 | NULL | 124447 | 17 | 0b48fced-2ed2-4cbc-8ac7-78c71227924c | 2 | 20 | | 2019-10-09 09:00:01 | NULL | 124465 | 17 | fddeeafa-b460-4103-b561-86dff5f78125 | 2 | 20 | | 2019-10-09 09:00:25 | NULL | 124483 | 17 | 47c5c56e-c901-40ea-9df3-293c30d9721f | 2 | 20 | +---------------------+------------+--------+----------------------+--------------------------------------+-------------------+------+ 9 rows in set (0.00 sec)
Now you can delete the allocations with `openstack resource provider allocation delete <consumer_id>`
Here are more details about the workaround. If the provider deletion fails because it still has allocations, you need to clean those up first.
Connect to the nova_api db, then:
Find the resource provider id hypervisor> ';
mysql> select * from resource_providers where name='<
Find allocations for that provider id (or use a join) provider_ id='<id> '; ------- ------- -+----- ------- +------ --+---- ------- ------- ----+-- ------- ------- ------- ------- ------- -+----- ------- ------- +------ + provider_ id | consumer_id | resource_class_id | used | ------- ------- -+----- ------- +------ --+---- ------- ------- ----+-- ------- ------- ------- ------- ------- -+----- ------- ------- +------ + 2ed2-4cbc- 8ac7-78c7122792 4c | 0 | 1 | b460-4103- b561-86dff5f781 25 | 0 | 1 | c901-40ea- 9df3-293c30d972 1f | 0 | 1 | 2ed2-4cbc- 8ac7-78c7122792 4c | 1 | 512 | b460-4103- b561-86dff5f781 25 | 1 | 512 | c901-40ea- 9df3-293c30d972 1f | 1 | 512 | 2ed2-4cbc- 8ac7-78c7122792 4c | 2 | 20 | b460-4103- b561-86dff5f781 25 | 2 | 20 | c901-40ea- 9df3-293c30d972 1f | 2 | 20 | ------- ------- -+----- ------- +------ --+---- ------- ------- ----+-- ------- ------- ------- ------- ------- -+----- ------- ------- +------ +
mysql> select * from allocations where resource_
+------
| created_at | updated_at | id | resource_
+------
| 2019-10-09 08:59:27 | NULL | 124441 | 17 | 0b48fced-
| 2019-10-09 09:00:01 | NULL | 124459 | 17 | fddeeafa-
| 2019-10-09 09:00:25 | NULL | 124477 | 17 | 47c5c56e-
| 2019-10-09 08:59:27 | NULL | 124444 | 17 | 0b48fced-
| 2019-10-09 09:00:01 | NULL | 124462 | 17 | fddeeafa-
| 2019-10-09 09:00:25 | NULL | 124480 | 17 | 47c5c56e-
| 2019-10-09 08:59:27 | NULL | 124447 | 17 | 0b48fced-
| 2019-10-09 09:00:01 | NULL | 124465 | 17 | fddeeafa-
| 2019-10-09 09:00:25 | NULL | 124483 | 17 | 47c5c56e-
+------
9 rows in set (0.00 sec)
Now you can delete the allocations with `openstack resource provider allocation delete <consumer_id>`