Description
When cloud is not specified in a self-assignment request, CloudDao.get_free_clouds() picks the first free cloud. Two concurrent requests can retrieve the same cloud before either creates an assignment, leading to two active assignments on one cloud.
Affected Code
src/quads/server/blueprints/assignments.py:373-381
_free_clouds = CloudDao.get_free_clouds()
if not _free_clouds:
# ...
_cloud = _free_clouds[0]
Impact
- Multiple active assignments on the same cloud
- Network/VLAN conflicts
- Resource allocation corruption
Recommended Fix
Use database-level locking (SELECT ... FOR UPDATE) when selecting a free cloud, or perform cloud selection and assignment creation within a single transaction.
Description
When
cloudis not specified in a self-assignment request,CloudDao.get_free_clouds()picks the first free cloud. Two concurrent requests can retrieve the same cloud before either creates an assignment, leading to two active assignments on one cloud.Affected Code
src/quads/server/blueprints/assignments.py:373-381Impact
Recommended Fix
Use database-level locking (
SELECT ... FOR UPDATE) when selecting a free cloud, or perform cloud selection and assignment creation within a single transaction.