Merge pull request #7211 from anguslees/lbmethod-fix

OpenStack: lb_method required when creating LbaaS pool
pull/6/head
Brian Grant 2015-04-23 15:56:42 -07:00
commit 0b153eb522
1 changed files with 6 additions and 0 deletions

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