@xen-orchestra/backups 0.58.2 → 0.58.4

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.
@@ -257,7 +257,14 @@ export class ImportVmBackup {
257
257
  : await importIncrementalVm(backup, await xapi.getRecord('SR', srRef), {
258
258
  newMacAddresses,
259
259
  })
260
-
260
+ const remoteName = adapter._handler._remote.name
261
+ let desc = `Restored on ${formatFilenameDate(+new Date())}`
262
+ if (remoteName !== undefined) {
263
+ desc += ` from ${remoteName}`
264
+ }
265
+ if (metadata.vm.name_description) {
266
+ desc += ` - ${metadata.vm.name_description}`
267
+ }
261
268
  await Promise.all([
262
269
  xapi.call('VM.add_tags', vmRef, 'restored from backup'),
263
270
  xapi.call(
@@ -265,13 +272,7 @@ export class ImportVmBackup {
265
272
  vmRef,
266
273
  `${metadata.vm.name_label} (${formatFilenameDate(metadata.timestamp)})`
267
274
  ),
268
- xapi.call(
269
- 'VM.set_name_description',
270
- vmRef,
271
- `Restored on ${formatFilenameDate(+new Date())} from ${adapter._handler._remote.name} -
272
- ${metadata.vm.name_description}
273
- `
274
- ),
275
+ xapi.call('VM.set_name_description', vmRef, desc),
275
276
  ])
276
277
 
277
278
  return {
package/_cleanVm.mjs CHANGED
@@ -129,9 +129,27 @@ export async function checkAliases(
129
129
  logWarn('missing target of alias', { alias })
130
130
  if (remove) {
131
131
  logInfo('removing alias and non VHD target', { alias, target })
132
- await handler.unlink(target)
133
132
  await handler.unlink(alias)
134
133
  }
134
+ continue
135
+ }
136
+ if (err.code === 'EISDIR') {
137
+ logWarn('alias is a vhd directory', { alias })
138
+ if (remove) {
139
+ logInfo('removing vhd directory named as alias', { alias, target })
140
+ await VhdAbstract.unlink(handler, alias)
141
+ }
142
+ continue
143
+ }
144
+ logWarn('unhandled error while checking alias', { alias, err })
145
+ continue
146
+ }
147
+
148
+ if (target === '') {
149
+ logWarn('empty target for alias ', { alias })
150
+ if (remove) {
151
+ logInfo('removing alias and non VHD target', { alias, target })
152
+ await handler.unlink(alias)
135
153
  }
136
154
  continue
137
155
  }
@@ -11,7 +11,6 @@ import { MixinXapiWriter } from './_MixinXapiWriter.mjs'
11
11
  import { listReplicatedVms } from './_listReplicatedVms.mjs'
12
12
  import { COPY_OF, setVmOtherConfig, BASE_DELTA_VDI } from '../../_otherConfig.mjs'
13
13
 
14
- import assert from 'node:assert'
15
14
  export class IncrementalXapiWriter extends MixinXapiWriter(AbstractIncrementalWriter) {
16
15
  async checkBaseVdis(baseUuidToSrcVdi) {
17
16
  const sr = this._sr
@@ -118,9 +117,10 @@ export class IncrementalXapiWriter extends MixinXapiWriter(AbstractIncrementalWr
118
117
  const baseReplicatedTo = replicatedVdis.find(
119
118
  replicatedVdi => replicatedVdi.other_config[COPY_OF] === vdi.other_config[BASE_DELTA_VDI]
120
119
  )
121
- assert.notStrictEqual(baseReplicatedTo, undefined)
120
+ // baseReplicatedTo can be undefined if a new disk is added and other are already replicated
122
121
  vdi.baseVdi = baseReplicatedTo
123
122
  } else {
123
+ // first replication of this disk
124
124
  vdi.baseVdi = undefined
125
125
  }
126
126
  // ensure the VDI are created on the target SR
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.58.2",
11
+ "version": "0.58.4",
12
12
  "engines": {
13
13
  "node": ">=14.18"
14
14
  },
@@ -28,7 +28,7 @@
28
28
  "@vates/nbd-client": "^3.1.2",
29
29
  "@vates/parse-duration": "^0.1.1",
30
30
  "@xen-orchestra/async-map": "^0.1.2",
31
- "@xen-orchestra/fs": "^4.4.0",
31
+ "@xen-orchestra/fs": "^4.4.1",
32
32
  "@xen-orchestra/log": "^0.7.1",
33
33
  "@xen-orchestra/template": "^0.1.0",
34
34
  "app-conf": "^3.0.0",
@@ -48,8 +48,8 @@
48
48
  "tar": "^6.1.15",
49
49
  "uuid": "^9.0.0",
50
50
  "value-matcher": "^0.2.0",
51
- "vhd-lib": "^4.11.2",
52
- "xen-api": "^4.7.0",
51
+ "vhd-lib": "^4.11.3",
52
+ "xen-api": "^4.7.1",
53
53
  "yazl": "^2.5.1"
54
54
  },
55
55
  "devDependencies": {
@@ -59,7 +59,7 @@
59
59
  "tmp": "^0.2.1"
60
60
  },
61
61
  "peerDependencies": {
62
- "@xen-orchestra/xapi": "^8.0.0"
62
+ "@xen-orchestra/xapi": "^8.1.1"
63
63
  },
64
64
  "license": "AGPL-3.0-or-later",
65
65
  "author": {