saltstack / saltstack/salt

[BUG] VM creation failing on 3003 with salt-cloud and openstack backend

Open
#60,239 14 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

After migration from salt 2019.2 to salt 3003 VM creation using salt-cloud with openstack backend fail.

Setup

`/etc/salt/cloud.provider.d/xxx.conf`
xxx:
  driver: openstack
  region_name: REG1
  auth:
    auth_url: https://openstack.auth.url/v3
    user_domain_name: Default
    username: 'my_openstack_username'
    password: 'SuP3r_S3cr3tP@ssw4rd!'
    project_domain_name: Default
    project_id: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
    project_name: 'project'
  floating_ip_source: 'none'

  ssh_interface: private_ips
  ssh_key_name: key_name
  ssh_key_file: /path/to/keyfile

  minion:
    master: salt-master-host

  security_groups:
    - no-input

  nics:
    - net-id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    - net-id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
`/etc/salt/cloud.profile.d/xxx.conf`
# Profiles for xxx
xxx_flav1_deb10:
  provider: xxx
  size: flav1
  image: 'my_custom_image'
  ssh_username: 'default_user'
  script: alt-bootstrap-salt
  script_args: |
    -j '{"master": "salt-master-host"}' -x python3 stable 3003
`/srv/cloud-map/test.map`
xxx_flav1_deb10:
  - testvm.domain.tld

Steps to Reproduce the behavior

/srv/cloud-map$ salt-cloud -m test.map 
The following virtual machines are set to be created:
  testvm.domain.tld

Proceed? [N/y] y
... proceeding

and nothing... just waited 10 minutes, no more output

debug log show

[DEBUG   ] Caught exception in wait_for_fun: '__utils__'
[DEBUG   ] Retrying function <function create.<locals>.__query_node at 0x7f4a656dc620> on  (try 1)

againt and again (I gave up and CTRL-C at (try 70))

Exception happens here

Expected behavior

Vm up and running

Proposed patch
I managed to make it work by applying the following patch to salt/cloud/clouds/openstack.py:

--- /tmp/openstack.py	2021-05-24 14:03:30.524393706 +0000
+++ /usr/lib/python3/dist-packages/salt/cloud/clouds/openstack.py	2021-05-24 14:05:13.474926030 +0000
@@ -221,6 +221,7 @@
 import socket
 
 import salt.config as config
+import salt.utils.cloud
 import salt.utils.versions
 from salt.exceptions import (
     SaltCloudConfigError,
@@ -413,11 +414,11 @@
                 "OS-EXT-IPS:type"
             ):
                 ret.append(addr["addr"])
-            elif addr_type == "public" and __utils__["cloud.is_public_ip"](
+            elif addr_type == "public" and salt.utils.cloud.is_public_ip(
                 addr["addr"]
             ):
                 ret.append(addr["addr"])
-            elif addr_type == "private" and not __utils__["cloud.is_public_ip"](
+            elif addr_type == "private" and not salt.utils.cloud.is_public_ip(
                 addr["addr"]
             ):
                 ret.append(addr["addr"])

Versions Report

salt --versions-report
Salt Version:
          Salt: 3003
 
Dependency Versions:
          cffi: Not Installed
      cherrypy: unknown
      dateutil: 2.7.3
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 2.10
       libgit2: 0.27.7
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 0.5.6
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.19
      pycrypto: 2.6.1
  pycryptodome: 3.6.1
        pygit2: 0.27.4
        Python: 3.7.3 (default, Jul 25 2020, 13:03:44)
  python-gnupg: Not Installed
        PyYAML: 3.13
         PyZMQ: 17.1.2
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.1
 
System Versions:
          dist: debian 10 buster
        locale: UTF-8
       machine: x86_64
       release: 4.19.0-13-cloud-amd64
        system: Linux
       version: Debian GNU/Linux 10 buster

Additional context
Exact same configuration was working with salt 2019.2. Upgrading to 3003 started to exhibit the problem.

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 in salt/cloud/clouds/openstack.py around the node-address lookup near line 451, then reproduce with salt-cloud -m test.map and inspect the repeated wait_for_fun 'utils' error. Done means the OpenStack backend creates the VM successfully and the command progresses beyond the repeated retries.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.