Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit 6fbd243

Browse files
committed
Merge pull request #560 from jtopjian/openstack-lbaas-pool-provider
[rfr] Add Provider Option for Pool Creation
2 parents ff42b6a + 300b597 commit 6fbd243

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

acceptance/openstack/networking/v2/extensions/lbaas/common.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ func CreatePool(t *testing.T, subnetID string) string {
4444
Protocol: "HTTP",
4545
Name: "tmp_pool",
4646
SubnetID: subnetID,
47+
Provider: "haproxy",
4748
}).Extract()
4849

4950
th.AssertNoErr(t, err)

acceptance/openstack/networking/v2/extensions/lbaas/pool_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func listPools(t *testing.T) {
5555
}
5656

5757
for _, p := range poolList {
58-
t.Logf("Listing pool: ID [%s] Name [%s] Status [%s] LB algorithm [%s]", p.ID, p.Name, p.Status, p.LBMethod)
58+
t.Logf("Listing pool: ID [%s] Name [%s] Status [%s] LB algorithm [%s] Provider [%s]", p.ID, p.Name, p.Status, p.LBMethod, p.Provider)
5959
}
6060

6161
return true, nil

openstack/networking/v2/extensions/lbaas/pools/requests.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ type CreateOpts struct {
7474
// current specification supports LBMethodRoundRobin and
7575
// LBMethodLeastConnections as valid values for this attribute.
7676
LBMethod string
77+
78+
// The provider of the pool
79+
Provider string
7780
}
7881

7982
// Create accepts a CreateOpts struct and uses the values to create a new
@@ -85,6 +88,7 @@ func Create(c *gophercloud.ServiceClient, opts CreateOpts) CreateResult {
8588
Protocol string `json:"protocol"`
8689
SubnetID string `json:"subnet_id"`
8790
LBMethod string `json:"lb_method"`
91+
Provider string `json:"provider,omitempty"`
8892
}
8993
type request struct {
9094
Pool pool `json:"pool"`
@@ -96,6 +100,7 @@ func Create(c *gophercloud.ServiceClient, opts CreateOpts) CreateResult {
96100
Protocol: opts.Protocol,
97101
SubnetID: opts.SubnetID,
98102
LBMethod: opts.LBMethod,
103+
Provider: opts.Provider,
99104
}}
100105

101106
var res CreateResult

openstack/networking/v2/extensions/lbaas/pools/requests_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ func TestCreate(t *testing.T) {
119119
"protocol": "HTTP",
120120
"name": "Example pool",
121121
"subnet_id": "1981f108-3c48-48d2-b908-30f7d28532c9",
122-
"tenant_id": "2ffc6e22aae24e4795f87155d24c896f"
122+
"tenant_id": "2ffc6e22aae24e4795f87155d24c896f",
123+
"provider": "haproxy"
123124
}
124125
}
125126
`)
@@ -143,7 +144,8 @@ func TestCreate(t *testing.T) {
143144
"admin_state_up": true,
144145
"subnet_id": "1981f108-3c48-48d2-b908-30f7d28532c9",
145146
"tenant_id": "2ffc6e22aae24e4795f87155d24c896f",
146-
"health_monitors_status": []
147+
"health_monitors_status": [],
148+
"provider": "haproxy"
147149
}
148150
}
149151
`)
@@ -155,6 +157,7 @@ func TestCreate(t *testing.T) {
155157
Name: "Example pool",
156158
SubnetID: "1981f108-3c48-48d2-b908-30f7d28532c9",
157159
TenantID: "2ffc6e22aae24e4795f87155d24c896f",
160+
Provider: "haproxy",
158161
}
159162
p, err := Create(fake.ServiceClient(), options).Extract()
160163
th.AssertNoErr(t, err)
@@ -169,6 +172,7 @@ func TestCreate(t *testing.T) {
169172
th.AssertEquals(t, "Example pool", p.Name)
170173
th.AssertEquals(t, "1981f108-3c48-48d2-b908-30f7d28532c9", p.SubnetID)
171174
th.AssertEquals(t, "2ffc6e22aae24e4795f87155d24c896f", p.TenantID)
175+
th.AssertEquals(t, "haproxy", p.Provider)
172176
}
173177

174178
func TestGet(t *testing.T) {

0 commit comments

Comments
 (0)