Merge pull request #560 from jtopjian/openstack-lbaas-pool-provider
[rfr] Add Provider Option for Pool Creation
diff --git a/acceptance/openstack/networking/v2/extensions/lbaas/common.go b/acceptance/openstack/networking/v2/extensions/lbaas/common.go
index 27dfe5f..02c71bd 100644
--- a/acceptance/openstack/networking/v2/extensions/lbaas/common.go
+++ b/acceptance/openstack/networking/v2/extensions/lbaas/common.go
@@ -44,6 +44,7 @@
Protocol: "HTTP",
Name: "tmp_pool",
SubnetID: subnetID,
+ Provider: "haproxy",
}).Extract()
th.AssertNoErr(t, err)
diff --git a/acceptance/openstack/networking/v2/extensions/lbaas/pool_test.go b/acceptance/openstack/networking/v2/extensions/lbaas/pool_test.go
index 8194064..8efb7d0 100644
--- a/acceptance/openstack/networking/v2/extensions/lbaas/pool_test.go
+++ b/acceptance/openstack/networking/v2/extensions/lbaas/pool_test.go
@@ -55,7 +55,7 @@
}
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
diff --git a/openstack/networking/v2/extensions/lbaas/pools/requests.go b/openstack/networking/v2/extensions/lbaas/pools/requests.go
index 2bb0acc..e0002ac 100644
--- a/openstack/networking/v2/extensions/lbaas/pools/requests.go
+++ b/openstack/networking/v2/extensions/lbaas/pools/requests.go
@@ -74,6 +74,9 @@
// 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
@@ -85,6 +88,7 @@
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"`
@@ -96,6 +100,7 @@
Protocol: opts.Protocol,
SubnetID: opts.SubnetID,
LBMethod: opts.LBMethod,
+ Provider: opts.Provider,
}}
var res CreateResult
diff --git a/openstack/networking/v2/extensions/lbaas/pools/requests_test.go b/openstack/networking/v2/extensions/lbaas/pools/requests_test.go
index 3b5c7c7..9696cb8 100644
--- a/openstack/networking/v2/extensions/lbaas/pools/requests_test.go
+++ b/openstack/networking/v2/extensions/lbaas/pools/requests_test.go
@@ -119,7 +119,8 @@
"protocol": "HTTP",
"name": "Example pool",
"subnet_id": "1981f108-3c48-48d2-b908-30f7d28532c9",
- "tenant_id": "2ffc6e22aae24e4795f87155d24c896f"
+ "tenant_id": "2ffc6e22aae24e4795f87155d24c896f",
+ "provider": "haproxy"
}
}
`)
@@ -143,7 +144,8 @@
"admin_state_up": true,
"subnet_id": "1981f108-3c48-48d2-b908-30f7d28532c9",
"tenant_id": "2ffc6e22aae24e4795f87155d24c896f",
- "health_monitors_status": []
+ "health_monitors_status": [],
+ "provider": "haproxy"
}
}
`)
@@ -155,6 +157,7 @@
Name: "Example pool",
SubnetID: "1981f108-3c48-48d2-b908-30f7d28532c9",
TenantID: "2ffc6e22aae24e4795f87155d24c896f",
+ Provider: "haproxy",
}
p, err := Create(fake.ServiceClient(), options).Extract()
th.AssertNoErr(t, err)
@@ -169,6 +172,7 @@
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) {