use of org.ovirt.engine.api.model.QuotaClusterLimits in project ovirt-engine by oVirt.
the class BackendQuotaClusterLimitsResourceTest method testListGlobalLimit.
@Test
public void testListGlobalLimit() throws Exception {
Quota quota = getQuota();
quota.setGlobalQuotaCluster(getClusterGlobalCpuLimit());
setUpGetEntityExpectations(quota);
QuotaClusterLimits clusterLimits = collection.list();
assertClusterLimitsFound(clusterLimits, 1);
QuotaClusterLimit clusterLimit = clusterLimits.getQuotaClusterLimits().get(0);
assertEquals(20, clusterLimit.getVcpuLimit().intValue());
}
use of org.ovirt.engine.api.model.QuotaClusterLimits in project ovirt-engine by oVirt.
the class BackendQuotaClusterLimitsResource method list.
@Override
public QuotaClusterLimits list() {
Quota quota = getQuota();
QuotaClusterLimits limits = new QuotaClusterLimits();
if (quota.getGlobalQuotaCluster() != null) {
addLimit(quotaId.toString(), limits, quota);
} else if (quota.getQuotaClusters() != null) {
for (QuotaCluster quotaCluster : quota.getQuotaClusters()) {
addLimit(quotaCluster.getClusterId().toString(), limits, quota);
}
}
return limits;
}
use of org.ovirt.engine.api.model.QuotaClusterLimits in project ovirt-engine by oVirt.
the class BackendQuotaClusterLimitsResourceTest method testListNonGlobalLimit.
@Test
public void testListNonGlobalLimit() throws Exception {
Quota quota = getQuota();
List<QuotaCluster> clusterLimits = new LinkedList<>();
QuotaCluster clusterLimit1 = new QuotaCluster();
clusterLimit1.setVirtualCpu(CPU_NUMBER);
clusterLimit1.setClusterId(CLUSTER_ID_1);
QuotaCluster clusterLimit2 = new QuotaCluster();
clusterLimit2.setVirtualCpuUsage(VIRTUAL_CPU_USAGE);
clusterLimit2.setClusterId(CLUSTER_ID_2);
clusterLimits.add(clusterLimit1);
clusterLimits.add(clusterLimit2);
quota.setQuotaClusters(clusterLimits);
setUpGetEntityExpectations(quota);
QuotaClusterLimits list = collection.list();
assertClusterLimitsFound(list, 2);
for (QuotaClusterLimit clusterLimit : list.getQuotaClusterLimits()) {
if (clusterLimit.getCluster().getId().equals(CLUSTER_ID_1.toString())) {
assertEquals(CPU_NUMBER, clusterLimit.getVcpuLimit().longValue());
}
if (clusterLimit.getCluster().getId().equals(CLUSTER_ID_2.toString())) {
assertTrue(clusterLimit.getVcpuUsage() == VIRTUAL_CPU_USAGE);
}
}
}
use of org.ovirt.engine.api.model.QuotaClusterLimits in project ovirt-engine by oVirt.
the class V3QuotaClusterLimitsInAdapter method adapt.
@Override
public QuotaClusterLimits adapt(V3QuotaClusterLimits from) {
QuotaClusterLimits to = new QuotaClusterLimits();
if (from.isSetActions()) {
to.setActions(adaptIn(from.getActions()));
}
if (from.isSetActive()) {
to.setActive(from.getActive());
}
if (from.isSetSize()) {
to.setSize(from.getSize());
}
if (from.isSetTotal()) {
to.setTotal(from.getTotal());
}
to.getQuotaClusterLimits().addAll(adaptIn(from.getQuotaClusterLimits()));
return to;
}
Aggregations