revert: write to tmp vmdk file#213
Conversation
There was a problem hiding this comment.
Pull request overview
This PR is a follow-up to #212 that ensures DumpVMDKDescriptorToFile best-effort cleans up its temporary merged_fs.vmdk.*.tmp file when the final os.Rename step fails, preventing stray temp files from persisting on rename errors.
Changes:
- Convert
DumpVMDKDescriptorToFileto use a named return error so a deferred cleanup can run on any returned error. - Add a deferred best-effort
os.Remove(tmpName)cleanup path when the function exits with an error (including rename failures).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
c29f118 to
7805a43
Compare
|
@hsiangkao , sorry for the churn. I decided to dive into where my agent brought this tmp file + rename from and found it was just a minor comment from itself during its own review. Let's just revert it back to simply write the file with content. We can keep the unit tests though. WDYT? |
yes, the original persistent vmdk needs that, but now we don't need that. just write the vmdk into bundle dir is enough |
Follow-up to #212
Revert the write to tmp, file sync + rename bits to simplify creating the vmdk files. I dove through the annals and found the review comment which sent my agent down this path. Let's remove it to simplify. This bit of code is not really executed concurrently for the current use case.