Richard Lawley created CLOUDSTACK-9614:
------------------------------------------

             Summary: Attaching Volume to VM incorrectly checks resource limits
                 Key: CLOUDSTACK-9614
                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9614
             Project: CloudStack
          Issue Type: Bug
      Security Level: Public (Anyone can view this level - this is the default.)
    Affects Versions: 4.8.0
            Reporter: Richard Lawley


When you try to attach an existing volume to a VM, a resource check is 
incorrectly performed and this can incorrectly prevent attachment of the disk 
if the account has low available primary storage.

To reproduce:
1.  Create an account, with a primary storage limit.
2.  Deploy a VM to that account
3.  Create a volume on that account, using >50% of the remaining space
4.  Try to attach the created volume to the VM

{quote}
Maximum number of resources of type 'primary_storage' for account name=XXXXXX 
in domain id=XXXX has been exceeded.
{quote}

This has been found on 4.8.0, but I can't find any reference to a similar bug, 
and looking at the code for VolumeApiServiceImpl.java it looks to me like it's 
still there:

{code}
try {
    _resourceLimitMgr.checkResourceLimit(owner, ResourceType.primary_storage, 
volumeToAttach.getSize());
} catch (ResourceAllocationException e) {
    s_logger.error("primary storage resource limit check failed", e);
    throw new InvalidParameterValueException(e.getMessage());
}
{code}

I'm not sure if there are any scenarios where a volume can be attached that 
wasn't already using resources from the account involved - if not then I'm not 
sure any resource check should be performed here.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to