GitHub user PranaliM opened a pull request:
https://github.com/apache/cloudstack/pull/1992
CLOUDSTACK-9824:Resource count for Primary storage is considered twice -
while creating and while attaching the disk
The Primary Storage resource counts is considered twice: Once while
creating the volume and next while attaching it. This results in failure while
Attaching the volume, if the primary storage resource limit is set.
Following are the steps to reproduce the issue:
1. Create a Domain
2. Create an Account.
3. Allocate 11 GB Primary storage limit to the domain.
4. Deploy a VM sized 8GB (Primary storage resource count is now 8GB )
5. Create a 2GB custom disk by using the option 'Add Volume' link.(Primary
storage resource count is now 10GB). The Volume state is 'Allocated'
6. Now try to Attach the data-disk created above to a VM. At this point the
resource count limit is again checked, and the attachment fails, because it is
expected to be 12GB, but, which exceeds the limit of 11GB.
7. This issue is also observed for volumes which are 'Detached'. On
detaching an attached volume, the state is still seen as 'Ready'. When such a
volume is tried to attach again, it will fail as the resource limit will be
checked again.
Fix implemented:
1. When a volume is âAddedâ, its state is seen as âAllocatedâ and
it utilizes the primary storage resource. When the Volume in âAllocatedâ
state is attached to a VM, its state changes to âReadyâ.
2. When the volume is detached from the VM, its state is still seen as
âReadyâ. When the volume is detached, the resources (primary storage) are
not released, because the volume is still in primary storage.
3. The fix is to skip checking the resource limit when the volume state is
either 'Allocated' or 'Ready'. Because the volume state being 'Allocated' or
'Ready' implies that it is already on the Primary storage and hence the limit
should not be checked again.
Test Results:
1. Set a limit of 42 GB primary storage to a new domain
2. Deployed a 30GB VM in it.
3. Created a 10 GB disk and could attach and detach it multiple times
without any error of resource limit.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/Accelerite/cloudstack CS-9824
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cloudstack/pull/1992.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 #1992
commit 616c05e2921af6b713f8a4bce2d2421b03462a22
Author: Pranali Mande
Date: 2017-03-07T11:53:02Z
CLOUDSTACK-9824:Resource count for Primary storage is considered twice -
while creating and while attaching the disk
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---