@xen-orchestra/backups 0.60.0 → 0.61.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.mjs CHANGED
@@ -34,6 +34,7 @@ import { watchStreamSize } from './_watchStreamSize.mjs'
34
34
  import { RemoteVhd } from './disks/RemoteVhd.mjs'
35
35
  import { openDiskChain } from './disks/openDiskChain.mjs'
36
36
  import { toVhdStream, writeToVhdDirectory } from 'vhd-lib/disk-consumer/index.mjs'
37
+ import { ReadAhead } from '@xen-orchestra/disk-transform'
37
38
 
38
39
  export const DIR_XO_CONFIG_BACKUPS = 'xo-config-backups'
39
40
 
@@ -741,6 +742,7 @@ export class RemoteAdapter {
741
742
  disk = new RemoteVhd({ handler, path })
742
743
  await disk.init()
743
744
  }
745
+ disk = new ReadAhead(disk)
744
746
  return disk
745
747
  }
746
748
 
@@ -9,6 +9,7 @@ import { IncrementalRemoteWriter } from '../_writers/IncrementalRemoteWriter.mjs
9
9
  import { Disposable } from 'promise-toolbox'
10
10
  import { openVhd } from 'vhd-lib'
11
11
  import { getVmBackupDir } from '../../_getVmBackupDir.mjs'
12
+ import { SynchronizedDisk } from '@xen-orchestra/disk-transform'
12
13
 
13
14
  const { warn } = createLogger('xo:backups:Incrementalremote')
14
15
  class IncrementalRemoteVmBackupRunner extends AbstractRemote {
@@ -68,9 +69,12 @@ class IncrementalRemoteVmBackupRunner extends AbstractRemote {
68
69
  // recompute if disks are differencing or not
69
70
  const isVhdDifferencing = {}
70
71
 
71
- Object.entries(incrementalExport.disks).forEach(([key, disk]) => {
72
+ for (const key in incrementalExport.disks) {
73
+ const disk = incrementalExport.disks[key]
72
74
  isVhdDifferencing[key] = disk.isDifferencing()
73
- })
75
+ incrementalExport.disks[key] = new SynchronizedDisk(disk)
76
+ }
77
+
74
78
  const hasDifferencingDisk = Object.values(isVhdDifferencing).includes(true)
75
79
  if (metadata.isBase === hasDifferencingDisk) {
76
80
  warn(`Metadata isBase and real disk value are different`, {
@@ -84,10 +88,18 @@ class IncrementalRemoteVmBackupRunner extends AbstractRemote {
84
88
  await this._selectBaseVm(metadata)
85
89
  await this._callWriters(writer => writer.prepare({ isBase: metadata.isBase }), 'writer.prepare()')
86
90
 
91
+ function fork(incrementalExport, label) {
92
+ const { disks, ...forked } = incrementalExport
93
+ forked.disks = {}
94
+ for (const key in disks) {
95
+ forked.disks[key] = disks[key].fork(label)
96
+ }
97
+ return forked
98
+ }
87
99
  await this._callWriters(
88
100
  writer =>
89
101
  writer.transfer({
90
- deltaExport: incrementalExport,
102
+ deltaExport: fork(incrementalExport, writer.constructor.name + ' ' + Math.random()),
91
103
  isVhdDifferencing,
92
104
  timestamp: metadata.timestamp,
93
105
  vm: metadata.vm,
@@ -202,8 +202,8 @@ export class IncrementalRemoteWriter extends MixinRemoteWriter(AbstractIncrement
202
202
 
203
203
  let metadataContent = await this._isAlreadyTransferred(timestamp)
204
204
  if (metadataContent !== undefined) {
205
- // skip backup while being vigilant to not stuck the forked stream
206
- /** @todo destroy fork */
205
+ // skip backup while being vigilant to not stuck the forked disk
206
+ await Promise.all(Object.values(deltaExport.disks).map(async disk => disk.close()))
207
207
  return { size: 0 }
208
208
  }
209
209
 
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.60.0",
11
+ "version": "0.61.0",
12
12
  "engines": {
13
13
  "node": ">=14.18"
14
14
  },
@@ -29,7 +29,7 @@
29
29
  "@vates/nbd-client": "^3.1.3",
30
30
  "@vates/parse-duration": "^0.1.1",
31
31
  "@xen-orchestra/async-map": "^0.1.2",
32
- "@xen-orchestra/disk-transform": "^1.0.0",
32
+ "@xen-orchestra/disk-transform": "^1.0.1",
33
33
  "@xen-orchestra/fs": "^4.5.1",
34
34
  "@xen-orchestra/log": "^0.7.1",
35
35
  "@xen-orchestra/template": "^0.1.0",
@@ -50,7 +50,7 @@
50
50
  "tar": "^6.1.15",
51
51
  "uuid": "^9.0.0",
52
52
  "value-matcher": "^0.2.0",
53
- "vhd-lib": "^4.11.3",
53
+ "vhd-lib": "^4.12.0",
54
54
  "xen-api": "^4.7.1",
55
55
  "yazl": "^2.5.1"
56
56
  },