Skip to content

Commit d52a173

Browse files
authored
Merge pull request #1446 from ioito/hotfix/qx-qcloud-lb-backend-sync
fix(qcloud): lb backend sync
2 parents 33407c7 + a60a325 commit d52a173

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

pkg/multicloud/qcloud/loadbalancer_backend.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package qcloud
1717
import (
1818
"context"
1919
"fmt"
20+
"strings"
2021

2122
"yunion.io/x/jsonutils"
2223

@@ -58,14 +59,15 @@ type Rule struct {
5859
Targets []SLBBackend `json:"Targets"`
5960
}
6061

61-
// ==========================================================
62-
63-
// backend InstanceId + protocol +Port + ip + rip全局唯一
62+
// backend InstanceId + protocol + port + ip + rip全局唯一
6463
func (self *SLBBackend) GetId() string {
65-
if len(self.Domain) == 0 {
66-
return fmt.Sprintf("%s/%s-%d", self.group.GetId(), self.InstanceId, self.Port)
64+
ret := []string{self.group.GetId(), self.InstanceId, fmt.Sprintf("%d", self.Port)}
65+
ret = append(ret, self.PrivateIPAddresses...)
66+
if len(self.Domain) > 0 {
67+
ret = append(ret, self.Domain)
68+
ret = append(ret, self.Url)
6769
}
68-
return fmt.Sprintf("%s/%s-%d:%s%s", self.group.GetId(), self.InstanceId, self.Port, self.Domain, self.Url)
70+
return strings.Join(ret, "/")
6971
}
7072

7173
func (self *SLBBackend) GetName() string {

0 commit comments

Comments
 (0)