Skip to content

Commit cc2f866

Browse files
committed
fix lost vendor
Signed-off-by: bobz965 <zhangbingbing2_yewu@cmss.chinamobile.com>
1 parent eafd1bd commit cc2f866

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

pkg/controller/pod.go

+13-13
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,19 @@ func (c *Controller) handleDeletePod(key string) error {
10361036
}
10371037
isVMPod, vmName := isVMPod(pod)
10381038
if isVMPod && c.config.EnableKeepVMIP {
1039+
ports, err := c.OVNNbClient.ListNormalLogicalSwitchPorts(true, map[string]string{"pod": podKey})
1040+
if err != nil {
1041+
klog.Errorf("failed to list lsps of pod '%s', %v", pod.Name, err)
1042+
return err
1043+
}
1044+
for _, port := range ports {
1045+
klog.Infof("clean migrate options for vm lsp %s", port.Name)
1046+
if err := c.OVNNbClient.CleanLogicalSwitchPortMigrateOptions(port.Name); err != nil {
1047+
err = fmt.Errorf("failed to clean migrate options for vm lsp %s, %v", port.Name, err)
1048+
klog.Error(err)
1049+
return err
1050+
}
1051+
}
10391052
vmToBeDel := c.isVMToDel(pod, vmName)
10401053
isDelete, err := appendCheckPodToDel(c, pod, vmName, util.VMInstance)
10411054
if pod.DeletionTimestamp != nil {
@@ -1142,19 +1155,6 @@ func (c *Controller) handleDeletePod(key string) error {
11421155
return err
11431156
}
11441157
}
1145-
} else if isVMPod {
1146-
ports, err := c.OVNNbClient.ListNormalLogicalSwitchPorts(true, map[string]string{"pod": podKey})
1147-
if err != nil {
1148-
klog.Errorf("failed to list lsps of pod '%s', %v", pod.Name, err)
1149-
return err
1150-
}
1151-
for _, port := range ports {
1152-
if err := c.OVNNbClient.CleanLogicalSwitchPortMigrateOptions(port.Name); err != nil {
1153-
err = fmt.Errorf("failed to clean migrate options for lsp %s, %v", port.Name, err)
1154-
klog.Error(err)
1155-
return err
1156-
}
1157-
}
11581158
}
11591159
for _, podNet := range podNets {
11601160
c.syncVirtualPortsQueue.Add(podNet.Subnet.Name)

pkg/ovs/ovn-nb-logical_switch_port.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func buildLogicalSwitchPort(lspName, ip, mac, podName, namespace string, portSec
3333

3434
// addresses is the first element of addresses
3535
lsp.Addresses = []string{strings.TrimSpace(strings.Join(addresses, " "))}
36-
36+
lsp.ExternalIDs["vendor"] = util.CniTypeName
3737
if portSecurity {
3838
if len(vips) != 0 {
3939
addresses = append(addresses, vipList...)
@@ -864,7 +864,7 @@ func (c *OVNNbClient) GetLogicalSwitchPortMigrateOptions(lspName string) (*ovnnb
864864
return lsp, splits[0], splits[1], nil
865865
}
866866
}
867-
return nil, "", "", nil
867+
return lsp, "", "", nil
868868
}
869869

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

0 commit comments

Comments
 (0)