multi-master setup failover and failback is broken in 2016.3.1
Description of Issue/Question
With more than two masters multi-master failover setup, salt-minion fails to connect to the third one after first and second masters are down. After the second master in the list is down, salt-minion ends up with connecting back to salt-master1, which is down, and then to salt-master2, which is down as well, back to salt-master1 again. This becomes a dead loop.
Setup
master:
- master1
- master2
- master3
master_type: failover
master_alive_interval: 30
master_failback: True
master_failback_interval: 30
Steps to Reproduce Issue
masters:
[master1, master2, master3]
master1 is the master minion is currently connecting.
- shutdown salt-master service on master1
- minion connect to master2 based on order, the local master list changes to
[master2, master3, master1] - shutdown salt-master service on master2, the local master list changes to
[master1, master3, master2] - minion connect to master1 and end up with dead loop.
The master list generated in step 3 is definitely wrong. It should be
[master3, master1, master2]
Versions Report
Salt Version:
Salt: 2016.3.1
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.4.2
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.8
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.5
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pygit2: Not Installed
Python: 2.6.6 (r266:84292, Nov 21 2013, 10:50:32)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 15.2.0
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.3
ZMQ: 4.1.2
System Versions:
dist: redhat 6.6 Santiago
machine: x86_64
release: 2.6.32-504.el6.x86_64
system: Linux
version: Red Hat Enterprise Linux Server 6.6 Santiago
Fix is here: https://github.com/saltstack/salt/pull/35008
Please have someone take a look.
@hu-dabao thanks a bunch for catching this and putting in a PR. We really appreciate it. I'll go ahead and close this since the fix has been merged.