salt icon indicating copy to clipboard operation
salt copied to clipboard

salt-cloud with lxc driver raise exception and exit if some of target host unavailable

Open samodid opened this issue 9 years ago • 3 comments

Description of Issue/Question

salt-cloud lxc driver raise exaction and exit if some of target host unavailable. That does not allow to use another provider or use salt-cloud query options like salt-cloud -Q | salt-cloud -F

Setup

# cat /etc/salt/cloud.providers.d/lxc.conf 

lab-deb9-cloud01:
  target: lab-deb9-cloud01
  driver: lxc

lab-deb9-cloud02:
  target: lab-deb9-cloud02
  driver: lxc

Steps to Reproduce Issue

configure 2 providers with lxc driver ( example provided above)

# salt lab-deb9-cloud* test.ping
lab-deb9-cloud02:
    True
lab-deb9-cloud01:
    True

run salt-cloud

# salt-cloud -Q
lab-deb9-cloud01:
    ----------
    lxc:
        ----------
        test-container01:
            ----------
            id:
                test-container01
            image:
                None
            name:
                test-container01
            private_ips:
            public_ips:
            size:
                None
            state:
                stopped
lab-deb9-cloud02:
    ----------
    lxc:
        ----------
        test-container02:
            ----------
            id:
                test-container02
            image:
                None
            name:
                test-container02
            private_ips:
            public_ips:
            size:
                None
            state:
                stopped

shutdown one of node

# salt --async lab-deb9-cloud02 cmd.run 'systemctl poweroff'
Executed command with job ID: 20171122190509759460
# salt lab-deb9-cloud* test.ping
lab-deb9-cloud01:
    True
lab-deb9-cloud02:
    Minion did not return. [Not connected]

run salt-cloud

# salt-cloud -Q
Error: ('Configured provider lab-deb9-cloud02:lxc minion: lab-deb9-cloud02 is unreachable',)

Versions Report

# salt-cloud --versions-report
Salt Version:
            Salt: 2017.7.2
 
Dependency Versions:
 Apache Libcloud: 1.5.0
            cffi: Not Installed
        cherrypy: Not Installed
        dateutil: 2.5.3
       docker-py: Not Installed
           gitdb: 2.0.0
       gitpython: 2.1.1
           ioflo: Not Installed
          Jinja2: 2.9.4
         libgit2: Not Installed
         libnacl: Not Installed
        M2Crypto: Not Installed
            Mako: Not Installed
    msgpack-pure: Not Installed
  msgpack-python: 0.4.8
    mysql-python: Not Installed
       pycparser: Not Installed
        pycrypto: 2.6.1
    pycryptodome: Not Installed
          pygit2: Not Installed
          Python: 2.7.13 (default, Jan 19 2017, 14:48:08)
    python-gnupg: Not Installed
          PyYAML: 3.12
           PyZMQ: 16.0.2
            RAET: Not Installed
           smmap: 2.0.1
         timelib: Not Installed
         Tornado: 4.4.3
             ZMQ: 4.2.1
 
System Versions:
            dist: debian 9.1 
          locale: UTF-8
         machine: x86_64
         release: 4.9.0-4-amd64
          system: Linux
         version: debian 9.1 

samodid avatar Nov 22 '17 19:11 samodid

Looks like that logic located here https://github.com/saltstack/salt/blob/4e5662543f7d4db69031fe275322cafd8009a9fd/salt/cloud/clouds/lxc.py#L562-L566

I propose to replace exception with log.error about unreachable host and return false.

samodid avatar Nov 22 '17 19:11 samodid

ping @saltstack/team-cloud any opinions here on the suggested fix?

Ch3LL avatar Nov 22 '17 22:11 Ch3LL

I would just log a warning instead of exiting, and then just move on.

That seems reasonable.

gtmanfred avatar Nov 27 '17 16:11 gtmanfred