@xen-orchestra/rest-api 0.28.0 → 0.28.2

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.
@@ -6,7 +6,10 @@ export class BackupLogService {
6
6
  return log.tasks?.find(task => task.data?.id === vmId);
7
7
  }
8
8
  isVmInBackupLog(log, vmId) {
9
- const vmIds = (log.infos?.find(info => info.message === 'vms')?.data).vms ?? [];
10
- return vmIds.includes(vmId);
9
+ const backupLogInfos = log.infos?.find(info => info.message === 'vms')?.data;
10
+ if (backupLogInfos?.vms === undefined) {
11
+ return false;
12
+ }
13
+ return backupLogInfos.vms.includes(vmId);
11
14
  }
12
15
  }
@@ -104,13 +104,18 @@ export class VmService {
104
104
  }
105
105
  getVmVdis(id, vmType) {
106
106
  const getObject = this.#restApi.getObject.bind(this.#restApi);
107
+ const vdiType = vmType === 'VM-snapshot' ? 'VDI-snapshot' : 'VDI';
107
108
  const vdis = [];
108
109
  const vm = getObject(id, vmType);
109
110
  for (const vbdId of vm.$VBDs) {
110
111
  const vbd = getObject(vbdId, 'VBD');
111
112
  if (vbd.VDI !== undefined) {
112
- const vdi = getObject(vbd.VDI, [vmType === 'VM-snapshot' ? 'VDI-snapshot' : 'VDI']);
113
- vdis.push(vdi);
113
+ // Search for all VDI types, then push only the VDIs associated with the VM type.
114
+ // This avoids the "no such VDI ..." error if the VM has faulty VDIs. (is_snapshot:false, $snapshot_of: <vdiId>)
115
+ const vdi = getObject(vbd.VDI, ['VDI-snapshot', 'VDI']);
116
+ if (vdi.type === vdiType) {
117
+ vdis.push(vdi);
118
+ }
114
119
  }
115
120
  }
116
121
  return vdis;
@@ -12418,7 +12418,7 @@
12418
12418
  },
12419
12419
  "info": {
12420
12420
  "title": "@xen-orchestra/rest-api",
12421
- "version": "0.28.0",
12421
+ "version": "0.28.2",
12422
12422
  "description": "REST API to manage your XOA",
12423
12423
  "license": {
12424
12424
  "name": "AGPL-3.0-or-later"
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "main": "./dist/index.mjs",
7
7
  "name": "@xen-orchestra/rest-api",
8
8
  "homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/rest-api",
9
- "version": "0.28.0",
9
+ "version": "0.28.2",
10
10
  "description": "REST API to manage your XOA",
11
11
  "license": "AGPL-3.0-or-later",
12
12
  "private": false,
@@ -36,9 +36,9 @@
36
36
  "@vates/async-each": "^1.0.2",
37
37
  "@vates/task": "^0.6.1",
38
38
  "@vates/types": "^1.22.0",
39
- "@xen-orchestra/backups": "^0.70.0",
39
+ "@xen-orchestra/backups": "^0.71.1",
40
40
  "@xen-orchestra/log": "^0.7.1",
41
- "@xen-orchestra/xapi": "^8.6.6",
41
+ "@xen-orchestra/xapi": "^8.7.0",
42
42
  "complex-matcher": "^1.1.0",
43
43
  "golike-defer": "^0.5.1",
44
44
  "inversify": "^6.2.2",