@xen-orchestra/backups 0.73.3 → 0.73.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.
@@ -101,10 +101,14 @@ export const VmsXapi = class VmsXapiBackupRunner extends Abstract {
101
101
 
102
102
  const handleVm = vmUuid => {
103
103
  const getVmTask = () => {
104
- if (taskByVmId[vmUuid] === undefined) {
104
+ const started = taskByVmId[vmUuid] !== undefined
105
+ if (!started) {
105
106
  taskByVmId[vmUuid] = new Task(taskStart)
106
107
  }
107
- return taskByVmId[vmUuid]
108
+ return {
109
+ task: taskByVmId[vmUuid],
110
+ started,
111
+ }
108
112
  }
109
113
  const vmBackupFailed = async (error, task) => {
110
114
  if (isLastRun) {
@@ -135,7 +139,7 @@ export const VmsXapi = class VmsXapiBackupRunner extends Abstract {
135
139
  taskStart.properties.name_label = vm.name_label
136
140
  }
137
141
 
138
- const task = getVmTask()
142
+ const { task } = getVmTask()
139
143
  // error has to be caught in the task to prevent its failure, but handled outside the task to execute another task.run()
140
144
  let taskError
141
145
  return task
@@ -174,12 +178,19 @@ export const VmsXapi = class VmsXapiBackupRunner extends Abstract {
174
178
  task.success(result)
175
179
  } else {
176
180
  // ending the task with error or not ending the task
177
- vmBackupFailed(taskError, task)
181
+ return vmBackupFailed(taskError, task)
178
182
  }
179
183
  })
180
184
  .catch(noop) // errors are handled by logs
181
185
  }),
182
- error => vmBackupFailed(error, getVmTask())
186
+ error => {
187
+ const { task: vmTask, started } = getVmTask()
188
+ if (!started) {
189
+ // the task is not started (except if it's a retry), and an unstarted task can't be failed
190
+ vmTask.start()
191
+ }
192
+ return vmBackupFailed(error, vmTask)
193
+ }
183
194
  )
184
195
  }
185
196
  const { concurrency } = settings
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.73.3",
11
+ "version": "0.73.4",
12
12
  "engines": {
13
13
  "node": ">=14.18"
14
14
  },