@xen-orchestra/backups 0.33.0 → 0.34.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 +1 -2
- package/_VmBackup.js +5 -0
- package/package.json +4 -4
- package/writers/DeltaBackupWriter.js +1 -31
package/RemoteAdapter.js
CHANGED
|
@@ -666,7 +666,7 @@ class RemoteAdapter {
|
|
|
666
666
|
return path
|
|
667
667
|
}
|
|
668
668
|
|
|
669
|
-
async writeVhd(path, input, { checksum = true, validator = noop, writeBlockConcurrency
|
|
669
|
+
async writeVhd(path, input, { checksum = true, validator = noop, writeBlockConcurrency } = {}) {
|
|
670
670
|
const handler = this._handler
|
|
671
671
|
if (this.useVhdDirectory()) {
|
|
672
672
|
const dataPath = `${dirname(path)}/data/${uuidv4()}.vhd`
|
|
@@ -677,7 +677,6 @@ class RemoteAdapter {
|
|
|
677
677
|
await input.task
|
|
678
678
|
return validator.apply(this, arguments)
|
|
679
679
|
},
|
|
680
|
-
nbdClient,
|
|
681
680
|
})
|
|
682
681
|
await VhdAbstract.createAlias(handler, path, dataPath)
|
|
683
682
|
return size
|
package/_VmBackup.js
CHANGED
|
@@ -245,6 +245,11 @@ class VmBackup {
|
|
|
245
245
|
const deltaExport = await exportDeltaVm(exportedVm, baseVm, {
|
|
246
246
|
fullVdisRequired,
|
|
247
247
|
})
|
|
248
|
+
// since NBD is network based, if one disk use nbd , all the disk use them
|
|
249
|
+
// except the suspended VDI
|
|
250
|
+
if (Object.values(deltaExport.streams).some(({ _nbd }) => _nbd)) {
|
|
251
|
+
Task.info('Transfer data using NBD')
|
|
252
|
+
}
|
|
248
253
|
const sizeContainers = mapValues(deltaExport.streams, stream => watchStreamSize(stream))
|
|
249
254
|
deltaExport.streams = mapValues(deltaExport.streams, this._throttleStream)
|
|
250
255
|
|
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.34.0",
|
|
12
12
|
"engines": {
|
|
13
13
|
"node": ">=14.6"
|
|
14
14
|
},
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@vates/decorate-with": "^2.0.0",
|
|
25
25
|
"@vates/disposable": "^0.1.4",
|
|
26
26
|
"@vates/fuse-vhd": "^1.0.0",
|
|
27
|
-
"@vates/nbd-client": "^1.0
|
|
27
|
+
"@vates/nbd-client": "^1.1.0",
|
|
28
28
|
"@vates/parse-duration": "^0.1.1",
|
|
29
29
|
"@xen-orchestra/async-map": "^0.1.2",
|
|
30
30
|
"@xen-orchestra/fs": "^3.3.4",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"promise-toolbox": "^0.21.0",
|
|
43
43
|
"proper-lockfile": "^4.1.2",
|
|
44
44
|
"uuid": "^9.0.0",
|
|
45
|
-
"vhd-lib": "^4.
|
|
45
|
+
"vhd-lib": "^4.3.0",
|
|
46
46
|
"yazl": "^2.5.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"tmp": "^0.2.1"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@xen-orchestra/xapi": "^2.
|
|
55
|
+
"@xen-orchestra/xapi": "^2.1.0"
|
|
56
56
|
},
|
|
57
57
|
"license": "AGPL-3.0-or-later",
|
|
58
58
|
"author": {
|
|
@@ -20,9 +20,8 @@ const { AbstractDeltaWriter } = require('./_AbstractDeltaWriter.js')
|
|
|
20
20
|
const { checkVhd } = require('./_checkVhd.js')
|
|
21
21
|
const { packUuid } = require('./_packUuid.js')
|
|
22
22
|
const { Disposable } = require('promise-toolbox')
|
|
23
|
-
const NbdClient = require('@vates/nbd-client')
|
|
24
23
|
|
|
25
|
-
const {
|
|
24
|
+
const { warn } = createLogger('xo:backups:DeltaBackupWriter')
|
|
26
25
|
|
|
27
26
|
class DeltaBackupWriter extends MixinBackupWriter(AbstractDeltaWriter) {
|
|
28
27
|
async checkBaseVdis(baseUuidToSrcVdi) {
|
|
@@ -200,41 +199,12 @@ class DeltaBackupWriter extends MixinBackupWriter(AbstractDeltaWriter) {
|
|
|
200
199
|
await checkVhd(handler, parentPath)
|
|
201
200
|
}
|
|
202
201
|
|
|
203
|
-
const vdiRef = vm.$xapi.getObject(vdi.uuid).$ref
|
|
204
|
-
|
|
205
|
-
let nbdClient
|
|
206
|
-
if (this._backup.config.useNbd && adapter.useVhdDirectory()) {
|
|
207
|
-
debug('useNbd is enabled', { vdi: id, path })
|
|
208
|
-
// get nbd if possible
|
|
209
|
-
try {
|
|
210
|
-
// this will always take the first host in the list
|
|
211
|
-
const [nbdInfo] = await vm.$xapi.call('VDI.get_nbd_info', vdiRef)
|
|
212
|
-
debug('got NBD info', { nbdInfo, vdi: id, path })
|
|
213
|
-
nbdClient = new NbdClient(nbdInfo)
|
|
214
|
-
await nbdClient.connect()
|
|
215
|
-
|
|
216
|
-
// this will inform the xapi that we don't need this anymore
|
|
217
|
-
// and will detach the vdi from dom0
|
|
218
|
-
$defer(() => nbdClient.disconnect())
|
|
219
|
-
|
|
220
|
-
info('NBD client ready', { vdi: id, path })
|
|
221
|
-
Task.info('NBD used')
|
|
222
|
-
} catch (error) {
|
|
223
|
-
Task.warning('NBD configured but unusable', { error })
|
|
224
|
-
nbdClient = undefined
|
|
225
|
-
warn('error connecting to NBD server', { error, vdi: id, path })
|
|
226
|
-
}
|
|
227
|
-
} else {
|
|
228
|
-
debug('useNbd is disabled', { vdi: id, path })
|
|
229
|
-
}
|
|
230
|
-
|
|
231
202
|
transferSize += await adapter.writeVhd(path, deltaExport.streams[`${id}.vhd`], {
|
|
232
203
|
// no checksum for VHDs, because they will be invalidated by
|
|
233
204
|
// merges and chainings
|
|
234
205
|
checksum: false,
|
|
235
206
|
validator: tmpPath => checkVhd(handler, tmpPath),
|
|
236
207
|
writeBlockConcurrency: this._backup.config.writeBlockConcurrency,
|
|
237
|
-
nbdClient,
|
|
238
208
|
})
|
|
239
209
|
|
|
240
210
|
if (isDelta) {
|