saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.17k stars 5.48k forks source link

[salt-cloud] [new oxygen openstack driver ] no public_ips and floating_ips in salt-cloud output #46659

Closed stamak closed 6 years ago

stamak commented 6 years ago

Description of Issue/Question

salt-cloud does not reports neither public_ips nor floating_ips

root@ubuntu1604:/etc/salt/cloud.profiles.d# cat no_public_ips                                                               
{
    "oxygen-ubuntu2": {
        "vm_state": "active",
        "OS-EXT-STS:task_state": null,
        "addresses": {
            "syndeo-net": [
                {
                    "OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:3d:88:e8",
                    "version": 4,
                    "addr": "172.16.34.44",
                    "OS-EXT-IPS:type": "fixed"
                }
            ]
        },
        "terminated_at": null,
        "image": "ubuntu-server-16.04",
        "OS-EXT-STS:vm_state": "active",
        "OS-SRV-USG:launched_at": "2018-03-22T09:55:33.000000",
        "flavor": {
            "id": "3"
        },
        "az": "nova",
        "fixed_ips": [
            "172.16.34.44"
        ],
        "networks": {},
        "security_groups": [],
        "size": "m1.medium",
        "has_config_drive": true,
        "user_id": "c16a8444171d401e8605157f9b4c8101",
        "disk_config": "MANUAL",
        "OS-DCF:diskConfig": "MANUAL",
        "floating_ips": [],
        "id": "aa075a9c-1ae7-4e5d-87a2-c40c46b0efa4",
        "accessIPv4": "",
        "state": "ACTIVE",
        "accessIPv6": "",
        "location": {
            "project": {
                "domain_name": null,
                "domain_id": null,
                "name": "fra1-syndeo",
                "id": "44111b019d604ae4aafbb0f3b1da9401"
            },
            "cloud": "defaults",
            "region_name": "RegionOne",
            "zone": "nova"
        },
        "power_state": 1,
        "key_name": "os-fra1",
        "progress": 0,
        "OS-EXT-STS:power_state": 1,
        "OS-EXT-AZ:availability_zone": "nova",
        "launched_at": "2018-03-22T09:55:33.000000",
        "metadata": {},
        "status": "ACTIVE",
        "updated": "2018-03-22T09:55:33Z",
        "hostId": "980685f9a5c78cd7b61744bb108f93a791fbf77c31dcae0ca11f33a5",
        "OS-SRV-USG:terminated_at": null,
        "public_v4": null,
        "public_v6": null,
        "private_v4": null,
        "cloud": "defaults",
        "host_id": "980685f9a5c78cd7b61744bb108f93a791fbf77c31dcae0ca11f33a5",
        "task_state": null,
        "properties": {
            "OS-EXT-STS:task_state": null,
            "OS-SRV-USG:terminated_at": null,
            "OS-DCF:diskConfig": "MANUAL",
            "os-extended-volumes:volumes_attached": [],
            "OS-EXT-STS:vm_state": "active",
            "OS-SRV-USG:launched_at": "2018-03-22T09:55:33.000000",
            "OS-EXT-STS:power_state": 1,
            "OS-EXT-AZ:availability_zone": "nova"
        },
        "deployed": true,
        "private_ips": [
            "172.16.34.44"
        ],
        "interface_ip": "",
        "name": "oxygen-ubuntu2",
        "adminPass": null,
        "tenant_id": "44111b019d604ae4aafbb0f3b1da9401",
        "created_at": "2018-03-22T09:55:21Z",
        "created": "2018-03-22T09:55:21Z",
        "os-extended-volumes:volumes_attached": [],
        "project_id": "44111b019d604ae4aafbb0f3b1da9401",
        "public_ips": [],
        "volumes": [],
        "config_drive": "True",
        "region": "RegionOne"
    }
}

but floating IP (207.*.*.80) has been assigned, and used for deployment salt-minion what is shown in debug messages:

[DEBUG   ] Using IP address 207.*.*.80                                                                                [1217/4981]
[DEBUG   ] Salt interface set to: False
[INFO    ] Rendering deploy script: /usr/local/lib/python2.7/dist-packages/salt/cloud/deploy/bootstrap-salt.sh
[DEBUG   ] MasterEvent PUB socket URI: /var/run/salt/master/master_event_pub.ipc
[DEBUG   ] MasterEvent PULL socket URI: /var/run/salt/master/master_event_pull.ipc
[DEBUG   ] Initializing new IPCClient for path: /var/run/salt/master/master_event_pull.ipc
[DEBUG   ] Deploying 207.*.*.80 at 2018-03-22 09:55:46
[DEBUG   ] Attempting connection to host 207.*.*.80 on port 22
[DEBUG   ] SSH port 22 on 207.*.*.80 is available
[DEBUG   ] Using /etc/salt/pki/os-ssh-key.pem as the key_filename
[DEBUG   ] Attempting to authenticate as ubuntu (try 1 of 500)
[DEBUG   ] SSH command: 'ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no
 -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oIdentitiesOnly=yes -oKbdInteractiveAuthentication=no -i /etc/salt/
pki/os-ssh-key.pem -oConnectTimeout=15 -p 22 ubuntu@207.*.*.80 date'
[DEBUG   ] Child Forked! PID: 15832  STDOUT_FD: 5  STDERR_FD: 10
[DEBUG   ] Terminal Command: /bin/sh -c ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAu
thentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oIdentitiesOnly=yes -oKbdInteractiveAuthentication=n
o -i /etc/salt/pki/os-ssh-key.pem -oConnectTimeout=15 -p 22 ubuntu@207.*.*.80 date
Warning: Permanently added '207.*.*.80' (ECDSA) to the list of known hosts.
[DEBUG   ] Warning: Permanently added '207.*.*.80' (ECDSA) to the list of known hosts.
Thu Mar 22 09:55:47 UTC 2018
[DEBUG   ] Thu Mar 22 09:55:47 UTC 2018
[DEBUG   ] Logging into 207.*.*.80:22 as ubuntu
[DEBUG   ] Using /etc/salt/pki/os-ssh-key.pem as the key_filename
[DEBUG   ] Using sudo to run command sudo test -e '/tmp/.saltcloud-a1ab2879-fe88-4f8f-b24f-4b3f855136a5'
[DEBUG   ] SSH command: 'ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthenticat
ion=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oIdentitiesOnly=yes -oKbdInteractiveAuthentication=no -i /etc
/salt/pki/os-ssh-key.pem -p 22 ubuntu@207.*.*.80 sudo test -e '/tmp/.saltcloud-a1ab2879-fe88-4f8f-b24f-4b3f855136a5''
[DEBUG   ] Child Forked! PID: 15834  STDOUT_FD: 5  STDERR_FD: 10
[DEBUG   ] Terminal Command: /bin/sh -c ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPass
wordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oIdentitiesOnly=yes -oKbdInteractiveAuthentica
tion=no -i /etc/salt/pki/os-ssh-key.pem -p 22 ubuntu@207.*.*.80 'sudo test -e '"'"'/tmp/.saltcloud-a1ab2879-fe88-4f8f-b24f-4
b3f855136a5'"'"''

Steps to Reproduce Issue

Provider config

openstack-provider:
  driver: openstack
  region_name: RegionOne
  auth:
    username: user
    password: pass
    project_name: project
    auth_url: 'https://*.net:5000/v2.0'
  verify: False
  compute_name: nova
  ssh_key_name: os-key
  ssh_key_file: /etc/salt/pki/os-ssh-key.pem
  ssh_connect_timeout: 120
  wait_for_passwd_timeout: 200
  wait_for_passwd_maxtries: 500

VM has been deployed with command: salt-cloud -p os-ubuntu1604-m1-medium oxygen-ubuntu2 -y -l debug --out=json --out-file=no_public_ips

Versions Report

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)

root@ubuntu1604:/etc/salt/cloud.profiles.d# salt-cloud --versions-report                                                    
Salt Version:
            Salt: 2018.3.0rc1

Dependency Versions:
 Apache Libcloud: 2.3.0
            cffi: 1.11.5
        cherrypy: Not Installed
        dateutil: Not Installed
       docker-py: Not Installed
           gitdb: Not Installed
       gitpython: Not Installed
           ioflo: Not Installed
          Jinja2: 2.10
         libgit2: Not Installed
         libnacl: Not Installed
        M2Crypto: Not Installed
            Mako: Not Installed
    msgpack-pure: Not Installed
  msgpack-python: 0.5.6
    mysql-python: Not Installed
       pycparser: 2.18
        pycrypto: 2.6.1
    pycryptodome: Not Installed
          pygit2: Not Installed
          Python: 2.7.12 (default, Dec  4 2017, 14:50:18)
    python-gnupg: Not Installed
          PyYAML: 3.12
           PyZMQ: 17.0.0
            RAET: Not Installed
           smmap: Not Installed
         timelib: Not Installed
         Tornado: 4.5.3
             ZMQ: 4.1.6

System Versions:
            dist: Ubuntu 16.04 xenial
          locale: UTF-8
         machine: x86_64
         release: 4.4.0-116-generic
          system: Linux
         version: Ubuntu 16.04 xenial
garethgreenaway commented 6 years ago

@gtmanfred fyi.

whytewolf commented 6 years ago

ZD-2354

whytewolf commented 6 years ago

Looking at this closer it does look like no public information in passed back. however when querying the profile later with salt-cloud -Q it does show the public ip and floating ip.

gtmanfred commented 6 years ago

My guess is that we just aren't getting the full information from the library, it should probably be fixed upstream, where we just ask it for a full query of the server before returning, instead of just returning the dict that is already available while attaching the floating ip.

gtmanfred commented 6 years ago

This should be fixed by #46912

stamak commented 6 years ago

@gtmanfred thx, your patch fixes this problem