[
https://issues.apache.org/jira/browse/CLOUDSTACK-9080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15022036#comment-15022036
]
ASF GitHub Bot commented on CLOUDSTACK-9080:
--------------------------------------------
GitHub user karuturi opened a pull request:
https://github.com/apache/cloudstack/pull/1107
CLOUDSTACK-9080: Resource limits for Primary arent respected during attach
primary 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
```
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/karuturi/cloudstack CLOUDSTACK-9080
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cloudstack/pull/1107.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1107
----
commit 12756a79668b0b6eac253d9561b7145294a59873
Author: Rajani Karuturi <[email protected]>
Date: 2015-05-21T11:20:39Z
CLOUDSTACK-9080: Resource limits for Primary arent respected during attach.
primary 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.
----
> Able to upload Volume greater than the Resource limit defined for Primary
> Storage.
> ----------------------------------------------------------------------------------
>
> Key: CLOUDSTACK-9080
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9080
> Project: CloudStack
> Issue Type: Bug
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Reporter: Rajani Karuturi
>
> Steps :
> 1. Create a child domain and create a User Account for the Respective child
> domain.
> 2. Edit the Primary Storage Resource limits for the account added above .
> Limit being 200 GB , edit the value as 1Gb.
> 3. Try to upload volume greater than 1Gb. (Volume is successfully uploaded. )
> 4. try attaching the volume to a vm.
> Result:
> attach volume is successful even though the resource limits reached.
> Expected:
> attach volume should fail with resource limit reached on primary exception.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)