Github user koushik-das commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/679#discussion_r36827811
--- Diff: server/src/com/cloud/api/query/dao/SecurityGroupJoinDaoImpl.java
---
@@ -125,6 +130,14 @@ 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) {
+
sgResponse.addVirtualMachineId(_userVmDao.findById(securityGroupVMMapVO.getInstanceId()).getUuid());
--- End diff --
Add a check that findById is not returning null. There is a possibility
that VM may get deleted after the call to listBySecurityGroup() but before that
map entry is processed in the for-loop.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---