Skip to content

Commit

Permalink
save and refresh EBS volume state
Browse files Browse the repository at this point in the history
  • Loading branch information
fierlion committed Oct 19, 2023
1 parent 9333398 commit 1f87bdf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
1 change: 0 additions & 1 deletion agent/ebs/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions agent/engine/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 1f87bdf

Please sign in to comment.