From e15be7ebd3c08f74aca4447c6f1be3f08770d24c Mon Sep 17 00:00:00 2001 From: Florent BEAUCHAMP Date: Tue, 18 Jan 2022 10:07:56 +0100 Subject: [PATCH] fix(backups/_cleanVm): fixes for aliases cleaning (#6094) Introduced in 249f638495e00357bf93a3aa80f83b56e0bcd889 --- @xen-orchestra/backups/_cleanVm.js | 12 ++++-------- packages/vhd-lib/index.js | 3 +++ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/@xen-orchestra/backups/_cleanVm.js b/@xen-orchestra/backups/_cleanVm.js index 6afbfdd08..e27468af2 100644 --- a/@xen-orchestra/backups/_cleanVm.js +++ b/@xen-orchestra/backups/_cleanVm.js @@ -119,7 +119,7 @@ const listVhds = async (handler, vmDir) => { const list = await handler.list(vdiDir, { filter: file => isVhdFile(file) || INTERRUPTED_VHDS_REG.test(file), }) - aliases[vdiDir] = list.filter(vhd => isVhdAlias(vhd)) + aliases[vdiDir] = list.filter(vhd => isVhdAlias(vhd)).map(file => `${vdiDir}/${file}`) list.forEach(file => { const res = INTERRUPTED_VHDS_REG.exec(file) if (res === null) { @@ -249,15 +249,11 @@ exports.cleanVm = async function cleanVm( } } - // 2022-01-17 - FBP & JFT - Temporary disable aliases checking as it appears problematic - // // check if alias are correct // check if all vhd in data subfolder have a corresponding alias - // await asyncMap(Object.keys(aliases), async dir => { - // await checkAliases(aliases[dir], `${dir}/data`, { handler, onLog, remove }) - // }) - // Avoid a ESLint unused variable - noop(aliases) + await asyncMap(Object.keys(aliases), async dir => { + await checkAliases(aliases[dir], `${dir}/data`, { handler, onLog, remove }) + }) // remove VHDs with missing ancestors { diff --git a/packages/vhd-lib/index.js b/packages/vhd-lib/index.js index 65b0376c5..ef92afa94 100644 --- a/packages/vhd-lib/index.js +++ b/packages/vhd-lib/index.js @@ -12,3 +12,6 @@ exports.VhdDirectory = require('./Vhd/VhdDirectory').VhdDirectory exports.VhdFile = require('./Vhd/VhdFile').VhdFile exports.VhdSynthetic = require('./Vhd/VhdSynthetic').VhdSynthetic exports.Constants = require('./_constants') +const {isVhdAlias, resolveAlias} = require('./_resolveAlias') +exports.isVhdAlias = isVhdAlias +exports.resolveAlias = resolveAlias