hashicorp / packer-plugin-openstack

Packer plugin for OpenStack Builder
https://www.packer.io/docs/builders/openstack
Mozilla Public License 2.0
19 stars 20 forks source link

[OpenStack] floating_ip is actually floating_ip_id #17

Open ghost opened 3 years ago

ghost commented 3 years ago

This issue was originally opened by @gkoudjou as hashicorp/packer#8300. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Overview of the Issue

According to the documentation, with the Openstack builders, we can defined a specific floating IP address.

https://www.packer.io/docs/builders/openstack.html#floating_ip

While testing, it appears that packer expects an ID.

Reproduction Steps

Here is some json file :

    "builders": [
        {
            "type": "openstack",
            "username": "{{user `username`}}",
            "password": "{{user `password`}}",
            "identity_endpoint": "XXXXXXXXX",
            "region": "regionOne",
            "image_name": "{{user `image_name`}}",
            "instance_name": "packer-test",
            "ssh_timeout": "5m",
            "floating_ip_network": "external",
            "floating_ip": "10.121.240.228",
            ]
        }
    ],

And here is the result :

openstack output will be in this color.

==> openstack: Loading flavor: Tiny_Linux
    openstack: Verified flavor. ID: 1
==> openstack: Not using temporary keypair
    openstack: Found Image ID: d91327b6-ef25-4632-b866-8773927c6a83
==> openstack: Launching server...
==> openstack: Launching server...
    openstack: Server ID: 805257ad-79fa-4e38-904c-ef1951e158bd
==> openstack: Waiting for server to become ready...
==> openstack: Error using provided floating IP '10.121.240.228': Resource not found
==> openstack: Terminating the source server: 805257ad-79fa-4e38-904c-ef1951e158bd ...
Build 'openstack' errored: Error using provided floating IP '10.121.240.228': Resource not found

==> Some builds didn't complete successfully and had errors:
--> openstack: Error using provided floating IP '10.121.240.228': Resource not found

But if a use the ID used by requesting openstack, it's working.

openstack output will be in this color.

==> openstack: Loading flavor: Tiny_Linux
    openstack: Verified flavor. ID: 1
==> openstack: Not using temporary keypair
    openstack: Found Image ID: d91327b6-ef25-4632-b866-8773927c6a83
==> openstack: Launching server...
==> openstack: Launching server...
    openstack: Server ID: 324e2b3c-5f83-4829-ad6f-ce706f87f79a
==> openstack: Waiting for server to become ready...
    openstack: Selected floating IP: '1d869a1f-9378-4069-a087-7050d337d8a3' (10.121.240.228)
==> openstack: Associating floating IP '1d869a1f-9378-4069-a087-7050d337d8a3' (10.121.240.228) with instance port...
    openstack: Added floating IP '1d869a1f-9378-4069-a087-7050d337d8a3' (10.121.240.228) to instance!

Packer version

1.5.0 (yesterday nightly build)

Simplified Packer Buildfile

Please see above

Operating system and Environment details

OS: RHEL 7.3 Architecture: x86_64

Log Fragments and crash.log files

openstack: Found Image ID: d91327b6-ef25-4632-b866-8773927c6a83 ==> openstack: Launching server... ==> openstack: Launching server... openstack: Server ID: dc67299d-0523-44cf-8ac9-7495d6cd6b61 2019/10/31 14:45:31 packer_linux_amd64: 2019/10/31 14:45:31 server id: dc67299d-0523-44cf-8ac9-7495d6cd6b61 2019/10/31 14:45:31 packer_linux_amd64: 2019/10/31 14:45:31 Waiting for state to become: [ACTIVE] ==> openstack: Waiting for server to become ready... 2019/10/31 14:45:32 packer_linux_amd64: 2019/10/31 14:45:32 Waiting for state to become: [ACTIVE] currently BUILD (0%) 2019/10/31 14:45:34 packer_linux_amd64: 2019/10/31 14:45:34 Waiting for state to become: [ACTIVE] currently BUILD (0%) 2019/10/31 14:45:38 packer_linux_amd64: 2019/10/31 14:45:38 Waiting for state to become: [ACTIVE] currently BUILD (0%) 2019/10/31 14:45:41 packer_linux_amd64: 2019/10/31 14:45:41 Waiting for state to become: [ACTIVE] currently BUILD (0%) 2019/10/31 14:45:44 packer_linux_amd64: 2019/10/31 14:45:44 [INFO] Not using winrm communicator, skipping get password... ==> openstack: Error using provided floating IP '10.121.240.228': Resource not found ==> openstack: Terminating the source server: dc67299d-0523-44cf-8ac9-7495d6cd6b61 ... 2019/10/31 14:45:45 packer_linux_amd64: 2019/10/31 14:45:45 Waiting for state to become: [DELETED] 2019/10/31 14:45:46 packer_linux_amd64: 2019/10/31 14:45:46 Waiting for state to become: [DELETED] currently ACTIVE (0%) Build 'openstack' errored: Error using provided floating IP '10.121.240.228': Resource not found

==> Some builds didn't complete successfully and had errors: --> openstack: Error using provided floating IP '10.121.240.228': Resource not found

==> Builds finished but no artifacts were created. 2019/10/31 14:45:48 [INFO] (telemetry) ending openstack 2019/10/31 14:45:48 machine readable: error-count []string{"1"} ==> Some builds didn't complete successfully and had errors: 2019/10/31 14:45:48 machine readable: openstack,error []string{"Error using provided floating IP '10.121.240.228': Resource not found"} ==> Builds finished but no artifacts were created. 2019/10/31 14:45:48 [INFO] (telemetry) Finalizing. 2019/10/31 14:45:48 packer_linux_amd64: 2019/10/31 14:45:48 [INFO] 404 on ServerStateRefresh, returning DELETED 2019/10/31 14:45:48 [WARN] (telemetry) Error finalizing report. This is safe to ignore. Post https://checkpoint-api.hashicorp.com/v1/telemetry/packer: proxyconnect tcp: tls: first record does not look like a TLS handshake 2019/10/31 14:45:48 waiting for all plugin processes to complete... 2019/10/31 14:45:48 /home/vagrant/btp_base_image/packer_linux_amd64: plugin process exited 2019/10/31 14:45:48 /home/vagrant/btp_base_image/packer_linux_amd64: plugin process exited

raffienficiaud commented 1 year ago

I just hit this. If I replace the IP by the ID returned from openstack floating ip list, everything works like a charm.