Vered Volansky has uploaded a new change for review. Change subject: core: Leave free space value as null ......................................................................
core: Leave free space value as null In Some situations, such as a newly created disks or disks on a storage domain that's been re-connected, the disk's free space - StorageDomainDynamic.availableDiskSize is null. This was interpreted into 0 in some cases, causing a strict reaction from the system, though is doesn't necessarily means the storage has 0 space. These cases are now using the null value and do not assume low space. The value will be updated on the next poll from vdsm, making sure future behaviour is as is should. Change-Id: I3379f34c0022eb7066db400f9d9342f8d02fb85f Bug-Url: https://bugzilla.redhat.com/1177147 Bug-Url: https://bugzilla.redhat.com/1182012 Related-To: https://bugzilla.redhat.com/1176854 Signed-off-by: Vered Volansky <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/storage/StorageDomainValidator.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/StorageDomainDynamic.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/IrsProxyData.java 3 files changed, 17 insertions(+), 17 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/50/37250/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/storage/StorageDomainValidator.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/storage/StorageDomainValidator.java index 40c02a7..47724d3 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/storage/StorageDomainValidator.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/storage/StorageDomainValidator.java @@ -59,7 +59,9 @@ public ValidationResult isDomainWithinThresholds() { StorageDomainDynamic dynamic = storageDomain.getStorageDynamicData(); - if (dynamic != null && dynamic.getfreeDiskInGB() < getLowDiskSpaceThreshold()) { + if (dynamic != null + && dynamic.getAvailableDiskSize() != null + && dynamic.getAvailableDiskSize() < getLowDiskSpaceThreshold()) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN, storageName()); } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/StorageDomainDynamic.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/StorageDomainDynamic.java index 1a6515f..2fc71d8 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/StorageDomainDynamic.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/StorageDomainDynamic.java @@ -55,12 +55,6 @@ return totalSize != 0 ? (availableDiskSize / totalSize) * 100 : 0.0; } - public int getfreeDiskInGB() { - int availableDiskSize = getAvailableDiskSize() == null ? 0 : getAvailableDiskSize(); - return availableDiskSize; - } - - @Override public int hashCode() { final int prime = 31; diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/IrsProxyData.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/IrsProxyData.java index 3ddb271..522f98f 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/IrsProxyData.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/IrsProxyData.java @@ -424,19 +424,23 @@ DbFacade.getInstance().getStorageDomainDynamicDao().update(data.getStorageDynamicData()); if (data.getAvailableDiskSize() != null && data.getUsedDiskSize() != null) { double freePercent = data.getStorageDynamicData().getfreeDiskPercent(); - int freeDiskInGB = data.getStorageDynamicData().getfreeDiskInGB(); AuditLogType type = AuditLogType.UNASSIGNED; - boolean spaceThresholdMet = - freeDiskInGB < Config.<Integer> getValue(ConfigValues.FreeSpaceCriticalLowInGB); - boolean percentThresholdMet = - freePercent < Config.<Integer> getValue(ConfigValues.FreeSpaceLow); - if (spaceThresholdMet && percentThresholdMet) { - type = AuditLogType.IRS_DISK_SPACE_LOW_ERROR; - } else { - if (spaceThresholdMet || percentThresholdMet) { - type = AuditLogType.IRS_DISK_SPACE_LOW; + Integer freeDiskInGB = data.getStorageDynamicData().getAvailableDiskSize(); + if (freeDiskInGB != null) { + boolean spaceThresholdMet = + freeDiskInGB < Config.<Integer>getValue(ConfigValues.FreeSpaceCriticalLowInGB); + boolean percentThresholdMet = + freePercent < Config.<Integer>getValue(ConfigValues.FreeSpaceLow); + + if (spaceThresholdMet && percentThresholdMet) { + type = AuditLogType.IRS_DISK_SPACE_LOW_ERROR; + } else { + if (spaceThresholdMet || percentThresholdMet) { + type = AuditLogType.IRS_DISK_SPACE_LOW; + } } } + if (type != AuditLogType.UNASSIGNED) { AuditLogableBase logable = new AuditLogableBase(); logable.setStorageDomain(data); -- To view, visit http://gerrit.ovirt.org/37250 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3379f34c0022eb7066db400f9d9342f8d02fb85f Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Vered Volansky <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
