rackspace / gophercloud

A Go SDK for OpenStack. IN FEATURE FREEZE. See Issue #592
http://gophercloud.io
Other
456 stars 185 forks source link

[rfr] Adding Vip port ID for loadbalancer #606

Closed dagnello closed 8 years ago

dagnello commented 8 years ago

Vip port ID is actually being returned by the lbaas api although documentation does not reference it. This PR exposes this important attribute when creating or listing loadbalancers.

Example create request:

REQ: curl -g -i --cacert "/home/sabhaya/ipc/cacert.cer" -X POST
https://10.243.189.6:9696/v2.0/lbaas/loadbalancers.json -H "User-Agent:
python-neutronclient" -H "Content-Type: application/json" -H "Accept:
application/json" -H "X-Auth-Token:
{SHA1}197d9453ec40aa1453b88ed2fd31dc22ee9bb6d3" -d '{"loadbalancer":
{"vip_subnet_id": "6cfcd316-6060-42e3-95a7-fe5dd7ba6f46", "description":
"vipul-test", "admin_state_up": true}}'
DEBUG: keystoneauth.session RESP: [201] Content-Type: application/json
Content-Length: 430 X-Openstack-Request-Id:
req-c38d6086-77d6-4f91-94d1-b6f233cf90c0 Date: Thu, 07 Jul 2016 00:13:58
GMT Connection: keep-alive
RESP BODY: {"loadbalancer": {"description": "vipul-test",
"admin_state_up": true, "tenant_id": "4c45f9757fce480c875e096fba3e254e",
"provisioning_status": "PENDING_CREATE", "listeners": [], "vip_address":
"10.0.2.31", "vip_port_id": "4e901618-0a8d-4d46-861c-28fad2df7a8c",
"provider": "octavia", "vip_subnet_id":
"6cfcd316-6060-42e3-95a7-fe5dd7ba6f46", "id":
"c28cf436-f201-4c4f-be63-ecbd092aae63", "operating_status": "OFFLINE",
"name": ""}}

Created a new loadbalancer:
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| admin_state_up      | True                                 |
| description         | vipul-test                           |
| id                  | c28cf436-f201-4c4f-be63-ecbd092aae63 |
| listeners           |                                      |
| name                |                                      |
| operating_status    | OFFLINE                              |
| provider            | octavia                              |
| provisioning_status | PENDING_CREATE                       |
| tenant_id           | 4c45f9757fce480c875e096fba3e254e     |
| vip_address         | 10.0.2.31                            |
| vip_port_id         | 4e901618-0a8d-4d46-861c-28fad2df7a8c |
| vip_subnet_id       | 6cfcd316-6060-42e3-95a7-fe5dd7ba6f46 |
+---------------------+———————————————————+
coveralls commented 8 years ago

Coverage Status

Coverage decreased (-0.007%) to 81.077% when pulling ab93e3fcd356d47c804f37529765cd9eb4201bd0 on dagnello:expose-port-id into 985a863d6dd5f928b485dbc8ef440813aafa39ad on rackspace:master.

dagnello commented 8 years ago

@jrperritt @jamiehannaford tested and ready for review

coveralls commented 8 years ago

Coverage Status

Coverage decreased (-0.007%) to 81.077% when pulling 880bfc059bee9154730a1be1f07fa08165a26a7f on dagnello:expose-port-id into 985a863d6dd5f928b485dbc8ef440813aafa39ad on rackspace:master.

sputnik13 commented 8 years ago

This seems pretty important since the load balancer resource is not usable as an external load balancer without attaching a floating IP to the port.

dkalleg commented 8 years ago

+1 I've tested this and it works as advertised. I'd really like to see this merge soon since I have another PR dependent on this one.

dagnello commented 8 years ago

closed by: https://github.com/gophercloud/gophercloud/pull/20