Replies: 1 comment 4 replies
-
this has been gone over again and again. the salt minion should send events to all CONNECTED masters. if there are two masters that the minion is connected to then it should send events to both. there is no such thing as active and passive in a hot/hot configuration. any master can be used to communicate with all of the minions in a hot/hot config. failover is where active and not active comes into play. but since in failover the minion doesn't connect to all masters. it only connects to one and will failover to the other |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
These relates to
#66341
#66933
Tired of getting duplicate events on the same master, decided to do some diagnosing, finally finding the root cause.
I'm not sure what's the right solution in terms of not causing problems with other possible usage or configurations, so I've opened this discussion thread for some feedback.
The issue is generated when minion is set in multimaster configuration and salt-call is used to send an event,
using event.send module
salt-call event.send "some/event" -l info
or usingfire_event
option in a state.Discovered the problem is in the function
event.fire_master
which is called internally by event.send.salt-call event.fire_master '{}' 'some/event'
This function
event.fire_master
when called using salt-call, creates a list of masters uri and loop the list callingsalt.channel.client.ReqChannel.factory(__opts__, master_uri=master)
in an attempt to send the event to each master.And this function
salt.channel.client.ReqChannel.factory(cls, opts, **kwargs)
receives the master_uri in kwargs but given the following line it's never set to be used due master_uri is also present in optsHere's a trace (my two masters are 172.21.0.10 and 172.21.0.11) after changing to INFO/adding some extra logging lines that demostrates the behavior.
Items for consideration:
should event.fire_event() try to send event to each master, or should be sent only to the active master when called using salt-call. My opinion is it should send the event only once to the active master, having the same event sent to both masters may be a problem, for instance causing reactor based tasks to be triggered on both masters. So I would recommend removing the intent to loop thru masters_uri and just send the event to the active/connected master_uri, making a single call to
salt.channel.client.ReqChannel.factory
Note: I've verified master_uri is updated to reflect the second master uri in case the first master uri is not reachable.
Fix the line code in salt.channel.client.ReqChannel.factory to properly take the master_uri passed in kwargs instead the option from opts. I think the code should be fixed but I don't know the possible spread of issues, maybe this works fine for other uses, configurations.
Add an argument to event.send/event.fire_event to ONLY optional send the event to all masters
In summary, I think event.fire_event should send only 1 event to the active master_uri and the code in salt.channel.client.ReqChannel.factory should be fixed if that's appropriate, and add the option to send event to all masters for those maybe edge cases that this may be needed, given the code is already there to it so.
Here a log showing only 1 event is sent after tweaking fire_event masters list to use only the active master_uri
Testing the behavior when the active master is no longer available, the minion connected to the second master and continued fine.
Beta Was this translation helpful? Give feedback.
All reactions