ofri masad has uploaded a new change for review. Change subject: webadmin: Fix Unlimited quota is counted as -1 ......................................................................
webadmin: Fix Unlimited quota is counted as -1 In the quota main tab, when using specific quota which includes at least one unlimited cluster/storage-domain, the unlimited quota is counted as -1 (the int value of the constant). Fixed calculation to ignore both the consumption and the allocation of unlimited quota. Change-Id: I7f49bfe3576cecccf80e9ad2105506e3eb267d83 Bug-Url: https://bugzilla.redhat.com/919088 Signed-off-by: Ofri Masad <[email protected]> --- M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabQuotaView.java 1 file changed, 24 insertions(+), 12 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/08/12908/1 diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabQuotaView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabQuotaView.java index 6fad537..a96e3ff 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabQuotaView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabQuotaView.java @@ -69,8 +69,10 @@ used = object.getGlobalQuotaVdsGroup().getMemSizeMBUsage(); } else { for (QuotaVdsGroup quotaVdsGroup : object.getQuotaVdsGroups()) { - allocated += quotaVdsGroup.getMemSizeMB(); - used += quotaVdsGroup.getMemSizeMBUsage(); + if (!QuotaVdsGroup.UNLIMITED_MEM.equals(quotaVdsGroup.getMemSizeMB())) { + allocated += quotaVdsGroup.getMemSizeMB(); + used += quotaVdsGroup.getMemSizeMBUsage(); + } } } if (allocated == 0) { @@ -98,8 +100,10 @@ used = object.getGlobalQuotaVdsGroup().getMemSizeMBUsage(); } else { for (QuotaVdsGroup quotaVdsGroup : object.getQuotaVdsGroups()) { - allocated += quotaVdsGroup.getMemSizeMB(); - used += quotaVdsGroup.getMemSizeMBUsage(); + if (!QuotaVdsGroup.UNLIMITED_MEM.equals(quotaVdsGroup.getMemSizeMB())) { + allocated += quotaVdsGroup.getMemSizeMB(); + used += quotaVdsGroup.getMemSizeMBUsage(); + } } } value = (int)(allocated-used); @@ -128,8 +132,10 @@ used = object.getGlobalQuotaVdsGroup().getVirtualCpuUsage(); } else { for (QuotaVdsGroup quotaVdsGroup : object.getQuotaVdsGroups()) { - allocated += quotaVdsGroup.getVirtualCpu(); - used += quotaVdsGroup.getVirtualCpuUsage(); + if (!QuotaVdsGroup.UNLIMITED_VCPU.equals(quotaVdsGroup.getVirtualCpu())) { + allocated += quotaVdsGroup.getVirtualCpu(); + used += quotaVdsGroup.getVirtualCpuUsage(); + } } } if (allocated == 0) { @@ -157,8 +163,10 @@ used = object.getGlobalQuotaVdsGroup().getVirtualCpuUsage(); } else { for (QuotaVdsGroup quotaVdsGroup : object.getQuotaVdsGroups()) { - allocated += quotaVdsGroup.getVirtualCpu(); - used += quotaVdsGroup.getVirtualCpuUsage(); + if (!QuotaVdsGroup.UNLIMITED_VCPU.equals(quotaVdsGroup.getVirtualCpu())) { + allocated += quotaVdsGroup.getVirtualCpu(); + used += quotaVdsGroup.getVirtualCpuUsage(); + } } } value = allocated - used; @@ -186,8 +194,10 @@ used = object.getGlobalQuotaStorage().getStorageSizeGBUsage(); } else { for (QuotaStorage quotaStorage : object.getQuotaStorages()) { - allocated += quotaStorage.getStorageSizeGB(); - used += quotaStorage.getStorageSizeGBUsage(); + if (!QuotaStorage.UNLIMITED.equals(quotaStorage.getStorageSizeGB())) { + allocated += quotaStorage.getStorageSizeGB(); + used += quotaStorage.getStorageSizeGBUsage(); + } } } if (allocated == 0) { @@ -215,8 +225,10 @@ used = object.getGlobalQuotaStorage().getStorageSizeGBUsage(); } else { for (QuotaStorage quotaStorage : object.getQuotaStorages()) { - allocated += quotaStorage.getStorageSizeGB(); - used += quotaStorage.getStorageSizeGBUsage(); + if (!QuotaStorage.UNLIMITED.equals(quotaStorage.getStorageSizeGB())) { + allocated += quotaStorage.getStorageSizeGB(); + used += quotaStorage.getStorageSizeGBUsage(); + } } } value = allocated - used; -- To view, visit http://gerrit.ovirt.org/12908 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7f49bfe3576cecccf80e9ad2105506e3eb267d83 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: ofri masad <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
