backport of commit a3a637ee8efe5e1251f60f781369bd9052c4d4a2 (#18132)

This pull request was automerged via backport-assistant
This commit is contained in:
hc-github-team-nomad-core 2023-08-02 08:47:19 -05:00 committed by GitHub
parent e9b6be87e2
commit 9301daa8e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 9 deletions

3
.changelog/18108.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
migration: Fixed a bug where previous alloc logs were destroyed when migrating ephemeral_disk on the same client
```

View File

@ -279,15 +279,7 @@ func (p *localPrevAlloc) Migrate(ctx context.Context, dest *allocdir.AllocDir) e
p.logger.Debug("copying previous alloc")
moveErr := dest.Move(p.prevAllocDir, p.tasks)
// Always cleanup previous alloc
if err := p.prevAllocDir.Destroy(); err != nil {
p.logger.Error("error destroying alloc dir",
"error", err, "previous_alloc_dir", p.prevAllocDir.AllocDir)
}
return moveErr
return dest.Move(p.prevAllocDir, p.tasks)
}
// remotePrevAlloc is a prevAllocWatcher for previous allocations on remote