use of com.emc.storageos.model.quota.QuotaUpdateParam in project coprhd-controller by CoprHD.
the class VirtualPoolCommonForm method saveQuota.
/**
* Saves the quota value using the provided QuotaResources (either the block or file virtual pool resources).
*
* @param resources
* the resources on which to save the quota.
*/
protected void saveQuota(QuotaResources resources) {
URI virtualPoolId = ResourceUtils.uri(id);
if (virtualPoolId != null) {
QuotaUpdateParam update = new QuotaUpdateParam(isTrue(enableQuota), quota);
resources.updateQuota(virtualPoolId, update);
}
}
use of com.emc.storageos.model.quota.QuotaUpdateParam in project coprhd-controller by CoprHD.
the class TenantModificationTest method tenantAdminModifyTenantQuota.
@Test
public void tenantAdminModifyTenantQuota() throws Exception {
QuotaUpdateParam quotaUpdateParam = new QuotaUpdateParam();
quotaUpdateParam.setEnable(true);
quotaUpdateParam.setQuotaInGb(50L);
try {
tenantAdminClient.tenants().updateQuota(rootTenantID, quotaUpdateParam);
Assert.fail("TenantAdmin should has no permission to change tenant's quota");
} catch (ServiceErrorException see) {
Assert.assertEquals(see.getCode(), 3000);
Assert.assertTrue(see.getMessage().contains("Insufficient permissions"));
}
}
use of com.emc.storageos.model.quota.QuotaUpdateParam 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
}
Aggregations