From ad01fcc880d8784bb6ce2c283c9384a70a152ded Mon Sep 17 00:00:00 2001 From: Julien Fontanet Date: Thu, 31 Jan 2019 10:36:51 +0100 Subject: [PATCH] feat(vhd-lib/Vhd#{_getBatEntry,containsBlock}()): never throw (#3920) Fix xoa-support#1214 Fix `createSyntheticStream` when the disk has been resize in the chain. --- CHANGELOG.md | 2 ++ packages/vhd-lib/src/vhd.js | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e18c8bbaf..0f7e81d69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,9 +31,11 @@ - [VM creation] Broken CloudInit config drive when VM created on local SR - [Legacy Backup] Fix error when restoring a backup - [Home] Fix `user.getAll` error when user is not admin [#3573](https://github.com/vatesfr/xen-orchestra/issues/3573) (PR [#3918](https://github.com/vatesfr/xen-orchestra/pull/3918)) +- [Backup NG] Fix restore issue when a disk has grown (PR [#3920](https://github.com/vatesfr/xen-orchestra/pull/3920)) ### Released packages +- vhd-lib v0.5.6 - xoa-updater v0.15.0 - xen-api v0.24.1 - xo-vmdk-to-vhd v0.1.6 diff --git a/packages/vhd-lib/src/vhd.js b/packages/vhd-lib/src/vhd.js index 4546aa4d4..e0401e61c 100644 --- a/packages/vhd-lib/src/vhd.js +++ b/packages/vhd-lib/src/vhd.js @@ -216,7 +216,9 @@ export default class Vhd { // return the first sector (bitmap) of a block _getBatEntry(block) { - return this.blockTable.readUInt32BE(block * 4) + const i = block * 4 + const { blockTable } = this + return i < blockTable.length ? blockTable.readUInt32BE(i) : BLOCK_UNUSED } _readBlock(blockId, onlyBitmap = false) {