Skip to content

Commit b5f7eef

Browse files
committed
prevent negative values
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent af256b7 commit b5f7eef

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

plugins/integrations/veeam-control-service/src/main/java/org/apache/cloudstack/veeam/api/converter/HostJoinVOToHostConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public static Host toHost(final HostJoinVO vo) {
7070

7171
// --- Memory ---
7272
h.setMemory(String.valueOf(vo.getTotalMemory()));
73-
h.setMaxSchedulingMemory(String.valueOf(vo.getTotalMemory() - vo.getMemUsedCapacity()));
73+
h.setMaxSchedulingMemory(String.valueOf(Math.max(0, vo.getTotalMemory() - vo.getMemUsedCapacity())));
7474

7575
h.setType("ovirt_node");
7676
h.setAutoNumaStatus("unknown");

plugins/integrations/veeam-control-service/src/main/java/org/apache/cloudstack/veeam/api/converter/StoreVOToStorageDomainConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static StorageDomain toStorageDomain(final StoragePoolJoinVO pool) {
4848
sd.setName(pool.getName());
4949

5050
// oVirt sample returns numbers as strings
51-
sd.setAvailable(Long.toString(pool.getCapacityBytes() - pool.getUsedBytes()));
51+
sd.setAvailable(Long.toString(Math.max(0, pool.getCapacityBytes() - pool.getUsedBytes())));
5252
sd.setUsed(Long.toString(pool.getUsedBytes()));
5353
sd.setCommitted(Long.toString(pool.getCapacityBytes()));
5454

0 commit comments

Comments
 (0)