saltstack / saltstack/salt

[BUG] salt-cloud doesn't honor filter_events when creating VMs in parallel

Open
#57,351 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug severity-medium
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
When multiple VMs are created in parallel for some of them salt-cloud in the created event does not send data specified in filter_events (from salt-cloud config file).

Setup
This is relevant part of my /etc/salt/cloud config file:

filter_events:
  created:
    keys:
      - minion

I'm observing salt events with this:

while true; do   
   salt-run state.event pretty=True 2>&1 | tee -a ~dave/multi-events
done

The loop shouldn't be necessary, but salt-run is frequently exiting with errors, as reported in #57349

Steps to Reproduce the behavior

If I try to create just one VM everything works fine. The problem appears when I try to create more than one:

salt-cloud -P -m stest.map stest-app-01.xdc stest-proxy-01.xdc

The problem appears without -P flag as well, but it's faster to test if things are created in parallel.

This is excerpt from the log file:

salt/cloud/stest-proxy-01.xdc/created   {
    "_stamp": "2020-05-18T10:42:48.724801",
    "driver": "vmware",
    "event": "created instance",
    "name": "stest-proxy-01.xdc",
    "profile": "CentOS-7-stest",
    "provider": "vmware-it-soft-ZG:vmware"
}

There is no minion key in the event. (In my setup there's a reactor which looks into it and then writes a message with some of the data to the slack channel.)

In the current run I didn't manage to catch created event for the second VM (due to #57349 workaround), but since the message on Slack channel contained the data I'm assuming that the data was present in the event.

In all my testing with creating two VMs one of them (the first one specified on the command line) had the data and the second one did not. Even if the second specified was created first.

I didn't (yet) try to create more than two VMs.

Expected behavior

The key minion should be present in the created event for each VM.

Versions Report

salt --versions-report
# salt-cloud --versions-report
Salt Version:
            Salt: 3000.3
 
Dependency Versions:
 Apache Libcloud: 2.2.1
            cffi: Not Installed
        cherrypy: Not Installed
        dateutil: Not Installed
       docker-py: Not Installed
           gitdb: Not Installed
       gitpython: Not Installed
          Jinja2: 2.11.1
         libgit2: Not Installed
        M2Crypto: 0.35.2
            Mako: Not Installed
    msgpack-pure: Not Installed
  msgpack-python: 0.6.2
    mysql-python: Not Installed
       pycparser: Not Installed
        pycrypto: 2.6.1
    pycryptodome: Not Installed
          pygit2: Not Installed
          Python: 3.6.8 (default, Apr  2 2020, 13:34:55)
    python-gnupg: Not Installed
          PyYAML: 3.12
           PyZMQ: 15.3.0
           smmap: Not Installed
         timelib: Not Installed
         Tornado: 4.5.3
             ZMQ: 4.1.4
 
System Versions:
            dist: centos 7.8.2003 Core
          locale: ISO-8859-2
         machine: x86_64
         release: 4.4.169-1.el7.elrepo.x86_64
          system: Linux
         version: CentOS Linux 7.8.2003 Core

Additional context
Add any other context about the problem here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the shown filter_events configuration and the salt-cloud -P command for two VMs, then inspect the parallel VM-creation path and created-event handling. Compare events from single-VM and parallel runs; done means every VM's created event includes the configured minion key.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.