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

Commit

Permalink
Merge pull request #560 from jtopjian/openstack-lbaas-pool-provider
Browse files Browse the repository at this point in the history
[rfr] Add Provider Option for Pool Creation
  • Loading branch information
jrperritt committed May 25, 2016
2 parents ff42b6a + 300b597 commit 6fbd243
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func CreatePool(t *testing.T, subnetID string) string {
Protocol: "HTTP",
Name: "tmp_pool",
SubnetID: subnetID,
Provider: "haproxy",
}).Extract()

th.AssertNoErr(t, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func listPools(t *testing.T) {
}

for _, p := range poolList {
t.Logf("Listing pool: ID [%s] Name [%s] Status [%s] LB algorithm [%s]", p.ID, p.Name, p.Status, p.LBMethod)
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)
}

return true, nil
Expand Down
5 changes: 5 additions & 0 deletions openstack/networking/v2/extensions/lbaas/pools/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ type CreateOpts struct {
// current specification supports LBMethodRoundRobin and
// LBMethodLeastConnections as valid values for this attribute.
LBMethod string

// The provider of the pool
Provider string
}

// Create accepts a CreateOpts struct and uses the values to create a new
Expand All @@ -85,6 +88,7 @@ func Create(c *gophercloud.ServiceClient, opts CreateOpts) CreateResult {
Protocol string `json:"protocol"`
SubnetID string `json:"subnet_id"`
LBMethod string `json:"lb_method"`
Provider string `json:"provider,omitempty"`
}
type request struct {
Pool pool `json:"pool"`
Expand All @@ -96,6 +100,7 @@ func Create(c *gophercloud.ServiceClient, opts CreateOpts) CreateResult {
Protocol: opts.Protocol,
SubnetID: opts.SubnetID,
LBMethod: opts.LBMethod,
Provider: opts.Provider,
}}

var res CreateResult
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ func TestCreate(t *testing.T) {
"protocol": "HTTP",
"name": "Example pool",
"subnet_id": "1981f108-3c48-48d2-b908-30f7d28532c9",
"tenant_id": "2ffc6e22aae24e4795f87155d24c896f"
"tenant_id": "2ffc6e22aae24e4795f87155d24c896f",
"provider": "haproxy"
}
}
`)
Expand All @@ -143,7 +144,8 @@ func TestCreate(t *testing.T) {
"admin_state_up": true,
"subnet_id": "1981f108-3c48-48d2-b908-30f7d28532c9",
"tenant_id": "2ffc6e22aae24e4795f87155d24c896f",
"health_monitors_status": []
"health_monitors_status": [],
"provider": "haproxy"
}
}
`)
Expand All @@ -155,6 +157,7 @@ func TestCreate(t *testing.T) {
Name: "Example pool",
SubnetID: "1981f108-3c48-48d2-b908-30f7d28532c9",
TenantID: "2ffc6e22aae24e4795f87155d24c896f",
Provider: "haproxy",
}
p, err := Create(fake.ServiceClient(), options).Extract()
th.AssertNoErr(t, err)
Expand All @@ -169,6 +172,7 @@ func TestCreate(t *testing.T) {
th.AssertEquals(t, "Example pool", p.Name)
th.AssertEquals(t, "1981f108-3c48-48d2-b908-30f7d28532c9", p.SubnetID)
th.AssertEquals(t, "2ffc6e22aae24e4795f87155d24c896f", p.TenantID)
th.AssertEquals(t, "haproxy", p.Provider)
}

func TestGet(t *testing.T) {
Expand Down

0 comments on commit 6fbd243

Please sign in to comment.