From dd5e67ff0ca1198c51bb4a4e12d4376046573586 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 23 Dec 2020 12:51:37 +0300 Subject: [PATCH] [#271] service/audit: Add netmap structure to audit task Signed-off-by: Alex Vanin --- pkg/innerring/processors/audit/process.go | 3 ++- pkg/services/audit/task.go | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/pkg/innerring/processors/audit/process.go b/pkg/innerring/processors/audit/process.go index bb430e398f..28e8301e25 100644 --- a/pkg/innerring/processors/audit/process.go +++ b/pkg/innerring/processors/audit/process.go @@ -90,7 +90,8 @@ func (ap *Processor) processStartAudit(epoch uint64) { WithContainerID(containers[i]). WithStorageGroupList(storageGroups). WithContainerStructure(cnr). - WithContainerNodes(nodes) + WithContainerNodes(nodes). + WithNetworkMap(nm) if err := ap.taskManager.PushTask(auditTask); err != nil { ap.log.Error("could not push audit task", diff --git a/pkg/services/audit/task.go b/pkg/services/audit/task.go index 118518796c..b7b212e05a 100644 --- a/pkg/services/audit/task.go +++ b/pkg/services/audit/task.go @@ -18,6 +18,8 @@ type Task struct { cnr *container.Container + nm *netmap.Netmap + cnrNodes netmap.ContainerNodes sgList []*object.ID @@ -88,6 +90,20 @@ func (t *Task) WithContainerNodes(cnrNodes netmap.ContainerNodes) *Task { return t } +// NetworkMap returns network map of audit epoch. +func (t *Task) NetworkMap() *netmap.Netmap { + return t.nm +} + +// WithNetworkMap sets network map of audit epoch. +func (t *Task) WithNetworkMap(nm *netmap.Netmap) *Task { + if t != nil { + t.nm = nm + } + + return t +} + // ContainerNodes returns nodes in the container under audit. func (t *Task) ContainerNodes() netmap.ContainerNodes { return t.cnrNodes