mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
server: check limit on correct store during snapshot allocation (#11558)
Fixes #11551 Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
parent
6d16ac2113
commit
2cd7d8a315
@ -1696,9 +1696,14 @@ public class SnapshotManagerImpl extends MutualExclusiveIdsManagerBase implement
|
|||||||
Type snapshotType = getSnapshotType(policyId);
|
Type snapshotType = getSnapshotType(policyId);
|
||||||
Account owner = _accountMgr.getAccount(volume.getAccountId());
|
Account owner = _accountMgr.getAccount(volume.getAccountId());
|
||||||
|
|
||||||
|
ResourceType storeResourceType = ResourceType.secondary_storage;
|
||||||
|
if (!isBackupSnapshotToSecondaryForZone(volume.getDataCenterId()) ||
|
||||||
|
Snapshot.LocationType.PRIMARY.equals(locationType)) {
|
||||||
|
storeResourceType = ResourceType.primary_storage;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
_resourceLimitMgr.checkResourceLimit(owner, ResourceType.snapshot);
|
_resourceLimitMgr.checkResourceLimit(owner, ResourceType.snapshot);
|
||||||
_resourceLimitMgr.checkResourceLimit(owner, ResourceType.secondary_storage, new Long(volume.getSize()).longValue());
|
_resourceLimitMgr.checkResourceLimit(owner, storeResourceType, volume.getSize());
|
||||||
} catch (ResourceAllocationException e) {
|
} catch (ResourceAllocationException e) {
|
||||||
if (snapshotType != Type.MANUAL) {
|
if (snapshotType != Type.MANUAL) {
|
||||||
String msg = String.format("Snapshot resource limit exceeded for account %s. Failed to create recurring snapshots", owner);
|
String msg = String.format("Snapshot resource limit exceeded for account %s. Failed to create recurring snapshots", owner);
|
||||||
@ -1749,7 +1754,7 @@ public class SnapshotManagerImpl extends MutualExclusiveIdsManagerBase implement
|
|||||||
}
|
}
|
||||||
CallContext.current().putContextParameter(Snapshot.class, snapshot.getUuid());
|
CallContext.current().putContextParameter(Snapshot.class, snapshot.getUuid());
|
||||||
_resourceLimitMgr.incrementResourceCount(volume.getAccountId(), ResourceType.snapshot);
|
_resourceLimitMgr.incrementResourceCount(volume.getAccountId(), ResourceType.snapshot);
|
||||||
_resourceLimitMgr.incrementResourceCount(volume.getAccountId(), ResourceType.secondary_storage, new Long(volume.getSize()));
|
_resourceLimitMgr.incrementResourceCount(volume.getAccountId(), storeResourceType, volume.getSize());
|
||||||
return snapshot;
|
return snapshot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user