fix(xo-vmdk-to-vhd/grabTables): read each entry independently (#5255)
Reading all entries at once cause problems on some VMDKs (those generated by VirtualBox) because they appear to be distributed throughout the VMDK thus making the buffer not fit in memory. See https://xcp-ng.org/forum/topic/3374/cannot-import-ova-from-virtualbox/14?_=1599689219209
This commit is contained in:
parent
4264e34ffd
commit
14b8cda543
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
> Users must be able to say: “I had this issue, happy to know it's fixed”
|
> Users must be able to say: “I had this issue, happy to know it's fixed”
|
||||||
|
|
||||||
|
- [Import VMDK] Fix `No position specified for vmdisk1` error (PR [#5255](https://github.com/vatesfr/xen-orchestra/pull/5255))
|
||||||
|
|
||||||
### Packages to release
|
### Packages to release
|
||||||
|
|
||||||
> Packages will be released in the order they are here, therefore, they should
|
> Packages will be released in the order they are here, therefore, they should
|
||||||
@ -33,4 +35,5 @@
|
|||||||
>
|
>
|
||||||
> In case of conflict, the highest (lowest in previous list) `$version` wins.
|
> In case of conflict, the highest (lowest in previous list) `$version` wins.
|
||||||
|
|
||||||
|
- xo-vmdk-to-vhd patch
|
||||||
- xo-web minor
|
- xo-web minor
|
||||||
|
@ -50,28 +50,14 @@ async function grabTables(
|
|||||||
fileAccessor
|
fileAccessor
|
||||||
) {
|
) {
|
||||||
const cachedGrainTables = []
|
const cachedGrainTables = []
|
||||||
let grainTableAddresMin = Infinity
|
|
||||||
let grainTableAddressMax = -Infinity
|
|
||||||
for (let i = 0; i < grainDirectoryEntries; i++) {
|
for (let i = 0; i < grainDirectoryEntries; i++) {
|
||||||
const grainTableAddr = grainDir[i] * SECTOR_SIZE
|
const grainTableAddr = grainDir[i] * SECTOR_SIZE
|
||||||
if (grainTableAddr !== 0) {
|
if (grainTableAddr !== 0) {
|
||||||
grainTableAddresMin = Math.min(grainTableAddresMin, grainTableAddr)
|
|
||||||
grainTableAddressMax = Math.max(
|
|
||||||
grainTableAddressMax,
|
|
||||||
grainTableAddr + grainTablePhysicalSize
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const grainTableBuffer = await fileAccessor(
|
|
||||||
grainTableAddresMin,
|
|
||||||
grainTableAddressMax
|
|
||||||
)
|
|
||||||
for (let i = 0; i < grainDirectoryEntries; i++) {
|
|
||||||
const grainTableAddr = grainDir[i] * SECTOR_SIZE
|
|
||||||
if (grainTableAddr !== 0) {
|
|
||||||
const addr = grainTableAddr - grainTableAddresMin
|
|
||||||
cachedGrainTables[i] = new Uint32Array(
|
cachedGrainTables[i] = new Uint32Array(
|
||||||
grainTableBuffer.slice(addr, addr + grainTablePhysicalSize)
|
await fileAccessor(
|
||||||
|
grainTableAddr,
|
||||||
|
grainTableAddr + grainTablePhysicalSize
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user