Skip to content

Commit

Permalink
fix lost vendor
Browse files Browse the repository at this point in the history
Signed-off-by: bobz965 <zhangbingbing2_yewu@cmss.chinamobile.com>
  • Loading branch information
zbb88888 committed Mar 3, 2024
1 parent 40e0f32 commit ac0a150
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
26 changes: 13 additions & 13 deletions pkg/controller/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,19 @@ func (c *Controller) handleDeletePod(key string) error {
}
isVMPod, vmName := isVMPod(pod)
if isVMPod && c.config.EnableKeepVMIP {
ports, err := c.OVNNbClient.ListNormalLogicalSwitchPorts(true, map[string]string{"pod": podKey})
if err != nil {
klog.Errorf("failed to list lsps of pod '%s', %v", pod.Name, err)
return err
}
for _, port := range ports {
klog.Infof("clean migrate options for vm lsp %s", port.Name)
if err := c.OVNNbClient.CleanLogicalSwitchPortMigrateOptions(port.Name); err != nil {
err = fmt.Errorf("failed to clean migrate options for vm lsp %s, %v", port.Name, err)
klog.Error(err)
return err
}
}
vmToBeDel := c.isVMToDel(pod, vmName)
isDelete, err := appendCheckPodToDel(c, pod, vmName, util.VMInstance)
if pod.DeletionTimestamp != nil {
Expand Down Expand Up @@ -1142,19 +1155,6 @@ func (c *Controller) handleDeletePod(key string) error {
return err
}
}
} else if isVMPod {
ports, err := c.OVNNbClient.ListNormalLogicalSwitchPorts(true, map[string]string{"pod": podKey})
if err != nil {
klog.Errorf("failed to list lsps of pod '%s', %v", pod.Name, err)
return err
}
for _, port := range ports {
if err := c.OVNNbClient.CleanLogicalSwitchPortMigrateOptions(port.Name); err != nil {
err = fmt.Errorf("failed to clean migrate options for lsp %s, %v", port.Name, err)
klog.Error(err)
return err
}
}
}
for _, podNet := range podNets {
c.syncVirtualPortsQueue.Add(podNet.Subnet.Name)
Expand Down
5 changes: 2 additions & 3 deletions pkg/ovs/ovn-nb-logical_switch_port.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func buildLogicalSwitchPort(lspName, lsName, ip, mac, podName, namespace string,

// addresses is the first element of addresses
lsp.Addresses = []string{strings.TrimSpace(strings.Join(addresses, " "))}

lsp.ExternalIDs["vendor"] = util.CniTypeName
if portSecurity {
if len(vips) != 0 {
addresses = append(addresses, vipList...)
Expand Down Expand Up @@ -868,7 +868,7 @@ func (c *OVNNbClient) GetLogicalSwitchPortMigrateOptions(lspName string) (*ovnnb
return lsp, splits[0], splits[1], nil
}
}
return nil, "", "", nil
return lsp, "", "", nil
}

func (c *OVNNbClient) ResetLogicalSwitchPortMigrateOptions(lspName, srcNodeName, targetNodeName string, migratedFail bool) error {
Expand All @@ -895,7 +895,6 @@ func (c *OVNNbClient) ResetLogicalSwitchPortMigrateOptions(lspName, srcNodeName,
lsp.Options["requested-chassis"] = targetNodeName
}
delete(lsp.Options, "activation-strategy")
klog.Infof("reset migrator logical switch port %s options: %v", lspName, lsp.Options)
if err := c.UpdateLogicalSwitchPort(lsp, &lsp.Options); err != nil {
err = fmt.Errorf("failed to reset options for migrator logical switch port %s: %v", lspName, err)
klog.Error(err)
Expand Down

0 comments on commit ac0a150

Please sign in to comment.