[placement] running out of VCPU resource

Przemyslaw Basa przemyslaw.basa at redge.com
Wed Jul 13 14:06:33 UTC 2022


Hello

I have a fresh Xena deployment. I'm able to spawn one VM per project per compute node then I get placement errors like

Jul 13 15:32:27 g-os-controller-placement-container-a796c019 placement-api[1821]: 2022-07-13 15:32:27.683 1821 WARNING 
placement.objects.allocation [req-314a1352-457e-4166-8d8c-ef58e6d926ad 81c8738a7d4e46b3a0ae270eccf852c9 
36e66b27e5144df5ba4a2270695fea34 - default default] Over capacity for VCPU on resource provider 
16f620c0-8c6f-4984-8d58-e2c00d1b32da. Needed: 1, Used: 13318, Capacity: 256.0

Number in Used field seemed strange, it looked to me more like memory sum not used VCPU count.

root at os-install:~# openstack resource provider show 16f620c0-8c6f-4984-8d58-e2c00d1b32da --allocations -c allocations -f 
value
{'b6da8a02-a96c-464e-a6c4-19c96c83dd44': {'resources': {'MEMORY_MB': 12288, 'VCPU': 4}}, 
'212798a3-6753-443d-8e7c-5c3be3f4ab54': {'resources': {'DISK_GB': 1, 'MEMORY_MB': 1024, 'VCPU': 1}}}

I've done some digging in sources and found SQL (in placement/objects/allocation.py) that is supposed to generate these 
values.

MariaDB [placement]> SELECT rp.id, rp.uuid, rp.generation, inv.resource_class_id, inv.total, inv.reserved, 
inv.allocation_ratio, allocs.used FROM resource_providers AS rp JOIN inventories AS inv ON rp.id = 
inv.resource_provider_id LEFT JOIN ( SELECT resource_provider_id, resource_class_id, SUM(used) AS used FROM allocations 
WHERE resource_class_id IN (0, 1, 2) AND resource_provider_id IN (5) GROUP BY resource_provider_id, resource_class_id ) 
AS allocs ON inv.resource_provider_id = allocs.resource_provider_id AND inv.resource_class_id = allocs.resource_class_id 
WHERE rp.id IN (5) AND inv.resource_class_id IN (0, 1, 2);
+----+--------------------------------------+------------+-------------------+---------+----------+------------------+-------+
| id | uuid                                 | generation | resource_class_id | total   | reserved | allocation_ratio | 
used  |
+----+--------------------------------------+------------+-------------------+---------+----------+------------------+-------+
|  5 | 16f620c0-8c6f-4984-8d58-e2c00d1b32da |         37 |                 0 |     128 |        0 |                2 | 
13318 |
|  5 | 16f620c0-8c6f-4984-8d58-e2c00d1b32da |         37 |                 1 | 1031723 |     2048 |                1 | 
NULL |
|  5 | 16f620c0-8c6f-4984-8d58-e2c00d1b32da |         37 |                 2 |  901965 |        2 |                1 | 
NULL |
+----+--------------------------------------+------------+-------------------+---------+----------+------------------+-------+

Individual parts shows correct data, join messing up numbers:

MariaDB [placement]> SELECT resource_provider_id, resource_class_id, SUM(used) AS used FROM allocations WHERE 
resource_class_id IN (0, 1, 2)  AND resource_provider_id IN (5) GROUP BY resource_provider_id, resource_class_id;
+----------------------+-------------------+-------+
| resource_provider_id | resource_class_id | used  |
+----------------------+-------------------+-------+
|                    5 |                 0 |     5 |
|                    5 |                 1 | 13312 |
|                    5 |                 2 |     1 |
+----------------------+-------------------+-------+

MariaDB [placement]> SELECT rp.id, rp.uuid, rp.generation, inv.resource_class_id, inv.total, inv.reserved, 
inv.allocation_ratio, inv.resource_provider_id, inv.resource_class_id FROM resource_providers AS rp JOIN inventories AS 
inv ON rp.id = inv.resource_provider_id WHERE rp.id IN (5) AND inv.resource_class_id IN (0, 1, 2);
+----+--------------------------------------+------------+-------------------+---------+----------+------------------+----------------------+-------------------+
| id | uuid                                 | generation | resource_class_id | total   | reserved | allocation_ratio | 
resource_provider_id | resource_class_id |
+----+--------------------------------------+------------+-------------------+---------+----------+------------------+----------------------+-------------------+
|  5 | 16f620c0-8c6f-4984-8d58-e2c00d1b32da |         38 |                 0 |     128 |        0 |                2 | 
                   5 |                 0 |
|  5 | 16f620c0-8c6f-4984-8d58-e2c00d1b32da |         38 |                 1 | 1031723 |     2048 |                1 | 
                   5 |                 1 |
|  5 | 16f620c0-8c6f-4984-8d58-e2c00d1b32da |         38 |                 2 |  901965 |        2 |                1 | 
                   5 |                 2 |
+----+--------------------------------------+------------+-------------------+---------+----------+------------------+----------------------+-------------------+

Query behaves differently when there is more than one resource_provider_id, it shows correct values then.

Any tips how to fix this situation? I'm not brave enough to tinker with this query myself.

Regards,
Przemyslaw Basa



More information about the openstack-discuss mailing list