rafaelweingartner commented on a change in pull request #2298: CLOUDSTACK-9620:
Enhancements for managed storage
URL: https://github.com/apache/cloudstack/pull/2298#discussion_r161183410
##########
File path: engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
##########
@@ -599,6 +607,60 @@ protected void advanceExpunge(VMInstanceVO vm) throws
ResourceUnavailableExcepti
}
+ private List<Map<String, String>> getTargets(Long hostId, long vmId) {
+ List<Map<String, String>> targets = new ArrayList<>();
+
+ HostVO hostVO = _hostDao.findById(hostId);
+
+ if (hostVO != null && hostVO.getHypervisorType() ==
HypervisorType.VMware) {
+ List<VolumeVO> volumes = _volsDao.findByInstance(vmId);
+
+ if (volumes != null) {
Review comment:
what if you invert this one here?
`if (CollectionUtils.isEmpty(volumes))`, then you return targets.
This would allow to remove the other for and IF statement from one
conditional.
Rule of thumb: the less nested things, the better to read.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services