Skip to content

B #8187: Clean up temporary staging files on failure in Ceph cp driver - #8188

Draft
trukhinyuri wants to merge 1 commit into
OpenNebula:masterfrom
trukhinyuri:fix/ceph-cp-cleanup-tmp
Draft

trukhinyuri wants to merge 1 commit into
OpenNebula:masterfrom
trukhinyuri:fix/ceph-cp-cleanup-tmp

Conversation

@trukhinyuri

@trukhinyuri trukhinyuri commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes #8187.

In src/datastore_mad/remotes/ceph/cp, temporary files in $STAGING_DIR on $DST_HOST ($TMP_DST, $TMP_DST.raw, $TMP_DST.d) are only removed at the end of REGISTER_CMD if all commands succeed. When qemu-img convert -O raw or rbd import fails under set -e, or when the initial stream to $DST_HOST:$TMP_DST fails, the staging files are left behind in /var/tmp on the bridge host.

Add an EXIT INT TERM trap inside REGISTER_CMD on $DST_HOST and a trap in ceph/cp around the transfer/registration phase (cleared before normal exit) so $TMP_DST* is cleaned up on error or interruption.

Branches to which this PR applies

  • master
  • one-7.0

  • Check this if this PR should not be squashed

Copilot AI balanced review requested due to automatic review settings October 14, 2026 13:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The signal traps perform cleanup but suppress termination, allowing execution to continue after interruption.

1 open finding
What changed in this PR

Adds cleanup for temporary Ceph staging files during failed or interrupted image imports.

Changes:

  • Adds local and remote cleanup traps.
  • Clears the local trap after successful registration.
File Description
src/​datastore_mad/​remotes/​ceph/​cp Cleans temporary staging artifacts during transfer and registration.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/datastore_mad/remotes/ceph/cp Resolved
@trukhinyuri
trukhinyuri force-pushed the fix/ceph-cp-cleanup-tmp branch from f58c758 to 53e2936 Compare October 14, 2026 16:43
…h cp driver

In src/datastore_mad/remotes/ceph/cp, temporary staging files ($TMP_DST,
$TMP_DST.raw, $TMP_DST.d) on the bridge host were only removed at the
end of REGISTER_CMD after all commands succeeded. If the initial
transfer failed or if qemu-img convert / rbd import failed under set -e,
the temporary files remained in $STAGING_DIR.

Add EXIT cleanup traps and INT/TERM exit handlers inside REGISTER_CMD on
$DST_HOST and around the transfer phase in ceph/cp (cleared before
normal completion) so staging artifacts are cleaned up once on failure
or signal interruption.

Signed-off-by: Iurii Trukhin <yuri@trukhin.com>
@trukhinyuri
trukhinyuri force-pushed the fix/ceph-cp-cleanup-tmp branch from 53e2936 to da596f8 Compare October 15, 2026 00:21
@rsmontero
rsmontero marked this pull request as draft November 2, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ceph/LVM datastore cp driver leaves temporary files in STAGING_DIR on bridge host when image copy or conversion fails

3 participants