mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
CLOUDSTACK-9080: Resource limits for Primary arent respected during attachprimary store resource limit check is not performed while attaching a volume to a vm. Added them same. Also added a marvin test case to verify the same. Testing: BEFORE No error is shown in UI when trying to attach a volume even after reaching the resource limits. ``` mysql> select * from resource_limit where type="primary_storage"; +----+-----------+------------+-----------------+-------------+ | id | domain_id | account_id | type | max | +----+-----------+------------+-----------------+-------------+ | 10 | NULL | 4 | primary_storage | 21474836480 | +----+-----------+------------+-----------------+-------------+ 1 row in set (0.00 sec) mysql> select * from resource_count where account_id=4 and type='primary_storage'; +----+------------+-----------+-----------------+-------------+ | id | account_id | domain_id | type | count | +----+------------+-----------+-----------------+-------------+ | 63 | 4 | NULL | primary_storage | 48318382080 | +----+------------+-----------+-----------------+-------------+ 1 row in set (0.00 sec) ``` AFTER Following error message is shown in UI and the volume is not attached  The resource limits stays the same ``` mysql> select * from resource_limit where type="primary_storage"; +----+-----------+------------+-----------------+-------------+ | id | domain_id | account_id | type | max | +----+-----------+------------+-----------------+-------------+ | 10 | NULL | 4 | primary_storage | 21474836480 | +----+-----------+------------+-----------------+-------------+ 1 row in set (0.01 sec) mysql> select * from resource_count where account_id=4 and type='primary_storage'; +----+------------+-----------+-----------------+-------------+ | id | account_id | domain_id | type | count | +----+------------+-----------+-----------------+-------------+ | 63 | 4 | NULL | primary_storage | 48318382080 | +----+------------+-----------+-----------------+-------------+ 1 row in set (0.00 sec) ``` Marvin test: nosetests --with-marvin --marvin-config=setup/dev/advanced.cfg --zone=xen-zone0 --hypervisor=xenserver test/integration/component/test_ps_resource_limits_volume.py before the change ``` # do ... === TestName: test_attach_volume_exceeding_primary_limits | Status : FAILED === AssertionError: Resource count 23 should match with the expected resource count 22\n ``` After the change ``` # do ... === TestName: test_attach_volume_exceeding_primary_limits | Status : SUCCESS === ok ---------------------------------------------------------------------- Ran 1 test in 1178.354s OK ``` * pr/1107: CLOUDSTACK-9080: Resource limits for Primary arent respected during attach. Signed-off-by: Remi Bergsma <github@remi.nl>