@@ -30,8 +30,8 @@ func CreateServiceLB(stateDriver core.StateDriver, serviceLbCfg *intent.ConfigSe
30
30
var providersPresent bool
31
31
serviceIP := serviceLbCfg .IPAddress
32
32
log .Infof ("Recevied Create Service Load Balancer config {%v}" , serviceLbCfg )
33
-
34
- oldServiceInfo := mastercfg .ServiceLBDb [serviceLbCfg . ServiceName + " \\ " + serviceLbCfg . Tenant ]
33
+ svcID := getServiceID ( serviceLbCfg . ServiceName , serviceLbCfg . Tenant )
34
+ oldServiceInfo := mastercfg .ServiceLBDb [svcID ]
35
35
if oldServiceInfo != nil {
36
36
//ServiceInfo Exists
37
37
if reflect .DeepEqual (oldServiceInfo .Ports , serviceLbCfg .Ports ) &&
@@ -47,7 +47,7 @@ func CreateServiceLB(stateDriver core.StateDriver, serviceLbCfg *intent.ConfigSe
47
47
serviceLbState .Tenant = serviceLbCfg .Tenant
48
48
serviceLbState .Network = serviceLbCfg .Network
49
49
serviceLbState .StateDriver = stateDriver
50
- serviceLbState .ID = serviceLbCfg .ServiceName + " \\ " + serviceLbCfg .Tenant
50
+ serviceLbState .ID = getServiceID ( serviceLbCfg .ServiceName , serviceLbCfg .Tenant )
51
51
serviceLbState .Ports = append (serviceLbState .Ports , serviceLbCfg .Ports ... )
52
52
serviceLbState .Selectors = make (map [string ]string )
53
53
serviceLbState .Providers = make (map [string ]* mastercfg.Provider )
@@ -132,7 +132,7 @@ func DeleteServiceLB(stateDriver core.StateDriver, serviceName string, tenantNam
132
132
log .Infof ("Receiver Delete Service Load Balancer %s on %s" , serviceName , tenantName )
133
133
serviceLBState := & mastercfg.CfgServiceLBState {}
134
134
serviceLBState .StateDriver = stateDriver
135
- serviceLBState .ID = serviceName + " \\ " + tenantName
135
+ serviceLBState .ID = getServiceID ( serviceName , tenantName )
136
136
137
137
err := serviceLBState .Read (serviceLBState .ID )
138
138
if err != nil {
@@ -182,7 +182,7 @@ func DeleteServiceLB(stateDriver core.StateDriver, serviceName string, tenantNam
182
182
}
183
183
184
184
func getServiceID (servicename string , tenantname string ) string {
185
- return servicename + "\\ " + tenantname
185
+ return servicename + ": " + tenantname
186
186
}
187
187
188
188
//RestoreServiceProviderLBDb restores provider and servicelb db
@@ -202,7 +202,7 @@ func RestoreServiceProviderLBDb() {
202
202
for _ , svcLBCfg := range svcLBCfgs {
203
203
svcLB := svcLBCfg .(* mastercfg.CfgServiceLBState )
204
204
//mastercfg.ServiceLBDb = make(map[string]*mastercfg.ServiceLBInfo)
205
- serviceID := svcLB .ServiceName + " \\ " + svcLB .Tenant
205
+ serviceID := getServiceID ( svcLB .ServiceName , svcLB .Tenant )
206
206
mastercfg .ServiceLBDb [serviceID ] = & mastercfg.ServiceLBInfo {
207
207
IPAddress : svcLB .IPAddress ,
208
208
Tenant : svcLB .Tenant ,
0 commit comments