You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2020/04/01 20:28:04 UTC

[GitHub] [cloudstack] DaanHoogland commented on a change in pull request #4001: server: Dedicated hosts should be 'Not Suitable' while find host for m migration

DaanHoogland commented on a change in pull request #4001: server: Dedicated hosts should be 'Not Suitable' while find host for m migration
URL: https://github.com/apache/cloudstack/pull/4001#discussion_r401889314
 
 

 ##########
 File path: plugins/affinity-group-processors/explicit-dedication/src/main/java/org/apache/cloudstack/affinity/ExplicitDedicationProcessor.java
 ##########
 @@ -92,6 +92,17 @@ public void process(VirtualMachineProfile vmProfile, DeploymentPlan plan, Exclud
         DataCenter dc = _dcDao.findById(vm.getDataCenterId());
         List<DedicatedResourceVO> resourceList = new ArrayList<DedicatedResourceVO>();
 
+        List<DedicatedResourceVO> dedicatedHosts = _dedicatedDao.listAll();
+        for (DedicatedResourceVO host : dedicatedHosts) {
+            // Hosts dedicated to different domain/account are not suitable for migration
+            if (host.getAccountId() != null && vm.getAccountId() != host.getAccountId()) {
+                avoid.addHost(host.getHostId());
+            }
+            if (host.getDomainId() != null && vm.getDomainId() != host.getDomainId()) {
+                avoid.addHost(host.getHostId());
+            }
+        }
 
 Review comment:
   can you put this in a separate method?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services