From 65641d31daa25e85d46f40d6a5e7f8a36afd4cc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=A5=96=E5=BB=BA?= Date: Fri, 21 Jun 2024 09:45:12 +0800 Subject: [PATCH] fix vm not running after changing the subnet (#4199) Signed-off-by: zhangzujian --- pkg/ovs/ovn-nb-logical_switch_port.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/ovs/ovn-nb-logical_switch_port.go b/pkg/ovs/ovn-nb-logical_switch_port.go index 506e2555db2..b02b7f113f3 100644 --- a/pkg/ovs/ovn-nb-logical_switch_port.go +++ b/pkg/ovs/ovn-nb-logical_switch_port.go @@ -97,14 +97,14 @@ func (c *OVNNbClient) CreateLogicalSwitchPort(lsName, lspName, ip, mac, podName, var ops []ovsdb.Operation lsp := buildLogicalSwitchPort(lspName, lsName, ip, mac, podName, namespace, portSecurity, securityGroups, vips, enableDHCP, dhcpOptions, vpc) if existingLsp != nil { - if lsp.ExternalIDs[logicalSwitchKey] == lsName { + if existingLsp.ExternalIDs[logicalSwitchKey] == lsName { if err := c.UpdateLogicalSwitchPort(lsp, &lsp.Addresses, &lsp.Dhcpv4Options, &lsp.Dhcpv6Options, &lsp.PortSecurity, &lsp.ExternalIDs); err != nil { klog.Error(err) return fmt.Errorf("failed to update logical switch port %s: %v", lspName, err) } return nil } - if ops, err = c.LogicalSwitchUpdatePortOp(lsp.ExternalIDs[logicalSwitchKey], existingLsp.UUID, ovsdb.MutateOperationDelete); err != nil { + if ops, err = c.LogicalSwitchUpdatePortOp(existingLsp.ExternalIDs[logicalSwitchKey], existingLsp.UUID, ovsdb.MutateOperationDelete); err != nil { klog.Error(err) return err }