Github user koushik-das commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/679#discussion_r36958780 --- Diff: server/src/com/cloud/api/query/dao/SecurityGroupJoinDaoImpl.java --- @@ -125,6 +130,16 @@ public SecurityGroupResponse newSecurityGroupResponse(SecurityGroupJoinVO vsg, A } } + List<SecurityGroupVMMapVO> securityGroupVmMap = _securityGroupVMMapDao.listBySecurityGroup(vsg.getId()); + s_logger.debug("newSecurityGroupResponse() -> virtualmachine count: " + securityGroupVmMap.size()); + sgResponse.setVirtualMachineCount(securityGroupVmMap.size()); + + for(SecurityGroupVMMapVO securityGroupVMMapVO : securityGroupVmMap) { + if (_userVmDao.findById(securityGroupVMMapVO.getInstanceId()) != null) { --- End diff -- @borisroman Please make findById() call only once. Something like UserVMVO vm = _userVmDao.findById(securityGroupVMMapVO.getInstanceId()); if (vm != null) { sgResponse.addVirtualMachineId(vm.getUuid()); }
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---