@xen-orchestra/backups 0.47.0 → 0.48.1

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.
@@ -19,6 +19,7 @@ const DEFAULT_REMOTE_VM_SETTINGS = {
19
19
  exportRetention: 0,
20
20
  healthCheckSr: undefined,
21
21
  healthCheckVmsWithTags: [],
22
+ healthCheckTimeout: '10m',
22
23
  maxExportRate: 0,
23
24
  maxMergedDeltasPerRun: Infinity,
24
25
  nRetriesVmBackupFailures: 0,
@@ -24,6 +24,7 @@ const DEFAULT_XAPI_VM_SETTINGS = {
24
24
  fullInterval: 0,
25
25
  healthCheckSr: undefined,
26
26
  healthCheckVmsWithTags: [],
27
+ healthCheckTimeout: '10m',
27
28
  maxExportRate: 0,
28
29
  maxMergedDeltasPerRun: Infinity,
29
30
  nRetriesVmBackupFailures: 0,
@@ -240,6 +240,18 @@ 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 = null, migrate_send = null } = 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(() => vm.update_blocked_operations({ pool_migrate, migrate_send }))
253
+ }
254
+
243
255
  await this._fetchJobSnapshots()
244
256
 
245
257
  await this._selectBaseVm()
@@ -247,7 +259,6 @@ export const AbstractXapi = class AbstractXapiVmBackupRunner extends Abstract {
247
259
  await this._cleanMetadata()
248
260
  await this._removeUnusedSnapshots()
249
261
 
250
- const vm = this._vm
251
262
  const isRunning = vm.power_state === 'Running'
252
263
  const startAfter = isRunning && (settings.offlineBackup ? 'backup' : settings.offlineSnapshot && 'snapshot')
253
264
  if (startAfter) {
@@ -261,15 +272,7 @@ export const AbstractXapi = class AbstractXapiVmBackupRunner extends Abstract {
261
272
  }
262
273
 
263
274
  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
- }
275
+ await this._copy()
273
276
  }
274
277
  } finally {
275
278
  if (startAfter) {
@@ -8,6 +8,7 @@ import { HealthCheckVmBackup } from '../../HealthCheckVmBackup.mjs'
8
8
  import { ImportVmBackup } from '../../ImportVmBackup.mjs'
9
9
  import { Task } from '../../Task.mjs'
10
10
  import * as MergeWorker from '../../merge-worker/index.mjs'
11
+ import ms from 'ms'
11
12
 
12
13
  const { info, warn } = createLogger('xo:backups:MixinBackupWriter')
13
14
 
@@ -107,8 +108,10 @@ export const MixinRemoteWriter = (BaseClass = Object) =>
107
108
  restoredVm = await xapi.waitObject(restoredId)
108
109
  }
109
110
  try {
111
+ const timeout = ms(this._settings.healthCheckTimeout)
110
112
  await new HealthCheckVmBackup({
111
113
  restoredVm,
114
+ timeout,
112
115
  xapi,
113
116
  }).run()
114
117
  } finally {
@@ -3,6 +3,7 @@ import assert from 'node:assert/strict'
3
3
 
4
4
  import { HealthCheckVmBackup } from '../../HealthCheckVmBackup.mjs'
5
5
  import { Task } from '../../Task.mjs'
6
+ import ms from 'ms'
6
7
 
7
8
  export const MixinXapiWriter = (BaseClass = Object) =>
8
9
  class MixinXapiWriter extends BaseClass {
@@ -70,8 +71,10 @@ export const MixinXapiWriter = (BaseClass = Object) =>
70
71
  const healthCheckVm =
71
72
  xapi.getObject(healthCheckVmRef, undefined) ?? (await xapi.waitObject(healthCheckVmRef))
72
73
  await healthCheckVm.add_tags('xo:no-bak=Health Check')
74
+ const timeout = ms(this._settings.healthCheckTimeout)
73
75
  await new HealthCheckVmBackup({
74
76
  restoredVm: healthCheckVm,
77
+ timeout,
75
78
  xapi,
76
79
  }).run()
77
80
  } finally {
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.47.0",
11
+ "version": "0.48.1",
12
12
  "engines": {
13
13
  "node": ">=14.18"
14
14
  },
@@ -47,7 +47,7 @@
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": "^3.0.1",
51
51
  "yazl": "^2.5.1"
52
52
  },
53
53
  "devDependencies": {
@@ -58,7 +58,7 @@
58
58
  "tmp": "^0.2.1"
59
59
  },
60
60
  "peerDependencies": {
61
- "@xen-orchestra/xapi": "^5.0.0"
61
+ "@xen-orchestra/xapi": "^5.0.1"
62
62
  },
63
63
  "license": "AGPL-3.0-or-later",
64
64
  "author": {