@xen-orchestra/backups 0.17.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_cleanVm.js +13 -3
- package/package.json +2 -2
package/_cleanVm.js
CHANGED
|
@@ -202,7 +202,7 @@ exports.cleanVm = async function cleanVm(
|
|
|
202
202
|
await Promise.all(deletions)
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
const jsons =
|
|
205
|
+
const jsons = new Set()
|
|
206
206
|
const xvas = new Set()
|
|
207
207
|
const xvaSums = []
|
|
208
208
|
const entries = await handler.list(vmDir, {
|
|
@@ -210,7 +210,7 @@ exports.cleanVm = async function cleanVm(
|
|
|
210
210
|
})
|
|
211
211
|
entries.forEach(path => {
|
|
212
212
|
if (isMetadataFile(path)) {
|
|
213
|
-
jsons.
|
|
213
|
+
jsons.add(path)
|
|
214
214
|
} else if (isXvaFile(path)) {
|
|
215
215
|
xvas.add(path)
|
|
216
216
|
} else if (isXvaSumFile(path)) {
|
|
@@ -232,7 +232,15 @@ exports.cleanVm = async function cleanVm(
|
|
|
232
232
|
// compile the list of unused XVAs and VHDs, and remove backup metadata which
|
|
233
233
|
// reference a missing XVA/VHD
|
|
234
234
|
await asyncMap(jsons, async json => {
|
|
235
|
-
|
|
235
|
+
let metadata
|
|
236
|
+
try {
|
|
237
|
+
metadata = JSON.parse(await handler.readFile(json))
|
|
238
|
+
} catch (error) {
|
|
239
|
+
onLog(`failed to read metadata file ${json}`, { error })
|
|
240
|
+
jsons.delete(json)
|
|
241
|
+
return
|
|
242
|
+
}
|
|
243
|
+
|
|
236
244
|
const { mode } = metadata
|
|
237
245
|
let size
|
|
238
246
|
if (mode === 'full') {
|
|
@@ -248,6 +256,7 @@ exports.cleanVm = async function cleanVm(
|
|
|
248
256
|
onLog(`the XVA linked to the metadata ${json} is missing`)
|
|
249
257
|
if (remove) {
|
|
250
258
|
onLog(`deleting incomplete backup ${json}`)
|
|
259
|
+
jsons.delete(json)
|
|
251
260
|
await handler.unlink(json)
|
|
252
261
|
}
|
|
253
262
|
}
|
|
@@ -283,6 +292,7 @@ exports.cleanVm = async function cleanVm(
|
|
|
283
292
|
onLog(`Some VHDs linked to the metadata ${json} are missing`, { missingVhds })
|
|
284
293
|
if (remove) {
|
|
285
294
|
onLog(`deleting incomplete backup ${json}`)
|
|
295
|
+
jsons.delete(json)
|
|
286
296
|
await handler.unlink(json)
|
|
287
297
|
}
|
|
288
298
|
}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/vatesfr/xen-orchestra.git"
|
|
10
10
|
},
|
|
11
|
-
"version": "0.17.
|
|
11
|
+
"version": "0.17.1",
|
|
12
12
|
"engines": {
|
|
13
13
|
"node": ">=14.6"
|
|
14
14
|
},
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@vates/disposable": "^0.1.1",
|
|
21
21
|
"@vates/parse-duration": "^0.1.1",
|
|
22
22
|
"@xen-orchestra/async-map": "^0.1.2",
|
|
23
|
-
"@xen-orchestra/fs": "^0.19.
|
|
23
|
+
"@xen-orchestra/fs": "^0.19.3",
|
|
24
24
|
"@xen-orchestra/log": "^0.3.0",
|
|
25
25
|
"@xen-orchestra/template": "^0.1.0",
|
|
26
26
|
"compare-versions": "^4.0.1",
|