@xen-orchestra/backups 0.58.2 → 0.58.3

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
  }
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.3",
12
12
  "engines": {
13
13
  "node": ">=14.18"
14
14
  },
@@ -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.0"
63
63
  },
64
64
  "license": "AGPL-3.0-or-later",
65
65
  "author": {