-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
Current, it's an error to attempt to create a port forwarding that already exists:
$ openstack esi port forwarding create 192.168.79.222 128.31.20.133 -p 22
+--------------------------------------+---------------+---------------+----------+----------------+---------------+
| ID | Internal Port | External Port | Protocol | Internal IP | External IP |
+--------------------------------------+---------------+---------------+----------+----------------+---------------+
| 42dad77d-64bc-4f1d-8cb8-d711d558f975 | 22 | 22 | tcp | 192.168.79.222 | 128.31.20.133 |
+--------------------------------------+---------------+---------------+----------+----------------+---------------+
$ openstack esi port forwarding create 192.168.79.222 128.31.20.133 -p 22
BadRequestException: 400: Client Error for url: https://esi.massopen.cloud:13696/v2.0/floatingips/90fa9d72-90f7-44f1-9374-ade83cb9868b/port_forwardings, Bad port_forwarding request: A duplicate port forwarding entry with same attributes already exists, conflicting values are {'floatingip_id': '90fa9d72-90f7-44f1-9374-ade83cb9868b', 'external_port': 22, 'protocol': 'tcp'}.
[lars@mushu python-esiclient] (master)$
Should calling port forwarding create with a port that already exists succeed instead without making any changes? This might make it easier when you want to add additional port forwardings; e.g., if after running the first command, above, I realized I also wanted to add ports 80 and 443, I could just run:
$ openstack esi port forwarding create 192.168.79.222 128.31.20.133 -p 22 -p 80 -p 443
And the output would be something like:
+--------------------------------------+---------------+---------------+----------+----------------+---------------+
| ID | Internal Port | External Port | Protocol | Internal IP | External IP |
+--------------------------------------+---------------+---------------+----------+----------------+---------------+
| 42dad77d-64bc-4f1d-8cb8-d711d558f975 | 22 | 22 | tcp | 192.168.79.222 | 128.31.20.133 |
| df0afa25-777a-4e72-bbc9-e0bc24f49a01 | 80 | 80 | tcp | 192.168.79.222 | 128.31.20.133 |
| ff10fdf7-d73d-4e19-8672-25e1c4758e33 | 443 | 443 | tcp | 192.168.79.222 | 128.31.20.133 |
+--------------------------------------+---------------+---------------+----------+----------------+---------------+
Metadata
Metadata
Assignees
Labels
No labels