@xen-orchestra/backups 0.69.0 → 0.69.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.
package/_cleanVm.mjs CHANGED
@@ -1,7 +1,6 @@
1
1
  import * as UUID from 'uuid'
2
- import sum from 'lodash/sum.js'
3
2
  import { asyncMap } from '@xen-orchestra/async-map'
4
- import { Constants, openVhd, VhdAbstract, VhdFile } from 'vhd-lib'
3
+ import { Constants, openVhd, VhdAbstract } from 'vhd-lib'
5
4
  import { isVhdAlias, resolveVhdAlias } from 'vhd-lib/aliases.js'
6
5
  import { basename, dirname, resolve } from 'node:path'
7
6
  import { isMetadataFile, isVhdFile, isVhdSumFile, isXvaFile, isXvaSumFile } from './_backupType.mjs'
@@ -16,27 +15,6 @@ import handlerPath from '@xen-orchestra/fs/path'
16
15
 
17
16
  const { DISK_TYPES } = Constants
18
17
 
19
- // checking the size of a vhd directory is costly
20
- // 1 Http Query per 1000 blocks
21
- // we only check size of all the vhd are VhdFiles
22
- function shouldComputeVhdsSize(handler, vhds) {
23
- if (handler.isEncrypted) {
24
- return false
25
- }
26
- return vhds.every(vhd => vhd instanceof VhdFile)
27
- }
28
-
29
- const computeVhdsSize = (handler, vhdPaths) =>
30
- Disposable.use(
31
- vhdPaths.map(vhdPath => openVhd(handler, vhdPath)),
32
- async vhds => {
33
- if (shouldComputeVhdsSize(handler, vhds)) {
34
- const sizes = await asyncMap(vhds, vhd => vhd.getSize())
35
- return sum(sizes)
36
- }
37
- }
38
- )
39
-
40
18
  // chain is [ ancestor, child_1, ..., child_n ]
41
19
  async function _mergeVhdChain(handler, chain, { logInfo, remove, mergeBlockConcurrency }) {
42
20
  logInfo(`merging VHD chain`, { chain })
@@ -580,7 +558,7 @@ export async function cleanVm(
580
558
  let fileSystemSize
581
559
  const mergedSize = metadataWithMergedVhd[metadataPath]
582
560
 
583
- const { mode, size, vhds, xva } = metadata
561
+ const { mode, size, xva } = metadata
584
562
 
585
563
  try {
586
564
  if (mode === 'full') {
@@ -596,21 +574,7 @@ export async function cleanVm(
596
574
  })
597
575
  }
598
576
  } catch (error) {
599
- // can fail with encrypted remote
600
- }
601
- } else if (mode === 'delta') {
602
- // don't warn if the size has changed after a merge
603
- if (mergedSize === undefined) {
604
- const linkedVhds = Object.keys(vhds).map(key => resolve('/', vmDir, vhds[key]))
605
- fileSystemSize = await computeVhdsSize(handler, linkedVhds)
606
- // the size is not computed in some cases (e.g. VhdDirectory)
607
- if (fileSystemSize !== undefined && fileSystemSize !== size) {
608
- logWarn('cleanVm: incorrect backup size in metadata', {
609
- path: metadataPath,
610
- actual: size ?? 'none',
611
- expected: fileSystemSize,
612
- })
613
- }
577
+ // will fail with encrypted remote
614
578
  }
615
579
  }
616
580
  } catch (error) {
@@ -213,7 +213,7 @@ export class MergeRemoteDisk {
213
213
 
214
214
  await this.#mergeBlocks(parentDisk, childDisk)
215
215
  await parentDisk.flushMetadata(childDisk)
216
- parentDisk.mergeMetadata(childDisk)
216
+ await parentDisk.mergeMetadata(childDisk)
217
217
  }
218
218
 
219
219
  /**
@@ -160,6 +160,7 @@ export class RemoteDisk extends RandomAccessDisk {
160
160
  /**
161
161
  * Abstract
162
162
  * @param {RemoteDisk} childDisk
163
+ * @returns {Promise<void>}
163
164
  */
164
165
  mergeMetadata(childDisk) {
165
166
  throw new Error(`mergeMetadata must be implemented`)
@@ -353,6 +353,7 @@ export class RemoteVhdDisk extends RemoteDisk {
353
353
 
354
354
  /**
355
355
  * @param {RemoteVhdDisk} childDisk
356
+ * @returns {Promise<void>}
356
357
  */
357
358
  async mergeMetadata(childDisk) {
358
359
  const childDiskMetadata = childDisk.getMetadata()
@@ -238,6 +238,7 @@ export class RemoteVhdDiskChain extends RemoteDisk {
238
238
 
239
239
  /**
240
240
  * @param {RemoteVhdDisk} childDisk
241
+ * @returns {Promise<void>}
241
242
  */
242
243
  mergeMetadata(childDisk) {
243
244
  throw new Error(`Can't merge metadata on a disk chain`)
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.0",
11
+ "version": "0.69.2",
12
12
  "engines": {
13
13
  "node": ">=14.18"
14
14
  },