|
64 | 64 | import org.apache.cloudstack.utils.usage.UsageUtils; |
65 | 65 | import org.apache.commons.collections.CollectionUtils; |
66 | 66 | import org.apache.commons.collections.MapUtils; |
67 | | -import org.apache.commons.io.FileUtils; |
68 | 67 | import org.apache.commons.lang3.BooleanUtils; |
69 | 68 | import org.apache.commons.lang3.StringUtils; |
70 | 69 | import org.apache.commons.lang3.time.DateUtils; |
| 70 | +import org.apache.logging.log4j.Level; |
71 | 71 | import org.influxdb.BatchOptions; |
72 | 72 | import org.influxdb.InfluxDB; |
73 | 73 | import org.influxdb.InfluxDBFactory; |
@@ -1714,7 +1714,8 @@ protected void runInContext() { |
1714 | 1714 | pool.setCapacityBytes(capacityBytes); |
1715 | 1715 | poolNeedsUpdating = true; |
1716 | 1716 | } else { |
1717 | | - logger.warn("Not setting capacity bytes, received " + ((StorageStats)answer).getCapacityBytes() + " capacity for pool ID " + poolId); |
| 1717 | + logger.warn("Not setting capacity bytes, received {} capacity for pool ID {}", |
| 1718 | + NumbersUtil.toReadableSize(((StorageStats)answer).getCapacityBytes()), poolId); |
1718 | 1719 | } |
1719 | 1720 | } |
1720 | 1721 | if (((_storagePoolStats.get(poolId) != null && _storagePoolStats.get(poolId).getByteUsed() != usedBytes) |
@@ -1831,16 +1832,15 @@ public boolean imageStoreHasEnoughCapacity(DataStore imageStore) { |
1831 | 1832 | double totalCapacity = imageStoreStats.getCapacityBytes(); |
1832 | 1833 | double usedCapacity = imageStoreStats.getByteUsed(); |
1833 | 1834 | double threshold = getImageStoreCapacityThreshold(); |
1834 | | - String readableTotalCapacity = FileUtils.byteCountToDisplaySize((long) totalCapacity); |
1835 | | - String readableUsedCapacity = FileUtils.byteCountToDisplaySize((long) usedCapacity); |
1836 | | - |
1837 | | - logger.debug(String.format("Verifying image storage [%s]. Capacity: total=[%s], used=[%s], threshold=[%s%%].", imageStoreId, readableTotalCapacity, readableUsedCapacity, threshold * 100)); |
| 1835 | + String readableTotalCapacity = NumbersUtil.toReadableSize((long) totalCapacity); |
| 1836 | + String readableUsedCapacity = NumbersUtil.toReadableSize((long) usedCapacity); |
1838 | 1837 |
|
| 1838 | + logger.printf(Level.DEBUG, "Verifying image storage [%s]. Capacity: total=[%s], used=[%s], threshold=[%.2f%%].", imageStoreId, readableTotalCapacity, readableUsedCapacity, threshold * 100); |
1839 | 1839 | if (usedCapacity / totalCapacity <= threshold) { |
1840 | 1840 | return true; |
1841 | 1841 | } |
1842 | 1842 |
|
1843 | | - logger.warn(String.format("Image storage [%s] has not enough capacity. Capacity: total=[%s], used=[%s], threshold=[%s%%].", imageStoreId, readableTotalCapacity, readableUsedCapacity, threshold * 100)); |
| 1843 | + logger.printf(Level.WARN, "Image storage [%s] has not enough capacity. Capacity: total=[%s], used=[%s], threshold=[%.2f%%].", imageStoreId, readableTotalCapacity, readableUsedCapacity, threshold * 100); |
1844 | 1844 | return false; |
1845 | 1845 | } |
1846 | 1846 |
|
|
0 commit comments