From 1f87bdf92f3a603f7b46e1412d6f565c9f6d7c53 Mon Sep 17 00:00:00 2001 From: Ray Allan Date: Thu, 19 Oct 2023 00:35:14 +0000 Subject: [PATCH] save and refresh EBS volume state --- agent/ebs/watcher.go | 1 - agent/engine/data.go | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/agent/ebs/watcher.go b/agent/ebs/watcher.go index 976b411b687..3e8ecf825f6 100644 --- a/agent/ebs/watcher.go +++ b/agent/ebs/watcher.go @@ -247,7 +247,6 @@ func (w *EBSWatcher) notifyAttachedEBS(volumeId string) error { if err := w.sendEBSStateChange(ebs); err != nil { return fmt.Errorf("Unable to send state EBS change, %s", err) } - ebs.SetSentStatus() ebs.StopAckTimer() log.Infof("We've set sent status for %v", ebs.EBSToString()) return nil diff --git a/agent/engine/data.go b/agent/engine/data.go index 1678eb6c3c7..960e5d57d98 100644 --- a/agent/engine/data.go +++ b/agent/engine/data.go @@ -40,6 +40,11 @@ func (engine *DockerTaskEngine) LoadState() error { return err } + // for now this will only load EBS Attachments -- see TODO below + if err := engine.loadResourceAttachments(); err != nil { + return err + } + return engine.loadENIAttachments() } @@ -119,6 +124,18 @@ func (engine *DockerTaskEngine) loadImageStates() error { return nil } +func (engine *DockerTaskEngine) loadResourceAttachments() error { + resAttachments, err := engine.dataClient.GetResourceAttachments() + if err != nil { + return err + } + // TODO update docker state to handle more than just EBS Resource Type + for _, resAttachment := range resAttachments { + engine.state.AddEBSAttachment(Attachment) + } + return nil +} + func (engine *DockerTaskEngine) loadENIAttachments() error { eniAttachments, err := engine.dataClient.GetENIAttachments() if err != nil {