shwstppr commented on a change in pull request #4895:
URL: https://github.com/apache/cloudstack/pull/4895#discussion_r609300603
##########
File path:
plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/guru/VMwareGuru.java
##########
@@ -209,16 +209,41 @@ protected VMwareGuru() {
return vmwareVmImplementer.implement(vm, toVirtualMachineTO(vm),
getClusterId(vm.getId()));
}
- long getClusterId(long vmId) {
- long clusterId;
- Long hostId;
+ private Long getClusterIdFromVmVolume(long vmId) {
+ Long clusterId = null;
+ List<VolumeVO> volumes = _volumeDao.findByInstanceAndType(vmId,
Volume.Type.ROOT);
+ if (CollectionUtils.isNotEmpty(volumes)) {
+ VolumeVO rootVolume = volumes.get(0);
+ if (rootVolume.getPoolId() != null) {
+ StoragePoolVO pool =
_storagePoolDao.findById(rootVolume.getPoolId());
+ if (pool != null && pool.getClusterId() != null) {
+ clusterId = pool.getClusterId();
Review comment:
@nvazquez thanks for pointing this out. Though current changes don't
have a loop, I'm adding one as VM can have multiple ROOT volumes and some can
be on zone-wide store.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]