From a6416421d00c7b0a7763ab6773c1dea422b93abe Mon Sep 17 00:00:00 2001 From: Milan Lenco Date: Fri, 12 May 2023 12:36:54 +0200 Subject: [PATCH] Make domainmgr skip DNS with empty DPCKey Do not activate PhysicalIOAdapterList subscription until NIM receives a DPC and publishes corresponding DNS. NIM can publish DNS even before it receives first DPC. In such case DPCKey is empty. The goal is to avoid assigning network ports to PCIBack if they are going to be used for management purposes. This way we avoid doing unintended port assignment to PCIBack that would be shortly followed by a release, therefore mitigating the risk of race conditions between domainmgr and NIM. Backported from the master, commit: 53c7ee7ce82409870c204e4a92fbc539d18c0170 Signed-off-by: Milan Lenco --- pkg/pillar/cmd/domainmgr/domainmgr.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkg/pillar/cmd/domainmgr/domainmgr.go b/pkg/pillar/cmd/domainmgr/domainmgr.go index 7e733e7683..4e5a640076 100644 --- a/pkg/pillar/cmd/domainmgr/domainmgr.go +++ b/pkg/pillar/cmd/domainmgr/domainmgr.go @@ -2409,6 +2409,18 @@ func handleDNSImpl(ctxArg interface{}, key string, log.Functionf("handleDNSImpl: ignoring %s", key) return } + if status.DPCKey == "" { + // Do not activate PhysicalIOAdapterList subscription until NIM receives + // a DPC and publishes corresponding DNS. + // NIM can publish DNS even before it receives first DPC. In such case + // DPCKey is empty. + // The goal is to avoid assigning network ports to PCIBack if they are going to be + // used for management purposes. This way we avoid doing unintended port assignment + // to PCIBack that would be shortly followed by a release, therefore mitigating + // the risk of race conditions between domainmgr and NIM. + log.Warnf("handleDNSImpl: DNS with empty DPCKey") + return + } // Ignore test status and timestamps // Compare Testing to save its updated value which is used by us if ctx.deviceNetworkStatus.MostlyEqual(status) &&