Skip to content

Commit

Permalink
fix disable ovn ic
Browse files Browse the repository at this point in the history
Signed-off-by: Changlu Yi <[email protected]>
  • Loading branch information
changluyi committed Jan 24, 2024
1 parent 4c3b0de commit e469ddb
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions pkg/ovn_ic_controller/ovn_ic_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,21 @@ const (
icConfigChange
)

func (c *Controller) disableOVNIC(azName string) {
func (c *Controller) disableOVNIC(azName string) error {
if err := c.removeInterConnection(azName); err != nil {
klog.Errorf("failed to remove ovn-ic, %v", err)
return
return err
}
if err := c.delLearnedRoute(); err != nil {
klog.Errorf("failed to remove learned static routes, %v", err)
return
return err
}

if err := c.RemoveOldChassisInSbDB(azName); err != nil {
klog.Errorf("failed to remove remote chassis: %v", err)
return err
}
return nil
}

func (c *Controller) setAutoRoute(autoRoute bool) {
Expand Down Expand Up @@ -174,7 +176,11 @@ func (c *Controller) resyncInterConnection() {
c.ovnLegacyClient.OvnICNbAddress = genHostAddress(icDBHost, icNBPort)
}

c.disableOVNIC(azName)
err := c.disableOVNIC(azName)
if err != nil {
klog.Errorf("Disable az %s OVN IC failed ", azName)
return
}
icEnabled = "false"
lastIcCm = nil

Expand Down Expand Up @@ -211,7 +217,11 @@ func (c *Controller) resyncInterConnection() {
case icConfigChange:
c.ovnLegacyClient.OvnICSbAddress = genHostAddress(lastIcCm["ic-db-host"], cm.Data["ic-sb-port"])
c.ovnLegacyClient.OvnICNbAddress = genHostAddress(lastIcCm["ic-db-host"], cm.Data["ic-nb-port"])
c.disableOVNIC(lastIcCm["az-name"])
err := c.disableOVNIC(lastIcCm["az-name"])
if err != nil {
klog.Errorf("Disable az %s OVN IC failed ", lastIcCm["az-name"])
return
}
klog.Info("start to reestablish ovn-ic")
if err := c.establishInterConnection(cm.Data); err != nil {
klog.Errorf("failed to reestablish ovn-ic, %v", err)
Expand Down

0 comments on commit e469ddb

Please sign in to comment.