mirror of https://github.com/apache/cloudstack.git
[22.0] Consider infinite resources when calculating secondary storage limit for upload operations
This commit is contained in:
parent
d722415105
commit
07c3dc86b2
|
|
@ -19,6 +19,9 @@
|
|||
|
||||
package org.apache.cloudstack.storage.command;
|
||||
|
||||
import com.cloud.configuration.Resource;
|
||||
import org.apache.cloudstack.utils.bytescale.ByteScaleUtils;
|
||||
|
||||
public class TemplateOrVolumePostUploadCommand {
|
||||
|
||||
long entityId;
|
||||
|
|
@ -185,6 +188,11 @@ public class TemplateOrVolumePostUploadCommand {
|
|||
this.description = description;
|
||||
}
|
||||
|
||||
public void setDefaultMaxSecondaryStorageInBytes(long defaultMaxSecondaryStorageInBytes) {
|
||||
this.defaultMaxSecondaryStorageInGB = defaultMaxSecondaryStorageInBytes != Resource.RESOURCE_UNLIMITED ?
|
||||
ByteScaleUtils.bytesToGibibytes(defaultMaxSecondaryStorageInBytes) : Resource.RESOURCE_UNLIMITED;
|
||||
}
|
||||
|
||||
public void setDefaultMaxSecondaryStorageInGB(long defaultMaxSecondaryStorageInGB) {
|
||||
this.defaultMaxSecondaryStorageInGB = defaultMaxSecondaryStorageInGB;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -542,7 +542,9 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
|
|||
Account account = _accountDao.findById(accountId);
|
||||
Domain domain = domainDao.findById(account.getDomainId());
|
||||
|
||||
// one of the two following might have to be removed
|
||||
command.setDefaultMaxSecondaryStorageInGB(_resourceLimitMgr.findCorrectResourceLimitForAccountAndDomain(account, domain, ResourceType.secondary_storage, null));
|
||||
command.setDefaultMaxSecondaryStorageInBytes(_resourceLimitMgr.findCorrectResourceLimitForAccountAndDomain(account, domain, ResourceType.secondary_storage, null));
|
||||
command.setAccountId(accountId);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
String metadata = EncryptionUtil.encodeData(gson.toJson(command), key);
|
||||
|
|
|
|||
|
|
@ -500,9 +500,9 @@ public class HypervisorTemplateAdapter extends TemplateAdapterBase {
|
|||
boolean dataDiskDeletetionResult = true;
|
||||
List<VMTemplateVO> dataDiskTemplates = templateDao.listByParentTemplatetId(template.getId());
|
||||
if (CollectionUtils.isNotEmpty(dataDiskTemplates)) {
|
||||
logger.info("Template: {} has Datadisk template(s) associated with it. Delete Datadisk templates before deleting the template", template);
|
||||
logger.info("Template: {} has Datadisk template(s) associated with it. Delete Datadisk Templates before deleting the Template", template);
|
||||
for (VMTemplateVO dataDiskTemplate : dataDiskTemplates) {
|
||||
logger.info("Delete Datadisk template: {} from image store: {}", dataDiskTemplate, imageStore);
|
||||
logger.info("Delete Datadisk Template: {} from image store: {}", dataDiskTemplate, imageStore);
|
||||
AsyncCallFuture<TemplateApiResult> future = imageService.deleteTemplateAsync(imageFactory.getTemplate(dataDiskTemplate.getId(), imageStore));
|
||||
try {
|
||||
TemplateApiResult result = future.get();
|
||||
|
|
|
|||
Loading…
Reference in New Issue