cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

host anti-affinity is not working

Open kiranchavala opened this issue 2 years ago • 15 comments

ISSUE TYPE
  • Bug report
COMPONENT NAME
Compute
CLOUDSTACK VERSION
4.18 nightly
4.17.2

CONFIGURATION
OS / ENVIRONMENT

Centos 7 , 1 management , 1 pod , 1 cluster with 2 kvm hypervisor hosts

SUMMARY

host anti-affinity is not working

STEPS TO REPRODUCE

1. Create a affinity group of type "host anti-affinity (Strict)".

2. Deploy 2 vm without any affinity group attached 

3. Check the vm's host ( they can be deployed on the same host)

Note: Make sure the vm's are deployed on 1 single host in the cluster

3. Stop the vm's

4. Change the affinity group  of the vms to  "host anti-affinity (Strict)"

Note: Make sure the affinity group is attached to the vm

5. Start the vm 

6. The Vm 's still remains on the same host in the cluster

Made sure to uncheck the option to start on Last host 
![start](https://user-images.githubusercontent.com/1401014/218453831-ed4070bf-707d-4d39-80fc-36477a7e74a2.png)



EXPECTED RESULTS
The vm's should go to different host in the cluster
ACTUAL RESULTS
The vm's  are not going  to different hosts  in the cluster

kiranchavala avatar Feb 13 '23 12:02 kiranchavala

@borisstoyanov please add the tag type:bug

kiranchavala avatar Feb 13 '23 12:02 kiranchavala

@DaanHoogland The issue is also observed on 4.17.2 release.

kiranchavala avatar Feb 14 '23 05:02 kiranchavala

@DaanHoogland

The issue is not observed if we deploy directly instances with an affinity group attached. (First attempt)

The issue is observed when the affinity group is attached or changed to the instance on subsequent attempts

kiranchavala avatar Feb 14 '23 06:02 kiranchavala

@kiranchavala Have you tried with considerlasthost = false ?

image

weizhouapache avatar Feb 14 '23 07:02 weizhouapache

@weizhouapache I didn't try with consider Last host ( it was disabled)

kiranchavala avatar Feb 22 '23 05:02 kiranchavala

@kiranchavala I will try to reproduce the issue

weizhouapache avatar Feb 22 '23 07:02 weizhouapache

@kiranchavala I cannot reproduce the issue. see steps below

  • create host anti-affinity group
  • create vm1 on kvm1, with host anti-affinity group
  • create vm2 on kvm1, without host anti-affinity group
  • stop vm2
  • start vm2 with considerlasthost=false (by cmk)
  • vm2 is started on kvm2

weizhouapache avatar Feb 23 '23 08:02 weizhouapache

@weizhouapache

Could you please follow these steps


1. Create a affinity group of type "host anti-affinity (Strict)".

2. Deploy 2 vm's ok  without any affinity group attached 

3. Check the vm's host ( they can be deployed on the same host)

Note: Make sure the vm's are deployed on 1 single host in the cluster

3. Stop the vm's

4. Change the affinity group  of the vms to  "host anti-affinity (Strict)"

Note: Make sure the affinity group is attached to the vm

5. Start the vm (Made sure to uncheck the option to start on Last host )

6. The Vm 's still remain on the same host in the cluster in spite of changing the affinity group

kiranchavala avatar Feb 23 '23 08:02 kiranchavala

@kiranchavala I still cannot reproduce the issue you mentioned.

but I found that if hostid is specified, the affinity groups seems not be checked

weizhouapache avatar Mar 14 '23 09:03 weizhouapache

@kiranchavala I am able to reproduce the issue I will have a look

weizhouapache avatar Aug 14 '23 12:08 weizhouapache

@kiranchavala this only happens when start both VMs in parallel in my testing. If I start the vms one by one, it works fine.

is that same in your testing ?

weizhouapache avatar Aug 14 '23 15:08 weizhouapache

moved to 4.18.2.0

weizhouapache avatar Aug 24 '23 14:08 weizhouapache

@kiranchavala @weizhouapache I think this is a logical consequence of the functionality. If you add an affinity group after creating, the system must have the chance to find a proper location for the VM, it does so with two VM in parallel and for each the location is proper at the moment of starting to only be in conflict with a parallel start. I will do more testing (with initial starting of a present anti affinity group) to see if more strange things occur, but I think this one is due to the operator action and to be expected.

DaanHoogland avatar Aug 29 '23 09:08 DaanHoogland

This is still an issue, @kiranchavala ?

rohityadavcloud avatar Apr 30 '24 10:04 rohityadavcloud

this looks like same as #9110

weizhouapache avatar Jun 06 '24 11:06 weizhouapache

@kiranchavala a solution has been merged in 4.19 branch in #9201 . Can you verify it?

DaanHoogland avatar Aug 13 '24 12:08 DaanHoogland

The issue is fixed, , followed these steps and its working fine


1. Create a affinity group of type "host anti-affinity (Strict)".

2. Deploy 2 vm's ok  without any affinity group attached 

3. Check the vm's host ( they can be deployed on the same host)

Note: Make sure the vm's are deployed on 1 single host in the cluster

3. Stop the vm's

4. Change the affinity group  of the vms to  "host anti-affinity (Strict)"

Note: Make sure the affinity group is attached to the vm

5. Start the vm (Made sure to uncheck the option to start on Last host )

6. The vm's got deployed  on different hosts 

kiranchavala avatar Aug 19 '24 04:08 kiranchavala