@xen-orchestra/backups 0.29.5 → 0.29.6
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/README.md +2 -2
- package/_deltaVm.js +3 -0
- package/_forkStreamUnpipe.js +15 -16
- package/package.json +3 -4
- package/writers/DeltaBackupWriter.js +12 -2
package/README.md
CHANGED
package/_deltaVm.js
CHANGED
|
@@ -258,6 +258,9 @@ exports.importDeltaVm = defer(async function importDeltaVm(
|
|
|
258
258
|
$defer.onFailure(() => newVdi.$destroy())
|
|
259
259
|
|
|
260
260
|
await newVdi.update_other_config(TAG_COPY_SRC, vdi.uuid)
|
|
261
|
+
if (vdi.virtual_size > newVdi.virtual_size) {
|
|
262
|
+
await newVdi.$callAsync('resize', vdi.virtual_size)
|
|
263
|
+
}
|
|
261
264
|
} else if (vdiRef === vmRecord.suspend_VDI) {
|
|
262
265
|
// suspendVDI has already created
|
|
263
266
|
newVdi = suspendVdi
|
package/_forkStreamUnpipe.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const { PassThrough } = require('stream')
|
|
3
|
+
const { finished, PassThrough } = require('node:stream')
|
|
5
4
|
|
|
6
5
|
const { debug } = require('@xen-orchestra/log').createLogger('xo:backups:forkStreamUnpipe')
|
|
7
6
|
|
|
@@ -9,29 +8,29 @@ const { debug } = require('@xen-orchestra/log').createLogger('xo:backups:forkStr
|
|
|
9
8
|
//
|
|
10
9
|
// in case of error in the new readable stream, it will simply be unpiped
|
|
11
10
|
// from the original one
|
|
12
|
-
exports.forkStreamUnpipe = function forkStreamUnpipe(
|
|
13
|
-
const { forks = 0 } =
|
|
14
|
-
|
|
11
|
+
exports.forkStreamUnpipe = function forkStreamUnpipe(source) {
|
|
12
|
+
const { forks = 0 } = source
|
|
13
|
+
source.forks = forks + 1
|
|
15
14
|
|
|
16
|
-
debug('forking', { forks:
|
|
15
|
+
debug('forking', { forks: source.forks })
|
|
17
16
|
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const fork = new PassThrough()
|
|
18
|
+
source.pipe(fork)
|
|
19
|
+
finished(source, { writable: false }, error => {
|
|
21
20
|
if (error !== undefined) {
|
|
22
21
|
debug('error on original stream, destroying fork', { error })
|
|
23
|
-
|
|
22
|
+
fork.destroy(error)
|
|
24
23
|
}
|
|
25
24
|
})
|
|
26
|
-
|
|
27
|
-
debug('end of stream, unpiping', { error, forks: --
|
|
25
|
+
finished(fork, { readable: false }, error => {
|
|
26
|
+
debug('end of stream, unpiping', { error, forks: --source.forks })
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
source.unpipe(fork)
|
|
30
29
|
|
|
31
|
-
if (
|
|
30
|
+
if (source.forks === 0) {
|
|
32
31
|
debug('no more forks, destroying original stream')
|
|
33
|
-
|
|
32
|
+
source.destroy(new Error('no more consumers for this stream'))
|
|
34
33
|
}
|
|
35
34
|
})
|
|
36
|
-
return
|
|
35
|
+
return fork
|
|
37
36
|
}
|
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.29.
|
|
11
|
+
"version": "0.29.6",
|
|
12
12
|
"engines": {
|
|
13
13
|
"node": ">=14.6"
|
|
14
14
|
},
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@vates/decorate-with": "^2.0.0",
|
|
24
24
|
"@vates/disposable": "^0.1.4",
|
|
25
25
|
"@vates/fuse-vhd": "^1.0.0",
|
|
26
|
-
"@vates/nbd-client": "
|
|
26
|
+
"@vates/nbd-client": "^1.0.1",
|
|
27
27
|
"@vates/parse-duration": "^0.1.1",
|
|
28
28
|
"@xen-orchestra/async-map": "^0.1.2",
|
|
29
29
|
"@xen-orchestra/fs": "^3.3.1",
|
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
"compare-versions": "^5.0.1",
|
|
33
33
|
"d3-time-format": "^3.0.0",
|
|
34
34
|
"decorator-synchronized": "^0.6.0",
|
|
35
|
-
"end-of-stream": "^1.4.4",
|
|
36
35
|
"fs-extra": "^11.1.0",
|
|
37
36
|
"golike-defer": "^0.5.1",
|
|
38
37
|
"limit-concurrency-decorator": "^0.5.0",
|
|
@@ -52,7 +51,7 @@
|
|
|
52
51
|
"tmp": "^0.2.1"
|
|
53
52
|
},
|
|
54
53
|
"peerDependencies": {
|
|
55
|
-
"@xen-orchestra/xapi": "^1.6.
|
|
54
|
+
"@xen-orchestra/xapi": "^1.6.1"
|
|
56
55
|
},
|
|
57
56
|
"license": "AGPL-3.0-or-later",
|
|
58
57
|
"author": {
|
|
@@ -7,6 +7,8 @@ const ignoreErrors = require('promise-toolbox/ignoreErrors')
|
|
|
7
7
|
const { asyncMap } = require('@xen-orchestra/async-map')
|
|
8
8
|
const { chainVhd, checkVhdChain, openVhd, VhdAbstract } = require('vhd-lib')
|
|
9
9
|
const { createLogger } = require('@xen-orchestra/log')
|
|
10
|
+
const { decorateClass } = require('@vates/decorate-with')
|
|
11
|
+
const { defer } = require('golike-defer')
|
|
10
12
|
const { dirname } = require('path')
|
|
11
13
|
|
|
12
14
|
const { formatFilenameDate } = require('../_filenameDate.js')
|
|
@@ -22,7 +24,7 @@ const NbdClient = require('@vates/nbd-client')
|
|
|
22
24
|
|
|
23
25
|
const { debug, warn, info } = createLogger('xo:backups:DeltaBackupWriter')
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
class DeltaBackupWriter extends MixinBackupWriter(AbstractDeltaWriter) {
|
|
26
28
|
async checkBaseVdis(baseUuidToSrcVdi) {
|
|
27
29
|
const { handler } = this._adapter
|
|
28
30
|
const backup = this._backup
|
|
@@ -133,7 +135,7 @@ exports.DeltaBackupWriter = class DeltaBackupWriter extends MixinBackupWriter(Ab
|
|
|
133
135
|
}
|
|
134
136
|
}
|
|
135
137
|
|
|
136
|
-
async _transfer({ timestamp, deltaExport }) {
|
|
138
|
+
async _transfer($defer, { timestamp, deltaExport }) {
|
|
137
139
|
const adapter = this._adapter
|
|
138
140
|
const backup = this._backup
|
|
139
141
|
|
|
@@ -210,6 +212,11 @@ exports.DeltaBackupWriter = class DeltaBackupWriter extends MixinBackupWriter(Ab
|
|
|
210
212
|
debug('got NBD info', { nbdInfo, vdi: id, path })
|
|
211
213
|
nbdClient = new NbdClient(nbdInfo)
|
|
212
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
|
+
|
|
213
220
|
info('NBD client ready', { vdi: id, path })
|
|
214
221
|
} catch (error) {
|
|
215
222
|
nbdClient = undefined
|
|
@@ -248,3 +255,6 @@ exports.DeltaBackupWriter = class DeltaBackupWriter extends MixinBackupWriter(Ab
|
|
|
248
255
|
// TODO: run cleanup?
|
|
249
256
|
}
|
|
250
257
|
}
|
|
258
|
+
exports.DeltaBackupWriter = decorateClass(DeltaBackupWriter, {
|
|
259
|
+
_transfer: defer,
|
|
260
|
+
})
|