Skip to content

Commit

Permalink
feat(backups/RemoteAdapter#cleanVm): show missing VHDs
Browse files Browse the repository at this point in the history
Related to investigation on zammad#4156
  • Loading branch information
julien-f committed Dec 8, 2021
1 parent 465c8f9 commit cb2a34c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions @xen-orchestra/backups/_cleanVm.js
Expand Up @@ -256,9 +256,12 @@ exports.cleanVm = async function cleanVm(
const { vhds } = metadata
return Object.keys(vhds).map(key => resolve('/', vmDir, vhds[key]))
})()

const missingVhds = linkedVhds.filter(_ => !vhds.has(_))

// FIXME: find better approach by keeping as much of the backup as
// possible (existing disks) even if one disk is missing
if (linkedVhds.every(_ => vhds.has(_))) {
if (missingVhds.length === 0) {
linkedVhds.forEach(_ => unusedVhds.delete(_))

// checking the size of a vhd directory is costly
Expand All @@ -277,7 +280,7 @@ exports.cleanVm = async function cleanVm(
}
}
} else {
onLog(`Some VHDs linked to the metadata ${json} are missing`)
onLog(`Some VHDs linked to the metadata ${json} are missing`, { missingVhds })
if (remove) {
onLog(`deleting incomplete backup ${json}`)
await handler.unlink(json)
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Expand Up @@ -35,6 +35,7 @@
- @xen-orchestra/fs patch
- vhd-lib patch
- @xen-orchestra/backups patch
- xo-server patch
- @xen-orchestra/proxy patch
- xo-web patch

0 comments on commit cb2a34c

Please sign in to comment.