sureshanaparti commented on code in PR #12994:
URL: https://github.com/apache/cloudstack/pull/12994#discussion_r3072586074
##########
server/src/main/java/org/apache/cloudstack/cluster/ClusterDrsServiceImpl.java:
##########
@@ -475,12 +479,15 @@ private Pair<Map<Long, List<? extends Host>>, Map<Long,
Map<Host, Boolean>>> get
Map<Long, List<? extends Host>> vmToCompatibleHostsCache = new
HashMap<>();
Map<Long, Map<Host, Boolean>> vmToStorageMotionCache = new HashMap<>();
+ List<Long> vmIds =
vmList.stream().map(VirtualMachine::getId).collect(Collectors.toList());
+ Set<Long> skipDrsVmIds =
userVmDetailsDao.listDetailsForResourceIdsAndKey(vmIds,
VmDetailConstants.SKIP_DRS)
+ .stream().filter(d -> "true".equalsIgnoreCase(d.getValue()))
+ .map(UserVmDetailVO::getResourceId)
+ .collect(Collectors.toSet());
+
for (VirtualMachine vm : vmList) {
// Skip ineligible VMs
- if (vm.getType().isUsedBySystem() ||
- vm.getState() != VirtualMachine.State.Running ||
- (MapUtils.isNotEmpty(vm.getDetails()) &&
-
"true".equalsIgnoreCase(vm.getDetails().get(VmDetailConstants.SKIP_DRS)))) {
+ if (shouldSkipVMForDRS(vm, skipDrsVmIds)) {
Review Comment:
@vishesh92 can we get and check the skip drs detail per vm, instead of
getting the complete list, filtering and checking in them?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]