Skip to content

Commit fed9b6a

Browse files
author
Sina Kashipazha
committed
Updated pr to address @GutoVeronezi change requests.
1 parent cbd780d commit fed9b6a

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

engine/schema/src/main/java/com/cloud/capacity/dao/CapacityDaoImpl.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import javax.inject.Inject;
2828

2929
import org.apache.log4j.Logger;
30+
import org.apache.commons.lang3.StringUtils;
3031
import org.springframework.stereotype.Component;
3132

3233
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
@@ -433,14 +434,14 @@ public Ternary<Long, Long, Long> findCapacityByZoneAndHostTag(Long zoneId, Strin
433434
PreparedStatement pstmt;
434435

435436
StringBuilder allocatedSql = new StringBuilder(LIST_ALLOCATED_CAPACITY_GROUP_BY_CAPACITY_AND_ZONE);
436-
if (hostTag != null && ! hostTag.isEmpty()) {
437+
if (StringUtils.isNotEmpty(hostTag)) {
437438
allocatedSql.append(LEFT_JOIN_VM_TEMPLATE);
438439
}
439440
allocatedSql.append(WHERE_STATE_IS_NOT_DESTRUCTIVE);
440441
if (zoneId != null) {
441442
allocatedSql.append(" AND vi.data_center_id = ?");
442443
}
443-
if (hostTag != null && ! hostTag.isEmpty()) {
444+
if (StringUtils.isNotEmpty(hostTag)) {
444445
allocatedSql.append(" AND (vm_template.template_tag = '").append(hostTag).append("'");
445446
allocatedSql.append(" OR service_offering.host_tag = '").append(hostTag).append("')");
446447
}

engine/schema/src/main/java/com/cloud/vm/dao/UserVmDaoImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ public List<Ternary<Integer, Integer, Integer>> countVmsBySize(long dcId, int li
749749
result.add(new Ternary<Integer, Integer, Integer>(rs.getInt(1), rs.getInt(2), rs.getInt(3)));
750750
}
751751
} catch (Exception e) {
752-
s_logger.warn("Error counting vms by size", e);
752+
s_logger.warn("Error counting vms by size for dcId= " + dcId, e);
753753
}
754754
return result;
755755
}

engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ public Long countByZoneAndStateAndHostTag(long dcId, State state, String hostTag
823823
return rs.getLong(1);
824824
}
825825
} catch (Exception e) {
826-
s_logger.warn("Error counting vms by host tag", e);
826+
s_logger.warn(String.format("Error counting vms by host tag for dcId= %s, hostTag= %s", dcId, hostTag), e);
827827
}
828828
return 0L;
829829
}

0 commit comments

Comments
 (0)