@xen-orchestra/backups 0.48.0 → 0.49.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.
@@ -240,6 +240,26 @@ export const AbstractXapi = class AbstractXapiVmBackupRunner extends Abstract {
240
240
  })
241
241
  }, 'writer.beforeBackup()')
242
242
 
243
+ const vm = this._vm
244
+
245
+ // block migration during the backup on the VM itself, not the latest snapshot
246
+ {
247
+ const { pool_migrate, migrate_send } = vm.blocked_operations
248
+
249
+ const reason = 'VM migration is blocked during backup'
250
+ await vm.update_blocked_operations({ pool_migrate: reason, migrate_send: reason })
251
+
252
+ $defer(() =>
253
+ // delete the entries if they did not exist previously or if they were
254
+ // equal to reason (which happen if a previous backup was interrupted
255
+ // before resetting them)
256
+ vm.update_blocked_operations({
257
+ migrate_send: migrate_send === undefined || migrate_send === reason ? null : migrate_send,
258
+ pool_migrate: pool_migrate === undefined || pool_migrate === reason ? null : pool_migrate,
259
+ })
260
+ )
261
+ }
262
+
243
263
  await this._fetchJobSnapshots()
244
264
 
245
265
  await this._selectBaseVm()
@@ -247,7 +267,6 @@ export const AbstractXapi = class AbstractXapiVmBackupRunner extends Abstract {
247
267
  await this._cleanMetadata()
248
268
  await this._removeUnusedSnapshots()
249
269
 
250
- const vm = this._vm
251
270
  const isRunning = vm.power_state === 'Running'
252
271
  const startAfter = isRunning && (settings.offlineBackup ? 'backup' : settings.offlineSnapshot && 'snapshot')
253
272
  if (startAfter) {
@@ -261,15 +280,7 @@ export const AbstractXapi = class AbstractXapiVmBackupRunner extends Abstract {
261
280
  }
262
281
 
263
282
  if (this._writers.size !== 0) {
264
- const { pool_migrate = null, migrate_send = null } = this._exportedVm.blocked_operations
265
-
266
- const reason = 'VM migration is blocked during backup'
267
- await this._exportedVm.update_blocked_operations({ pool_migrate: reason, migrate_send: reason })
268
- try {
269
- await this._copy()
270
- } finally {
271
- await this._exportedVm.update_blocked_operations({ pool_migrate, migrate_send })
272
- }
283
+ await this._copy()
273
284
  }
274
285
  } finally {
275
286
  if (startAfter) {
@@ -1,4 +1,3 @@
1
- import { extractOpaqueRef } from '@xen-orchestra/xapi'
2
1
  import assert from 'node:assert/strict'
3
2
 
4
3
  import { HealthCheckVmBackup } from '../../HealthCheckVmBackup.mjs'
@@ -49,23 +48,18 @@ export const MixinXapiWriter = (BaseClass = Object) =>
49
48
  if (await this.#isAlreadyOnHealthCheckSr(baseVm)) {
50
49
  healthCheckVmRef = await Task.run(
51
50
  { name: 'cloning-vm' },
52
- async () =>
53
- await xapi
54
- .callAsync('VM.clone', this._targetVmRef, `Health Check - ${baseVm.name_label}`)
55
- .then(extractOpaqueRef)
51
+ async () => await xapi.callAsync('VM.clone', this._targetVmRef, `Health Check - ${baseVm.name_label}`)
56
52
  )
57
53
  } else {
58
54
  healthCheckVmRef = await Task.run(
59
55
  { name: 'copying-vm' },
60
56
  async () =>
61
- await xapi
62
- .callAsync(
63
- 'VM.copy',
64
- this._targetVmRef,
65
- `Health Check - ${baseVm.name_label}`,
66
- this._healthCheckSr.$ref
67
- )
68
- .then(extractOpaqueRef)
57
+ await xapi.callAsync(
58
+ 'VM.copy',
59
+ this._targetVmRef,
60
+ `Health Check - ${baseVm.name_label}`,
61
+ this._healthCheckSr.$ref
62
+ )
69
63
  )
70
64
  }
71
65
  const healthCheckVm =
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.48.0",
11
+ "version": "0.49.0",
12
12
  "engines": {
13
13
  "node": ">=14.18"
14
14
  },
@@ -25,19 +25,19 @@
25
25
  "@vates/decorate-with": "^2.1.0",
26
26
  "@vates/disposable": "^0.1.5",
27
27
  "@vates/fuse-vhd": "^2.1.0",
28
- "@vates/nbd-client": "^3.0.1",
28
+ "@vates/nbd-client": "^3.0.2",
29
29
  "@vates/parse-duration": "^0.1.1",
30
30
  "@xen-orchestra/async-map": "^0.1.2",
31
- "@xen-orchestra/fs": "^4.1.6",
31
+ "@xen-orchestra/fs": "^4.1.7",
32
32
  "@xen-orchestra/log": "^0.6.0",
33
33
  "@xen-orchestra/template": "^0.1.0",
34
- "app-conf": "^2.3.0",
34
+ "app-conf": "^3.0.0",
35
35
  "compare-versions": "^6.0.0",
36
36
  "d3-time-format": "^4.1.0",
37
37
  "decorator-synchronized": "^0.6.0",
38
38
  "golike-defer": "^0.5.1",
39
39
  "human-format": "^1.2.0",
40
- "limit-concurrency-decorator": "^0.5.0",
40
+ "limit-concurrency-decorator": "^0.6.0",
41
41
  "lodash": "^4.17.20",
42
42
  "ms": "^2.1.3",
43
43
  "node-zone": "^0.4.0",
@@ -47,18 +47,18 @@
47
47
  "tar": "^6.1.15",
48
48
  "uuid": "^9.0.0",
49
49
  "vhd-lib": "^4.9.2",
50
- "xen-api": "^3.0.0",
50
+ "xen-api": "^4.0.0",
51
51
  "yazl": "^2.5.1"
52
52
  },
53
53
  "devDependencies": {
54
54
  "fs-extra": "^11.1.0",
55
55
  "rimraf": "^5.0.1",
56
- "sinon": "^17.0.1",
56
+ "sinon": "^18.0.0",
57
57
  "test": "^3.2.1",
58
58
  "tmp": "^0.2.1"
59
59
  },
60
60
  "peerDependencies": {
61
- "@xen-orchestra/xapi": "^5.0.1"
61
+ "@xen-orchestra/xapi": "^6.0.0"
62
62
  },
63
63
  "license": "AGPL-3.0-or-later",
64
64
  "author": {