@xen-orchestra/backups 0.16.2 → 0.17.0
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/RemoteAdapter.js +15 -9
- package/_VmBackup.js +10 -0
- package/package.json +2 -2
package/RemoteAdapter.js
CHANGED
|
@@ -3,6 +3,7 @@ const Disposable = require('promise-toolbox/Disposable.js')
|
|
|
3
3
|
const fromCallback = require('promise-toolbox/fromCallback.js')
|
|
4
4
|
const fromEvent = require('promise-toolbox/fromEvent.js')
|
|
5
5
|
const pDefer = require('promise-toolbox/defer.js')
|
|
6
|
+
const groupBy = require('lodash/groupBy.js')
|
|
6
7
|
const { dirname, join, normalize, resolve } = require('path')
|
|
7
8
|
const { createLogger } = require('@xen-orchestra/log')
|
|
8
9
|
const { Constants, createVhdDirectoryFromStream, openVhd, VhdAbstract, VhdSynthetic } = require('vhd-lib')
|
|
@@ -243,17 +244,22 @@ class RemoteAdapter {
|
|
|
243
244
|
)
|
|
244
245
|
}
|
|
245
246
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
247
|
+
deleteVmBackup(file) {
|
|
248
|
+
return this.deleteVmBackups([file])
|
|
249
|
+
}
|
|
249
250
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
throw new Error(
|
|
251
|
+
async deleteVmBackups(files) {
|
|
252
|
+
const { delta, full, ...others } = groupBy(await asyncMap(files, file => this.readVmBackupMetadata(file)), 'mode')
|
|
253
|
+
|
|
254
|
+
const unsupportedModes = Object.keys(others)
|
|
255
|
+
if (unsupportedModes.length !== 0) {
|
|
256
|
+
throw new Error('no deleter for backup modes: ' + unsupportedModes.join(', '))
|
|
256
257
|
}
|
|
258
|
+
|
|
259
|
+
await Promise.all([
|
|
260
|
+
delta !== undefined && this.deleteDeltaVmBackups(delta),
|
|
261
|
+
full !== undefined && this.deleteFullVmBackups(full),
|
|
262
|
+
])
|
|
257
263
|
}
|
|
258
264
|
|
|
259
265
|
getDisk = Disposable.factory(this.getDisk)
|
package/_VmBackup.js
CHANGED
|
@@ -36,6 +36,11 @@ const forkDeltaExport = deltaExport =>
|
|
|
36
36
|
|
|
37
37
|
exports.VmBackup = class VmBackup {
|
|
38
38
|
constructor({ config, getSnapshotNameLabel, job, remoteAdapters, remotes, schedule, settings, srs, vm }) {
|
|
39
|
+
if (vm.other_config['xo:backup:job'] === job.id) {
|
|
40
|
+
// otherwise replicated VMs would be matched and replicated again and again
|
|
41
|
+
throw new Error('cannot backup a VM created by this very job')
|
|
42
|
+
}
|
|
43
|
+
|
|
39
44
|
this.config = config
|
|
40
45
|
this.job = job
|
|
41
46
|
this.remoteAdapters = remoteAdapters
|
|
@@ -354,6 +359,11 @@ exports.VmBackup = class VmBackup {
|
|
|
354
359
|
false
|
|
355
360
|
)
|
|
356
361
|
|
|
362
|
+
if (presentBaseVdis.size === 0) {
|
|
363
|
+
debug('no base VM found')
|
|
364
|
+
return
|
|
365
|
+
}
|
|
366
|
+
|
|
357
367
|
const fullVdisRequired = new Set()
|
|
358
368
|
baseUuidToSrcVdi.forEach((srcVdi, baseUuid) => {
|
|
359
369
|
if (presentBaseVdis.has(baseUuid)) {
|
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.
|
|
11
|
+
"version": "0.17.0",
|
|
12
12
|
"engines": {
|
|
13
13
|
"node": ">=14.6"
|
|
14
14
|
},
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"proper-lockfile": "^4.1.2",
|
|
37
37
|
"pump": "^3.0.0",
|
|
38
38
|
"uuid": "^8.3.2",
|
|
39
|
-
"vhd-lib": "^2.0.
|
|
39
|
+
"vhd-lib": "^2.0.4",
|
|
40
40
|
"yazl": "^2.5.1"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|