@xen-orchestra/backups 0.69.1 → 0.69.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.
- package/disks/MergeRemoteDisk.mjs +2 -1
- package/disks/RemoteDisk.mjs +11 -2
- package/disks/RemoteVhdDisk.mjs +15 -11
- package/disks/RemoteVhdDiskChain.mjs +1 -0
- package/package.json +1 -1
|
@@ -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 = []
|
|
@@ -213,7 +214,7 @@ export class MergeRemoteDisk {
|
|
|
213
214
|
|
|
214
215
|
await this.#mergeBlocks(parentDisk, childDisk)
|
|
215
216
|
await parentDisk.flushMetadata(childDisk)
|
|
216
|
-
parentDisk.mergeMetadata(childDisk)
|
|
217
|
+
await parentDisk.mergeMetadata(childDisk)
|
|
217
218
|
}
|
|
218
219
|
|
|
219
220
|
/**
|
package/disks/RemoteDisk.mjs
CHANGED
|
@@ -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
|
-
|
|
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
|
|
@@ -160,6 +168,7 @@ export class RemoteDisk extends RandomAccessDisk {
|
|
|
160
168
|
/**
|
|
161
169
|
* Abstract
|
|
162
170
|
* @param {RemoteDisk} childDisk
|
|
171
|
+
* @returns {Promise<void>}
|
|
163
172
|
*/
|
|
164
173
|
mergeMetadata(childDisk) {
|
|
165
174
|
throw new Error(`mergeMetadata must be implemented`)
|
package/disks/RemoteVhdDisk.mjs
CHANGED
|
@@ -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
|
|
@@ -353,6 +356,7 @@ export class RemoteVhdDisk extends RemoteDisk {
|
|
|
353
356
|
|
|
354
357
|
/**
|
|
355
358
|
* @param {RemoteVhdDisk} childDisk
|
|
359
|
+
* @returns {Promise<void>}
|
|
356
360
|
*/
|
|
357
361
|
async mergeMetadata(childDisk) {
|
|
358
362
|
const childDiskMetadata = childDisk.getMetadata()
|