fix(vhd-lib): fix geometry computation for more than 2^28 sectors (#3451)

Fixes https://gitlab.com/vates/xoa-support/issues/942
It was a bug in the disk geometry computation.
This commit is contained in:
Nicolas Raynaud 2018-09-25 05:51:17 -07:00 committed by Julien Fontanet
parent b22514646e
commit ac2ab21826
2 changed files with 4 additions and 4 deletions

View File

@ -6,11 +6,14 @@
### Bug fixes
[OVA Import] Allow import of files bigger than 127GB (PR [#3451](https://github.com/vatesfr/xen-orchestra/pull/3451))
[File restore] Fix a path issue when going back to the parent folder (PR [#3446](https://github.com/vatesfr/xen-orchestra/pull/3446))
[File restore] Fix a minor issue when showing which selected files are redundant (PR [#3447](https://github.com/vatesfr/xen-orchestra/pull/3447))
### Released packages
- vhd-lib v0.3.1
- xo-vmdk-to-vhd v0.1.4
- xo-server v5.28.0
- xo-web v5.28.0

View File

@ -1,13 +1,10 @@
import { SECTOR_SIZE } from './_constants'
export default function computeGeometryForSize (size) {
const totalSectors = Math.ceil(size / 512)
const totalSectors = Math.min(Math.ceil(size / 512), 65535 * 16 * 255)
let sectorsPerTrackCylinder
let heads
let cylinderTimesHeads
if (totalSectors > 65535 * 16 * 255) {
throw Error('disk is too big')
}
// straight copypasta from the file spec appendix on CHS Calculation
if (totalSectors >= 65535 * 16 * 63) {
sectorsPerTrackCylinder = 255