fix(backups/cleanVm): dont fail on broken metadata

This commit is contained in:
Julien Fontanet
2021-12-20 09:48:30 +01:00
parent bb10bbc945
commit 02ae8bceda
2 changed files with 10 additions and 1 deletions

View File

@@ -232,7 +232,15 @@ exports.cleanVm = async function cleanVm(
// compile the list of unused XVAs and VHDs, and remove backup metadata which
// reference a missing XVA/VHD
await asyncMap(jsons, async json => {
const metadata = JSON.parse(await handler.readFile(json))
let metadata
try {
metadata = JSON.parse(await handler.readFile(json))
} catch (error) {
onLog(`failed to read metadata file ${json}`, { error })
jsons.delete(json)
return
}
const { mode } = metadata
let size
if (mode === 'full') {

View File

@@ -29,6 +29,7 @@
> In case of conflict, the highest (lowest in previous list) `$version` wins.
- @xen-orchestra/fs patch
- @xen-orchestra/backups patch
- @xen-orchestra/proxy patch
- vhd-lib minor
- xo-server patch