@xen-orchestra/backups 0.44.3 → 0.44.5

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.
@@ -191,7 +191,7 @@ export class ImportVmBackup {
191
191
 
192
192
  async #decorateIncrementalVmMetadata() {
193
193
  const { additionnalVmTag, mapVdisSrs, useDifferentialRestore } = this._importIncrementalVmSettings
194
-
194
+
195
195
  const ignoredVdis = new Set(
196
196
  Object.entries(mapVdisSrs)
197
197
  .filter(([_, srUuid]) => srUuid === null)
@@ -21,7 +21,7 @@ export class RestoreMetadataBackup {
21
21
  })
22
22
  } else {
23
23
  const metadata = JSON.parse(await handler.readFile(join(backupId, 'metadata.json')))
24
- const dataFileName = resolve(backupId, metadata.data ?? 'data.json')
24
+ const dataFileName = resolve('/', backupId, metadata.data ?? 'data.json').slice(1)
25
25
  const data = await handler.readFile(dataFileName)
26
26
 
27
27
  // if data is JSON, sent it as a plain string, otherwise, consider the data as binary and encode it
@@ -205,7 +205,7 @@ export class IncrementalRemoteWriter extends MixinRemoteWriter(AbstractIncrement
205
205
  // TODO remove when this has been done before the export
206
206
  await checkVhd(handler, parentPath)
207
207
  }
208
-
208
+
209
209
  // don't write it as transferSize += await async function
210
210
  // since i += await asyncFun lead to race condition
211
211
  // as explained : https://eslint.org/docs/latest/rules/require-atomic-updates
@@ -58,7 +58,7 @@ export const MixinXapiWriter = (BaseClass = Object) =>
58
58
  )
59
59
  }
60
60
  const healthCheckVm = xapi.getObject(healthCheckVmRef) ?? (await xapi.waitObject(healthCheckVmRef))
61
- await healthCheckVm.add_tag('xo:no-bak=Health Check')
61
+ await healthCheckVm.add_tags('xo:no-bak=Health Check')
62
62
  await new HealthCheckVmBackup({
63
63
  restoredVm: healthCheckVm,
64
64
  xapi,
@@ -2,8 +2,21 @@ import mapValues from 'lodash/mapValues.js'
2
2
  import { dirname } from 'node:path'
3
3
 
4
4
  function formatVmBackup(backup) {
5
- const { isVhdDifferencing } = backup
5
+ const { isVhdDifferencing, vmSnapshot } = backup
6
6
 
7
+ let differencingVhds
8
+ let dynamicVhds
9
+ // some backups don't use snapshots, therefore cannot be with memory
10
+ const withMemory = vmSnapshot !== undefined && vmSnapshot.suspend_VDI !== 'OpaqueRef:NULL'
11
+ // isVhdDifferencing is either undefined or an object
12
+ if (isVhdDifferencing !== undefined) {
13
+ differencingVhds = Object.values(isVhdDifferencing).filter(t => t).length
14
+ dynamicVhds = Object.values(isVhdDifferencing).filter(t => !t).length
15
+ if (withMemory) {
16
+ // the suspend VDI (memory) is always a dynamic
17
+ dynamicVhds -= 1
18
+ }
19
+ }
7
20
  return {
8
21
  disks:
9
22
  backup.vhds === undefined
@@ -28,9 +41,9 @@ function formatVmBackup(backup) {
28
41
  name_label: backup.vm.name_label,
29
42
  },
30
43
 
31
- // isVhdDifferencing is either undefined or an object
32
- differencingVhds: isVhdDifferencing && Object.values(isVhdDifferencing).filter(t => t).length,
33
- dynamicVhds: isVhdDifferencing && Object.values(isVhdDifferencing).filter(t => !t).length,
44
+ differencingVhds,
45
+ dynamicVhds,
46
+ withMemory,
34
47
  }
35
48
  }
36
49
 
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.44.3",
11
+ "version": "0.44.5",
12
12
  "engines": {
13
13
  "node": ">=14.18"
14
14
  },
@@ -22,9 +22,9 @@
22
22
  "@vates/async-each": "^1.0.0",
23
23
  "@vates/cached-dns.lookup": "^1.0.0",
24
24
  "@vates/compose": "^2.1.0",
25
- "@vates/decorate-with": "^2.0.0",
25
+ "@vates/decorate-with": "^2.1.0",
26
26
  "@vates/disposable": "^0.1.5",
27
- "@vates/fuse-vhd": "^2.0.0",
27
+ "@vates/fuse-vhd": "^2.1.0",
28
28
  "@vates/nbd-client": "^3.0.0",
29
29
  "@vates/parse-duration": "^0.1.1",
30
30
  "@xen-orchestra/async-map": "^0.1.2",
@@ -44,8 +44,8 @@
44
44
  "proper-lockfile": "^4.1.2",
45
45
  "tar": "^6.1.15",
46
46
  "uuid": "^9.0.0",
47
- "vhd-lib": "^4.8.0",
48
- "xen-api": "^2.0.0",
47
+ "vhd-lib": "^4.9.0",
48
+ "xen-api": "^2.0.1",
49
49
  "yazl": "^2.5.1"
50
50
  },
51
51
  "devDependencies": {
@@ -56,7 +56,7 @@
56
56
  "tmp": "^0.2.1"
57
57
  },
58
58
  "peerDependencies": {
59
- "@xen-orchestra/xapi": "^4.1.0"
59
+ "@xen-orchestra/xapi": "^4.2.0"
60
60
  },
61
61
  "license": "AGPL-3.0-or-later",
62
62
  "author": {