ngine-io / ansible-collection-cloudstack

CloudStack Ansible Collections
https://galaxy.ansible.com/ngine_io/cloudstack
GNU General Public License v3.0
21 stars 28 forks source link

Picking a particular IP address for a Network #30

Closed rvalle closed 4 years ago

rvalle commented 4 years ago

When using the UI it is possible to select a particular IP to acquire for a Virtual Network.

I have tried to replicate the same functionality with the cs_ip_address module, but it does not work. The documentation states that the IP address is required for the release functionality, and I guess that it is being ignored on acquisition.

For example, consider 123.123.123.123 a public IP address associated with our ACS account.

The following call:

    - name: Assign Public IP to DMZ
      cs_ip_address:
        ip_address: 123.123.123.123
        network: dmz

Will assign a random IP form the public pull, but not the requested one.

rvalle commented 4 years ago

mmmm, now it seems to be working. I wonder how I tested this before. @resmo is this functionality supposed to be implemented?

resmo commented 4 years ago

it should but I have just verified that we don't have an integration test for that particular example.

resmo commented 4 years ago

I verified in code and I confirm, this isn't implemented, it seems ipaddress field was added after this implementation.

https://cloudstack.apache.org/api/apidocs-4.9/apis/associateIpAddress.html https://cloudstack.apache.org/api/apidocs-4.14/apis/associateIpAddress.html

rvalle commented 4 years ago

I think it is at least partially implemented.

Because when it happens to give the right IP will not try to assign another IP on subsequent calls.

I can implement the test case and fix it, if u want.

rvalle commented 4 years ago

When my testing failed a new IP got acquired on each call. Now there is idempotency in the calls. Anyway, I am going to start by implementing the failing test. @resmo would be good that check that the other use cases are also tested, as I don't want to introduce regressions, and I am not that familiar with ACS yet.