From 9301daa8e8c29d33ad172d139285726fc28a70d6 Mon Sep 17 00:00:00 2001 From: hc-github-team-nomad-core <82989552+hc-github-team-nomad-core@users.noreply.github.com> Date: Wed, 2 Aug 2023 08:47:19 -0500 Subject: [PATCH] backport of commit a3a637ee8efe5e1251f60f781369bd9052c4d4a2 (#18132) This pull request was automerged via backport-assistant --- .changelog/18108.txt | 3 +++ client/allocwatcher/alloc_watcher.go | 10 +--------- 2 files changed, 4 insertions(+), 9 deletions(-) create mode 100644 .changelog/18108.txt diff --git a/.changelog/18108.txt b/.changelog/18108.txt new file mode 100644 index 000000000..26e7d6b58 --- /dev/null +++ b/.changelog/18108.txt @@ -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 +``` diff --git a/client/allocwatcher/alloc_watcher.go b/client/allocwatcher/alloc_watcher.go index 1df200e3b..9dc5f95d1 100644 --- a/client/allocwatcher/alloc_watcher.go +++ b/client/allocwatcher/alloc_watcher.go @@ -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