fix(vhd-lib/VhdAbtract#stream): explicitely ignore differencing
Because parentLocator entries handling are broken.
This commit is contained in:
parent
ff806a3ff9
commit
26d0ff3c9a
@ -15,6 +15,7 @@
|
||||
- [Delta Backup Restoration] `TypeError: this disposable has already been disposed` [Forum #5257](https://xcp-ng.org/forum/topic/5257/problems-building-from-source/20)
|
||||
- [Tables/actions] Fix collapsed actions being clickable despite being disabled (PR [#6023](https://github.com/vatesfr/xen-orchestra/pull/6023))
|
||||
- [Backups] Fix: `Error: Chaining alias is forbidden xo-vm-backups/..alias.vhd to xo-vm-backups/....alias.vhd` when backuping a file to s3 [Forum #5226](https://xcp-ng.org/forum/topic/5256/s3-backup-try-it)
|
||||
- [Delta Backup Restoration] `VDI_IO_ERROR(Device I/O errors)` [Forum #5727](https://xcp-ng.org/forum/topic/5257/problems-building-from-source/4) (PR [#6031](https://github.com/vatesfr/xen-orchestra/pull/6031))
|
||||
|
||||
### Packages to release
|
||||
|
||||
|
@ -1,5 +1,13 @@
|
||||
import { computeBatSize, computeSectorOfBitmap, computeSectorsPerBlock, sectorsToBytes } from './_utils'
|
||||
import { PLATFORMS, SECTOR_SIZE, PARENT_LOCATOR_ENTRIES, FOOTER_SIZE, HEADER_SIZE, BLOCK_UNUSED } from '../_constants'
|
||||
import {
|
||||
DISK_TYPES,
|
||||
PLATFORMS,
|
||||
SECTOR_SIZE,
|
||||
PARENT_LOCATOR_ENTRIES,
|
||||
FOOTER_SIZE,
|
||||
HEADER_SIZE,
|
||||
BLOCK_UNUSED,
|
||||
} from '../_constants'
|
||||
import assert from 'assert'
|
||||
import path from 'path'
|
||||
import asyncIteratorToStream from 'async-iterator-to-stream'
|
||||
@ -217,24 +225,18 @@ export class VhdAbstract {
|
||||
}
|
||||
|
||||
stream() {
|
||||
// TODO: support DIFFERENCING (i.e. parentLocator entries)
|
||||
assert.strictEqual(this.footer.diskType, DISK_TYPES.DYNAMIC)
|
||||
|
||||
const { footer, batSize } = this
|
||||
const { ...header } = this.header // copy since we don't ant to modifiy the current header
|
||||
const rawFooter = fuFooter.pack(footer)
|
||||
checksumStruct(rawFooter, fuFooter)
|
||||
|
||||
// compute parent locator place and size
|
||||
// update them in header
|
||||
// update checksum in header
|
||||
|
||||
let offset = FOOTER_SIZE + HEADER_SIZE + batSize
|
||||
for (let i = 0; i < PARENT_LOCATOR_ENTRIES; i++) {
|
||||
const { ...entry } = header.parentLocatorEntry[i]
|
||||
if (entry.platformDataSpace > 0) {
|
||||
entry.platformDataOffset = offset
|
||||
offset += entry.platformDataSpace
|
||||
}
|
||||
header.parentLocatorEntry[i] = entry
|
||||
}
|
||||
const offset = FOOTER_SIZE + HEADER_SIZE + batSize
|
||||
|
||||
const rawHeader = fuHeader.pack(header)
|
||||
checksumStruct(rawHeader, fuHeader)
|
||||
@ -262,15 +264,6 @@ export class VhdAbstract {
|
||||
yield rawHeader
|
||||
yield bat
|
||||
|
||||
// yield parent locator entries
|
||||
for (let i = 0; i < PARENT_LOCATOR_ENTRIES; i++) {
|
||||
if (header.parentLocatorEntry[i].platformDataSpace > 0) {
|
||||
const parentLocator = await self.readParentLocator(i)
|
||||
// @ todo pad to platformDataSpace
|
||||
yield parentLocator.data
|
||||
}
|
||||
}
|
||||
|
||||
// yield all blocks
|
||||
// since contains() can be costly for synthetic vhd, use the computed bat
|
||||
for (let i = 0; i < header.maxTableEntries; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user