use of com.emc.storageos.model.quota.QuotaInfo in project coprhd-controller by CoprHD.
the class TenantsService method getQuota.
private QuotaInfo getQuota(TenantOrg tenant) {
QuotaInfo quotaInfo = new QuotaInfo();
double capacity = CapacityUtils.getTenantCapacity(_dbClient, tenant.getId());
quotaInfo.setQuotaInGb(tenant.getQuota());
quotaInfo.setEnabled(tenant.getQuotaEnabled());
quotaInfo.setCurrentCapacityInGb((long) Math.ceil(capacity / CapacityUtils.GB));
quotaInfo.setLimitedResource(DbObjectMapper.toNamedRelatedResource(tenant));
return quotaInfo;
}
use of com.emc.storageos.model.quota.QuotaInfo in project coprhd-controller by CoprHD.
the class VirtualPoolCommonForm method loadQuota.
/**
* Loads the quota information from the provide QuotaResources (either the block or file virtual pool resources).
*
* @param resources
* the resources from which to load the quota.
*/
protected void loadQuota(QuotaResources resources) {
URI virtualPoolId = ResourceUtils.uri(id);
if (virtualPoolId != null) {
QuotaInfo quotaInfo = resources.getQuota(virtualPoolId);
if (quotaInfo != null) {
enableQuota = quotaInfo.getEnabled();
quota = quotaInfo.getQuotaInGb();
}
}
}
use of com.emc.storageos.model.quota.QuotaInfo in project coprhd-controller by CoprHD.
the class Projects method edit.
@FlashException(value = "list", keep = true)
public static void edit(String id) {
ProjectRestRep viprProject = ProjectUtils.getProject(id);
if (viprProject == null) {
flash.error(MessagesUtils.get(UNKNOWN, id));
list();
}
QuotaInfo quota = null;
if (Security.isTenantAdmin()) {
quota = ProjectUtils.getQuota(id);
}
if (viprProject != null) {
ProjectForm project = new ProjectForm().from(viprProject, quota);
project.aclEntries = AclEntryForm.loadAclEntryForms(ProjectUtils.getACLs(id));
addRenderArgs();
render(project);
} else {
flash.error(MessagesUtils.get("projects.unknown", id));
list();
}
}
use of com.emc.storageos.model.quota.QuotaInfo in project coprhd-controller by CoprHD.
the class TenantModificationTest method securityAdminModifyTenantQuota.
@Test
public void securityAdminModifyTenantQuota() throws Exception {
QuotaInfo original = secAdminClient.tenants().getQuota(rootTenantID);
QuotaUpdateParam quotaUpdateParam = new QuotaUpdateParam();
quotaUpdateParam.setEnable(true);
quotaUpdateParam.setQuotaInGb(50L);
secAdminClient.tenants().updateQuota(rootTenantID, quotaUpdateParam);
// restore quota
quotaUpdateParam.setEnable(original.getEnabled());
quotaUpdateParam.setQuotaInGb(original.getQuotaInGb());
secAdminClient.tenants().updateQuota(rootTenantID, quotaUpdateParam);
// should no exception
}
use of com.emc.storageos.model.quota.QuotaInfo in project coprhd-controller by CoprHD.
the class ProjectService method getQuota.
private QuotaInfo getQuota(Project project) {
QuotaInfo quotaInfo = new QuotaInfo();
double capacity = CapacityUtils.getProjectCapacity(_dbClient, project.getId());
quotaInfo.setQuotaInGb(project.getQuota());
quotaInfo.setEnabled(project.getQuotaEnabled());
quotaInfo.setCurrentCapacityInGb((long) Math.ceil(capacity / CapacityUtils.GB));
quotaInfo.setLimitedResource(DbObjectMapper.toNamedRelatedResource(project));
return quotaInfo;
}
Aggregations