@xen-orchestra/backups 0.69.2 → 0.69.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.
@@ -310,6 +310,7 @@ export const AbstractXapi = class AbstractXapiVmBackupRunner extends Abstract {
310
310
  // if not => remove it from the list to ensure we won't half destroy VM later
311
311
  vm.$VBDs
312
312
  .filter(({ $VDI }) => !!$VDI) // filter missing keys
313
+ .filter(({ $VDI }) => $VDI.$snapshot_of !== undefined) // skip non-snapshot VDIs (e.g., ISOs/CD-ROMs)
313
314
  .filter(({ $VDI }) => $VDI && vdiCandidates[$VDI.uuid] === undefined)
314
315
  .forEach(({ $VDI: outOfSnapshotsVdi, ...other }) => {
315
316
  warn(
@@ -190,6 +190,7 @@ export class MergeRemoteDisk {
190
190
  */
191
191
  async #step_mergeBlocks(parentDisk, childDisk) {
192
192
  const getMaxBlockCount = childDisk.getMaxBlockCount()
193
+ await parentDisk.resize(getMaxBlockCount)
193
194
 
194
195
  if (this.#isResuming) {
195
196
  const alreadyMergedBlocks = []
@@ -72,11 +72,10 @@ export class RemoteDisk extends RandomAccessDisk {
72
72
  }
73
73
 
74
74
  /**
75
- * Abstract
76
75
  * @returns {number} getMaxBlockCount
77
76
  */
78
77
  getMaxBlockCount() {
79
- throw new Error(`getMaxBlockCount must be implemented`)
78
+ return Math.ceil(this.getVirtualSize() / this.getBlockSize())
80
79
  }
81
80
 
82
81
  /**
@@ -148,6 +147,15 @@ export class RemoteDisk extends RandomAccessDisk {
148
147
  throw new Error(`setAllocatedBlocks must be implemented`)
149
148
  }
150
149
 
150
+ /**
151
+ * Abstract
152
+ * @param {number} blockCount
153
+ * @returns {Promise<void>}
154
+ */
155
+ async resize(blockCount) {
156
+ throw new Error(`resize must be implemented`)
157
+ }
158
+
151
159
  /**
152
160
  * Abstract
153
161
  * @param {RemoteDisk} childDisk
@@ -165,17 +165,6 @@ export class RemoteVhdDisk extends RemoteDisk {
165
165
  return await this.isDirectory()
166
166
  }
167
167
 
168
- /**
169
- * @returns {number} getMaxBlockCount
170
- */
171
- getMaxBlockCount() {
172
- if (this.#vhd === undefined) {
173
- throw new Error(`can't call getMaxBlockCount of a RemoteVhdDisk before init`)
174
- }
175
-
176
- return this.#vhd.header.maxTableEntries
177
- }
178
-
179
168
  /**
180
169
  * Checks if the VHD contains a specific block.
181
170
  * @param {number} index
@@ -327,6 +316,20 @@ export class RemoteVhdDisk extends RemoteDisk {
327
316
  }
328
317
  }
329
318
 
319
+ /**
320
+ * Ensure that the disk can handle at least the new block count.
321
+ * @param {number} blockCount
322
+ * @returns {Promise<void>}
323
+ */
324
+ async resize(blockCount) {
325
+ if (this.#vhd === undefined) {
326
+ throw new Error(`can't call resize of a RemoteVhdDisk before init`)
327
+ }
328
+
329
+ // Checks that the BAT is at least as big as the provided block count, if not, increases it and shift the blocks position
330
+ await this.#vhd.ensureBatSize(blockCount)
331
+ }
332
+
330
333
  /**
331
334
  * Writes Block Allocation Table
332
335
  * @param {RemoteDisk} childDisk
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.69.2",
11
+ "version": "0.69.4",
12
12
  "engines": {
13
13
  "node": ">=14.18"
14
14
  },