From a3d5aeeea4f45f41f2c7c4413d35954984bc360b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 18 Nov 2025 18:17:52 +0000 Subject: [PATCH 1/4] Initial plan From 733d1c1b922899d873b82d7d00e36869fa1aa0e9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 18 Nov 2025 18:28:46 +0000 Subject: [PATCH 2/4] Improve logging messages with more descriptive context across network and CNS components Co-authored-by: prmathur-microsoft <20328314+prmathur-microsoft@users.noreply.github.com> --- cns/restserver/internalapi.go | 38 ++++++++-------- network/endpoint_linux.go | 22 +++++----- network/manager.go | 44 +++++++++---------- .../transparent_vlan_endpointclient_linux.go | 6 +-- 4 files changed, 55 insertions(+), 55 deletions(-) diff --git a/cns/restserver/internalapi.go b/cns/restserver/internalapi.go index 9f855ec64f..13f5032950 100644 --- a/cns/restserver/internalapi.go +++ b/cns/restserver/internalapi.go @@ -108,7 +108,7 @@ func (service *HTTPRestService) SyncNodeStatus(dncEP, infraVnet, nodeID string, ncVersionListResp, err := service.nma.GetNCVersionList(ctx) if err != nil { skipNCVersionCheck = true - logger.Errorf("failed to get nc version list from nmagent") + logger.Errorf("Failed to retrieve network container version list from NMAgent, skipping version validation: %v", err) } if !skipNCVersionCheck { @@ -123,11 +123,11 @@ func (service *HTTPRestService) SyncNodeStatus(dncEP, infraVnet, nodeID string, body, err = json.Marshal(ncsToBeAdded[ncid]) if err != nil { - logger.Errorf("[Azure-CNS] Failed to marshal nc with nc id %s and content %v", ncid, ncsToBeAdded[ncid]) + logger.Errorf("[Azure-CNS] Failed to marshal network container request for NC ID %s during sync: %v", ncid, err) } req, err = http.NewRequestWithContext(ctx, http.MethodPost, "", bytes.NewBuffer(body)) if err != nil { - logger.Errorf("[Azure CNS] Error received while creating http POST request for nc %v", ncsToBeAdded[ncid]) + logger.Errorf("[Azure CNS] Failed to create HTTP POST request for network container %s during sync: %v", ncid, err) } req.Header.Set(common.ContentType, common.JsonContent) @@ -162,7 +162,7 @@ func (service *HTTPRestService) SyncNodeStatus(dncEP, infraVnet, nodeID string, req.Header.Set(common.JsonContent, common.JsonContent) service.deleteNetworkContainer(httptest.NewRecorder(), req) } else { - logger.Errorf("[Azure-CNS] Failed to delete NC request to sync state: %s", err.Error()) + logger.Errorf("[Azure-CNS] Failed to marshal delete NC request body during state sync for NC ID %s: %s", ncID, err.Error()) } } return @@ -182,7 +182,7 @@ func (service *HTTPRestService) SyncHostNCVersion(ctx context.Context, channelMo go service.MustGenerateCNIConflistOnce() } if err != nil { - logger.Errorf("sync host error %v", err) + logger.Errorf("Failed to synchronize host network container versions with NMAgent: %v", err) } syncHostNCVersionCount.WithLabelValues(strconv.FormatBool(err == nil)).Inc() syncHostNCVersionLatency.WithLabelValues(strconv.FormatBool(err == nil)).Observe(time.Since(start).Seconds()) @@ -201,19 +201,19 @@ func (service *HTTPRestService) syncHostNCVersion(ctx context.Context, channelMo // Will open a separate PR to convert all the NC version related variable to int. Change from string to int is a pain. localNCVersion, err := strconv.Atoi(service.state.ContainerStatus[idx].HostVersion) if err != nil { - logger.Errorf("Received err when change containerstatus.HostVersion %s to int, err msg %v", service.state.ContainerStatus[idx].HostVersion, err) + logger.Errorf("Failed to parse NC host version string '%s' to integer for container %s: %v", service.state.ContainerStatus[idx].HostVersion, service.state.ContainerStatus[idx].ID, err) continue } dncNCVersion, err := strconv.Atoi(service.state.ContainerStatus[idx].CreateNetworkContainerRequest.Version) if err != nil { - logger.Errorf("Received err when change nc version %s in containerstatus to int, err msg %v", service.state.ContainerStatus[idx].CreateNetworkContainerRequest.Version, err) + logger.Errorf("Failed to parse NC version string '%s' to integer from DNC for container %s: %v", service.state.ContainerStatus[idx].CreateNetworkContainerRequest.Version, service.state.ContainerStatus[idx].ID, err) continue } // host NC version is the NC version from NMAgent, if it's smaller than NC version from DNC, then append it to indicate it needs update. if localNCVersion < dncNCVersion { outdatedNCs[service.state.ContainerStatus[idx].ID] = struct{}{} } else if localNCVersion > dncNCVersion { - logger.Errorf("NC version from NMAgent is larger than DNC, NC version from NMAgent is %d, NC version from DNC is %d", localNCVersion, dncNCVersion) + logger.Errorf("Network container version inconsistency detected: NMAgent version (%d) is greater than DNC version (%d) for NC %s", localNCVersion, dncNCVersion, service.state.ContainerStatus[idx].ID) } if localNCVersion > -1 { @@ -263,7 +263,7 @@ func (service *HTTPRestService) syncHostNCVersion(ctx context.Context, channelMo } nmaProgrammedNCVersion, err := strconv.Atoi(nmaProgrammedNCVersionStr) if err != nil { - logger.Errorf("failed to parse container version of %s: %s", ncID, err) + logger.Errorf("Failed to parse NC version string '%s' from NMAgent for container %s: %s", nmaProgrammedNCVersionStr, ncID, err) continue } // Check whether it exist in service state and get the related nc info @@ -280,12 +280,12 @@ func (service *HTTPRestService) syncHostNCVersion(ctx context.Context, channelMo localNCVersion, err := strconv.Atoi(ncInfo.HostVersion) if err != nil { - logger.Errorf("failed to parse host nc version string %s: %s", ncInfo.HostVersion, err) + logger.Errorf("Failed to parse host NC version string '%s' to integer for container %s: %s", ncInfo.HostVersion, ncID, err) continue } if localNCVersion > nmaProgrammedNCVersion { //nolint:staticcheck // SA1019: suppress deprecated logger.Printf usage. Todo: legacy logger usage is consistent in cns repo. Migrates when all logger usage is migrated - logger.Errorf("NC version from consolidated sources is decreasing: have %d, got %d", localNCVersion, nmaProgrammedNCVersion) + logger.Errorf("Network container version regression detected for NC %s: local version %d is greater than NMAgent programmed version %d", ncID, localNCVersion, nmaProgrammedNCVersion) continue } if channelMode == cns.CRD { @@ -342,7 +342,7 @@ func (service *HTTPRestService) ReconcileIPAssignment(podInfoByIP map[string]cns podKeyToPodIPs, err := newPodKeyToPodIPsMap(podInfoByIP) if err != nil { - logger.Errorf("could not transform pods indexed by IP address to pod IPs indexed by interface: %v", err) + logger.Errorf("Failed to transform pod IP address map to interface-indexed pod IP map during reconciliation: %v", err) return types.UnexpectedError } @@ -368,7 +368,7 @@ func (service *HTTPRestService) ReconcileIPAssignment(podInfoByIP map[string]cns } else { // it might still be possible to see host networking pods here (where ips are not from ncs) if we are restoring using the kube podinfo provider // todo: once kube podinfo provider reconcile flow is removed, this line will not be necessary/should be removed. - logger.Errorf("ip %s assigned to pod %+v but not found in any nc", ip, podIPs) + logger.Errorf("IP address %s is assigned to pod %+v but was not found in any network container", ip, podIPs) } } @@ -379,7 +379,7 @@ func (service *HTTPRestService) ReconcileIPAssignment(podInfoByIP map[string]cns jsonContext, err := podIPs.OrchestratorContext() if err != nil { - logger.Errorf("Failed to marshal KubernetesPodInfo, error: %v", err) + logger.Errorf("Failed to marshal KubernetesPodInfo to JSON for pod %s: %v", podKey, err) return types.UnexpectedError } @@ -431,7 +431,7 @@ func (service *HTTPRestService) ReconcileIPAMStateForSwift(ncReqs []*cns.CreateN } if err := service.MarkExistingIPsAsPendingRelease(nnc.Spec.IPsNotInUse); err != nil { - logger.Errorf("[Azure CNS] Error. Failed to mark IPs as pending %v", nnc.Spec.IPsNotInUse) + logger.Errorf("[Azure CNS] Failed to mark unused IPs as pending release from NodeNetworkConfig: %v", err) return types.UnexpectedError } @@ -444,7 +444,7 @@ func (service *HTTPRestService) ReconcileIPAMStateForNodeSubnet(ncReqs []*cns.Cr logger.Printf("Reconciling CNS IPAM state with nc requests: [%+v], PodInfo [%+v]", ncReqs, podInfoByIP) if len(ncReqs) != 1 { - logger.Errorf("Nodesubnet should always have 1 NC to hold secondary IPs") + logger.Errorf("Node subnet mode requires exactly 1 network container for secondary IPs, but found %d", len(ncReqs)) return types.NetworkContainerNotSpecified } @@ -577,7 +577,7 @@ func (service *HTTPRestService) MustEnsureNoStaleNCs(validNCIDs []string) { panic(msg) } - logger.Errorf("[Azure CNS] Found stale NC ID %s in CNS state. Removing...", ncID) + logger.Errorf("[Azure CNS] Found stale network container ID %s in CNS state with no assigned IPs. Removing from state...", ncID) delete(service.state.ContainerStatus, ncID) mutated = true } @@ -591,14 +591,14 @@ func (service *HTTPRestService) MustEnsureNoStaleNCs(validNCIDs []string) { // This API will be called by CNS RequestController on CRD update. func (service *HTTPRestService) CreateOrUpdateNetworkContainerInternal(req *cns.CreateNetworkContainerRequest) types.ResponseCode { if req.NetworkContainerid == "" { - logger.Errorf("[Azure CNS] Error. NetworkContainerid is empty") + logger.Errorf("[Azure CNS] Network container ID is empty in CreateOrUpdateNetworkContainer request") return types.NetworkContainerNotSpecified } // For now only RequestController uses this API which will be initialized only for AKS scenario. // Validate ContainerType is set as Docker if service.state.OrchestratorType != cns.KubernetesCRD && service.state.OrchestratorType != cns.Kubernetes { - logger.Errorf("[Azure CNS] Error. Unsupported OrchestratorType: %s", service.state.OrchestratorType) + logger.Errorf("[Azure CNS] Unsupported orchestrator type %s for CreateOrUpdateNetworkContainer operation", service.state.OrchestratorType) return types.UnsupportedOrchestratorType } diff --git a/network/endpoint_linux.go b/network/endpoint_linux.go index 5f57a66d51..ef19704651 100644 --- a/network/endpoint_linux.go +++ b/network/endpoint_linux.go @@ -70,7 +70,7 @@ func (nw *network) newEndpointImpl( ) if nw.Endpoints[epInfo.EndpointID] != nil { - logger.Info("[net] Endpoint already exists.") + logger.Info("Endpoint already exists in network, skipping creation", zap.String("endpointID", epInfo.EndpointID), zap.String("networkID", nw.Id)) err = errEndpointExists return nil, err } @@ -95,7 +95,7 @@ func (nw *network) newEndpointImpl( contIfName = fmt.Sprintf("%s%s2", hostVEthInterfacePrefix, vethname) } else { // Create a veth pair. - logger.Info("Generate veth name based on endpoint id") + logger.Info("Generating veth pair names based on endpoint ID", zap.String("endpointID", epInfo.EndpointID[:7])) hostIfName = fmt.Sprintf("%s%s", hostVEthInterfacePrefix, epInfo.EndpointID[:7]) contIfName = fmt.Sprintf("%s%s-2", hostVEthInterfacePrefix, epInfo.EndpointID[:7]) } @@ -140,13 +140,13 @@ func (nw *network) newEndpointImpl( //nolint:gocritic if vlanid != 0 { if nw.Mode == opModeTransparentVlan { - logger.Info("Transparent vlan client") + logger.Info("Initializing transparent VLAN endpoint client", zap.String("endpointID", epInfo.EndpointID), zap.Int("vlanID", vlanid)) if _, ok := epInfo.Data[SnatBridgeIPKey]; ok { nw.SnatBridgeIP = epInfo.Data[SnatBridgeIPKey].(string) } epClient = NewTransparentVlanEndpointClient(nw, epInfo, hostIfName, contIfName, vlanid, localIP, nl, plc, nsc, iptc) } else { - logger.Info("OVS client") + logger.Info("Initializing OVS endpoint client", zap.String("endpointID", epInfo.EndpointID), zap.Int("vlanID", vlanid)) if _, ok := epInfo.Data[SnatBridgeIPKey]; ok { nw.SnatBridgeIP = epInfo.Data[SnatBridgeIPKey].(string) } @@ -164,13 +164,13 @@ func (nw *network) newEndpointImpl( iptc) } } else if nw.Mode != opModeTransparent { - logger.Info("Bridge client") + logger.Info("Initializing Linux bridge endpoint client", zap.String("endpointID", epInfo.EndpointID)) epClient = NewLinuxBridgeEndpointClient(nw.extIf, hostIfName, contIfName, nw.Mode, nl, plc) } else if epInfo.NICType == cns.NodeNetworkInterfaceFrontendNIC { - logger.Info("Secondary client") + logger.Info("Initializing secondary endpoint client", zap.String("endpointID", epInfo.EndpointID)) epClient = NewSecondaryEndpointClient(nl, netioCli, plc, nsc, dhcpclient, ep) } else { - logger.Info("Transparent client") + logger.Info("Initializing transparent endpoint client", zap.String("endpointID", epInfo.EndpointID)) epClient = NewTransparentEndpointClient(nw.extIf, hostIfName, contIfName, nw.Mode, nl, netioCli, plc) } } @@ -241,7 +241,7 @@ func (nw *network) newEndpointImpl( if epInfo.IPV6Mode != "" { // Enable ipv6 setting in container - logger.Info("Enable ipv6 setting in container.") + logger.Info("Enabling IPv6 settings in container namespace", zap.String("endpointID", epInfo.EndpointID), zap.String("ipv6Mode", epInfo.IPV6Mode)) nuc := networkutils.NewNetworkUtils(nl, plc) if epErr := nuc.UpdateIPV6Setting(0); epErr != nil { return fmt.Errorf("enable ipv6 in container failed:%w", epErr) @@ -351,7 +351,7 @@ func addRoutes(nl netlink.NetlinkInterface, netioshim netio.NetIOInterface, inte if !strings.Contains(strings.ToLower(err.Error()), "file exists") { return err } else { - logger.Info("route already exists") + logger.Info("Skipping route addition: route already exists in routing table", zap.String("destination", route.Dst.String())) } } } @@ -408,9 +408,9 @@ func (nm *networkManager) updateEndpointImpl(nw *network, existingEpInfo *Endpoi var ep *endpoint existingEpFromRepository := nw.Endpoints[existingEpInfo.EndpointID] - logger.Info("[updateEndpointImpl] Going to retrieve endpoint with Id to update", zap.String("id", existingEpInfo.EndpointID)) + logger.Info("Attempting to update endpoint", zap.String("endpointID", existingEpInfo.EndpointID), zap.String("networkID", nw.Id)) if existingEpFromRepository == nil { - logger.Info("[updateEndpointImpl] Endpoint cannot be updated as it does not exist") + logger.Info("Cannot update endpoint: endpoint does not exist in network", zap.String("endpointID", existingEpInfo.EndpointID)) return nil, errEndpointNotFound } diff --git a/network/manager.go b/network/manager.go index bef8858087..bfff6a2bf3 100644 --- a/network/manager.go +++ b/network/manager.go @@ -181,7 +181,7 @@ func (nm *networkManager) IsStatelessCNIMode() bool { func (nm *networkManager) restore(isRehydrationRequired bool) error { // Skip if a store is not provided. if nm.store == nil { - logger.Info("network store is nil") + logger.Info("Skipping network state restoration: no persistent store configured") return nil } @@ -193,14 +193,14 @@ func (nm *networkManager) restore(isRehydrationRequired bool) error { err := nm.store.Read(storeKey, nm) if err != nil { if err == store.ErrKeyNotFound { - logger.Info("network store key not found") + logger.Info("Network state not found in persistent store, starting with clean state") // Considered successful. return nil } else if err == store.ErrStoreEmpty { - logger.Info("network store empty") + logger.Info("Network persistent store is empty, no state to restore") return nil } else { - logger.Error("Failed to restore state", zap.Error(err)) + logger.Error("Failed to restore network state from persistent store", zap.Error(err)) return err } } @@ -209,20 +209,20 @@ func (nm *networkManager) restore(isRehydrationRequired bool) error { modTime, err := nm.store.GetModificationTime() if err == nil { rebootTime, err := nm.plClient.GetLastRebootTime() - logger.Info("reboot time, store mod time", zap.Any("rebootTime", rebootTime), zap.Any("modTime", modTime)) + logger.Info("Comparing system reboot time with store modification time", zap.Any("rebootTime", rebootTime), zap.Any("modTime", modTime)) if err == nil && rebootTime.After(modTime) { - logger.Info("Detected Reboot") + logger.Info("System reboot detected, clearing stale network configuration") rebooted = true if clearNwConfig, err := nm.plClient.ClearNetworkConfiguration(); clearNwConfig { if err != nil { - logger.Error("Failed to clear network configuration", zap.Error(err)) + logger.Error("Failed to clear network configuration after reboot detection", zap.Error(err)) return err } // Delete the networks left behind after reboot for _, extIf := range nm.ExternalInterfaces { for _, nw := range extIf.Networks { - logger.Info("Deleting the network on reboot", zap.String("id", nw.Id)) + logger.Info("Cleaning up network after system reboot", zap.String("networkID", nw.Id)) _ = nm.deleteNetwork(nw.Id) } } @@ -247,12 +247,12 @@ func (nm *networkManager) restore(isRehydrationRequired bool) error { // if rebooted recreate the network that existed before reboot. if rebooted { - logger.Info("Rehydrating network state from persistent store") + logger.Info("Rehydrating network state from persistent store after restore") for _, extIf := range nm.ExternalInterfaces { for _, nw := range extIf.Networks { nwInfo, err := nm.GetNetworkInfo(nw.Id) if err != nil { - logger.Error("Failed to fetch network info for network extif err. This should not happen", + logger.Error("Failed to fetch network info from external interface during rehydration. This should not happen", zap.Any("nw", nw), zap.Any("extIf", extIf), zap.Error(err)) return err } @@ -261,7 +261,7 @@ func (nm *networkManager) restore(isRehydrationRequired bool) error { _, err = nm.newNetworkImpl(&nwInfo, extIf) if err != nil { - logger.Error("Restoring network failed for nwInfo extif. This should not happen", + logger.Error("Failed to restore network from external interface during rehydration. This should not happen", zap.Any("nwInfo", nwInfo), zap.Any("extIf", extIf), zap.Error(err)) return err } @@ -269,7 +269,7 @@ func (nm *networkManager) restore(isRehydrationRequired bool) error { } } - logger.Info("Restored state") + logger.Info("Successfully restored network state from persistent store") return nil } @@ -289,9 +289,9 @@ func (nm *networkManager) save() error { err := nm.store.Write(storeKey, nm) if err == nil { - logger.Info("Save succeeded") + logger.Info("Successfully saved network state to persistent store") } else { - logger.Error("Save failed", zap.Error(err)) + logger.Error("Failed to save network state to persistent store", zap.Error(err)) } return err } @@ -384,7 +384,7 @@ func (nm *networkManager) createEndpoint(cli apipaClient, networkID string, epIn if nw.VlanId != 0 { if epInfo.Data[VlanIDKey] == nil { - logger.Info("overriding endpoint vlanid with network vlanid") + logger.Info("Endpoint VLAN ID not specified, using network VLAN ID", zap.Int("vlanID", nw.VlanId)) epInfo.Data[VlanIDKey] = nw.VlanId } } @@ -396,11 +396,11 @@ func (nm *networkManager) createEndpoint(cli apipaClient, networkID string, epIn // any error after this point should also clean up the endpoint we created above defer func() { if err != nil { - logger.Error("Create endpoint failure", zap.Error(err)) - logger.Info("Cleanup resources") + logger.Error("Endpoint creation failed, initiating cleanup", zap.String("endpointID", ep.Id), zap.Error(err)) + logger.Info("Cleaning up resources for failed endpoint creation", zap.String("endpointID", ep.Id)) delErr := nw.deleteEndpoint(nm.netlink, nm.plClient, nm.netio, nm.nsClient, nm.iptablesClient, nm.dhcpClient, ep.Id) if delErr != nil { - logger.Error("Deleting endpoint after create endpoint failure failed with", zap.Error(delErr)) + logger.Error("Failed to delete endpoint during cleanup after creation failure", zap.String("endpointID", ep.Id), zap.Error(delErr)) } } }() @@ -562,7 +562,7 @@ func (nm *networkManager) GetEndpointInfo(networkID, endpointID string) (*Endpoi defer nm.Unlock() if nm.IsStatelessCNIMode() { - logger.Info("calling cns getEndpoint API") + logger.Info("Retrieving endpoint information from CNS in stateless mode", zap.String("networkID", networkID), zap.String("endpointID", endpointID)) epInfos, err := nm.GetEndpointState(networkID, endpointID) if err != nil { return nil, err @@ -597,7 +597,7 @@ func (nm *networkManager) GetAllEndpoints(networkId string) (map[string]*Endpoin // Special case when CNS invokes CNI, but there is no state, but return gracefully if len(nm.ExternalInterfaces) == 0 { - logger.Info("Network manager has no external interfaces, is the state file populated?") + logger.Info("Network manager has no external interfaces configured, state file may not be populated yet") return eps, store.ErrStoreEmpty } @@ -751,7 +751,7 @@ func (nm *networkManager) SaveState(eps []*endpoint) error { nm.Lock() defer nm.Unlock() - logger.Info("Saving state") + logger.Info("Saving network manager state for endpoints", zap.Int("endpointCount", len(eps))) // If we fail half way, we'll propagate an error up which should clean everything up if nm.IsStatelessCNIMode() { err := nm.UpdateEndpointState(eps) @@ -766,7 +766,7 @@ func (nm *networkManager) DeleteState(epInfos []*EndpointInfo) error { nm.Lock() defer nm.Unlock() - logger.Info("Deleting state") + logger.Info("Deleting network manager state for endpoints", zap.Int("endpointCount", len(epInfos))) // For AKS stateless cni, plugin.ipamInvoker.Delete takes care of removing the state in the main Delete function. // For swiftv2 stateless cni, this call will delete the endpoint state from CNS. diff --git a/network/transparent_vlan_endpointclient_linux.go b/network/transparent_vlan_endpointclient_linux.go index 227ed29ca4..a045089132 100644 --- a/network/transparent_vlan_endpointclient_linux.go +++ b/network/transparent_vlan_endpointclient_linux.go @@ -144,7 +144,7 @@ func (client *TransparentVlanEndpointClient) AddEndpoints(epInfo *EndpointInfo) // Called from AddEndpoints, Namespace: VM and Vnet func (client *TransparentVlanEndpointClient) ensureCleanPopulateVM() error { // Clean up vlan interface in the VM namespace and ensure the network namespace (if it exists) has a vlan interface - logger.Info("Checking if NS and vlan interface exists...") + logger.Info("Verifying network namespace and VLAN interface existence for transparent VLAN endpoint", zap.String("nsName", client.vnetNSName), zap.String("vlanIf", client.vlanIfName)) var existingErr error client.vnetNSFileDescriptor, existingErr = client.netnsClient.GetFromName(client.vnetNSName) if existingErr == nil { @@ -184,7 +184,7 @@ func (client *TransparentVlanEndpointClient) createNetworkNamespace(vmNS int) er return nil } // the vnet and vm namespace are the same by this point - logger.Info("Vnet Namespace is the same as VM namespace. Deleting...") + logger.Info("VNET namespace is identical to VM namespace, removing to prevent conflicts", zap.String("nsName", client.vnetNSName)) delErr := client.netnsClient.DeleteNamed(client.vnetNSName) if delErr != nil { logger.Error("failed to cleanup/delete ns after noticing vnet ns is the same as vm ns", zap.Any("error:", delErr.Error())) @@ -240,7 +240,7 @@ func (client *TransparentVlanEndpointClient) PopulateVM(epInfo *EndpointInfo) er // Any failure will trigger removing the namespace created defer func() { if deleteNSIfNotNilErr != nil { - logger.Info("[transparent vlan] removing vnet ns due to failure...") + logger.Info("Cleaning up VNET namespace due to transparent VLAN endpoint creation failure", zap.String("nsName", client.vnetNSName)) err = client.netnsClient.DeleteNamed(client.vnetNSName) if err != nil { logger.Error("failed to cleanup/delete ns after failing to create vlan interface") From 953a913a34d8e11cbb121baaee82c86265801df0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 18 Nov 2025 18:33:02 +0000 Subject: [PATCH 3/4] Fix variable name in CNS logging error message Co-authored-by: prmathur-microsoft <20328314+prmathur-microsoft@users.noreply.github.com> --- cns/restserver/internalapi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cns/restserver/internalapi.go b/cns/restserver/internalapi.go index 13f5032950..e37b3d0019 100644 --- a/cns/restserver/internalapi.go +++ b/cns/restserver/internalapi.go @@ -162,7 +162,7 @@ func (service *HTTPRestService) SyncNodeStatus(dncEP, infraVnet, nodeID string, req.Header.Set(common.JsonContent, common.JsonContent) service.deleteNetworkContainer(httptest.NewRecorder(), req) } else { - logger.Errorf("[Azure-CNS] Failed to marshal delete NC request body during state sync for NC ID %s: %s", ncID, err.Error()) + logger.Errorf("[Azure-CNS] Failed to create HTTP request for deleting NC during state sync for NC ID %s: %s", nc, err.Error()) } } return From d9e074abb31644b6279df4051aaf24ab98db0dc8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 18 Nov 2025 18:39:27 +0000 Subject: [PATCH 4/4] Final: Add more descriptive logging messages across network and CNS components Co-authored-by: prmathur-microsoft <20328314+prmathur-microsoft@users.noreply.github.com> --- azure-iptables-monitor/go.sum | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-iptables-monitor/go.sum b/azure-iptables-monitor/go.sum index 4fc10e9187..0c58059ec4 100644 --- a/azure-iptables-monitor/go.sum +++ b/azure-iptables-monitor/go.sum @@ -29,6 +29,8 @@ github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-quicktest/qt v1.101.1-0.20240301121107-c6c8733fa1e6 h1:teYtXy9B7y5lHTp8V9KPxpYRAVA7dozigQcMiBust1s= +github.com/go-quicktest/qt v1.101.1-0.20240301121107-c6c8733fa1e6/go.mod h1:p4lGIVX+8Wa6ZPNDvqcxq36XpUDLh42FLetFU7odllI= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=