weizhouapache commented on issue #5527: URL: https://github.com/apache/cloudstack/issues/5527#issuecomment-1042705879
> @weizhouapache I tested the fix but still getting all the 3 VMs running even though they belong to an anti-affinity group. Attaching the logs [antiaffinity.log](https://github.com/apache/cloudstack/files/8085179/antiaffinity.log) @nvazquez I had a quick check on logs, it seems affinity group check has been processed in DeploymentPlanningManagerImpl, so my suspicion is not correct. I think the issue is because 3 vms are started in parallel. the original vm state: (job_107) VM 1: Stopped, host_id: NULL, last host_id: 2 (job_108) VM 2: Stopped, host_id: NULL, last host_id: 2 (job_109) VM 3: Stopped, host_id: NULL, last host_id: 1 after first try: (job_107) VM 1: Starting, host_id: NULL, last host_id: 2 (job_108) VM 2: Starting, host_id: NULL, last host_id: 2 (job_109) VM 3: Starting, host_id: 1, last host_id: 1 after second try: (job_107) VM 1: Starting, host_id: 2, last host_id: 2 (job_108) VM 2: Starting, host_id: 2, last host_id: 2 (job_109) VM 3: Starting, host_id: 1, last host_id: 1 After first try, VM 1 and VM2 are Starting state and do not have host_id. in second try, affinity group does not work well. see code below https://github.com/apache/cloudstack/blob/478e24493e2c44d922d898cbeb11db4cabec826a/plugins/affinity-group-processors/host-anti-affinity/src/main/java/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java#L82-L98 (groupVM.getHostId() is NULL and groupVM.getState() is Stopped for both VM 1 and VM 2.) If VM is started when other vms are Running or Stopped, it should work as expected. -- 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]
