OpenStack: lb_method required when creating LbaaS pool

This change takes lb-method from [LoadBalancer] section of cloud
provider config file, defaulting to ROUND_ROBIN.

Fixes #7199
This commit is contained in:
Angus Lees 2015-04-23 15:19:14 +10:00
parent 162b0db743
commit 8818966d1f

View File

@ -67,6 +67,7 @@ func (d *MyDuration) UnmarshalText(text []byte) error {
type LoadBalancerOpts struct {
SubnetId string `gcfg:"subnet-id"` // required
LBMethod string `gfcg:"lb-method"`
CreateMonitor bool `gcfg:"create-monitor"`
MonitorDelay MyDuration `gcfg:"monitor-delay"`
MonitorTimeout MyDuration `gcfg:"monitor-timeout"`
@ -485,10 +486,15 @@ func (lb *LoadBalancer) CreateTCPLoadBalancer(name, region string, externalIP ne
return "", fmt.Errorf("unsupported load balancer affinity: %v", affinity)
}
lbmethod := lb.opts.LBMethod
if lbmethod == "" {
lbmethod = pools.LBMethodRoundRobin
}
pool, err := pools.Create(lb.network, pools.CreateOpts{
Name: name,
Protocol: pools.ProtocolTCP,
SubnetID: lb.opts.SubnetId,
LBMethod: lbmethod,
}).Extract()
if err != nil {
return "", err