Compare commits

...

37 Commits

Author SHA1 Message Date
florent Beauchamp
a15428ac88 fix(@xen-orchestra/vmware-explorer): cleanup 2023-02-07 10:54:28 +01:00
ggunullu
85a23c68f2 remove ignore-pattern for vmware-explorer 2023-02-07 10:42:56 +01:00
ggunullu
c16c1f8eb9 remove checkFile from util.js 2023-02-07 10:42:56 +01:00
ggunullu
8af95b41fd test 2023-02-07 10:42:56 +01:00
ggunullu
d0e3603663 upgrade node version in package 2023-02-07 10:42:56 +01:00
ggunullu
2e755ec083 test 2023-02-07 10:42:56 +01:00
ggunullu
724195d66d use unlink and move test file 2023-02-07 10:42:56 +01:00
ggunullu
b132ff4fd0 remove unused test 2023-02-07 10:42:56 +01:00
ggunullu
6f1054e2d1 remove ignore-pattern on vmware-explorer 2023-02-07 10:42:56 +01:00
ggunullu
60c59a0529 test 2023-02-07 10:42:56 +01:00
ggunullu
d382f262fd change file to remove 2023-02-07 10:42:56 +01:00
ggunullu
f6baef3bd6 test 2023-02-07 10:42:56 +01:00
ggunullu
4a27fd35bf remove ignore-pattern on vmware-explorer 2023-02-07 10:42:56 +01:00
ggunullu
edd37be295 test 2023-02-07 10:42:56 +01:00
ggunullu
e38f00c18b test 2023-02-07 10:42:56 +01:00
ggunullu
24b08037f9 test 2023-02-07 10:42:56 +01:00
ggunullu
1d9bc390bb test 2023-02-07 10:42:56 +01:00
ggunullu
44ba19990e test 2023-02-07 10:42:56 +01:00
ggunullu
5571a1c262 test 2023-02-07 10:42:56 +01:00
ggunullu
9617241b6d test 2023-02-07 10:42:56 +01:00
ggunullu
4b5eadcf88 test 2023-02-07 10:42:56 +01:00
ggunullu
c76295e5c9 test 2023-02-07 10:42:56 +01:00
ggunullu
b61ab4c79a test 2023-02-07 10:42:56 +01:00
ggunullu
2d01192204 Test 2023-02-07 10:42:56 +01:00
ggunullu
eb6763b0bb test 2023-02-07 10:42:56 +01:00
ggunullu
2bb935e9ca test 2023-02-07 10:42:56 +01:00
ggunullu
1e72e9d749 test 2023-02-07 10:42:56 +01:00
ggunullu
59700834cc test 2023-02-07 10:42:56 +01:00
ggunullu
95d6ed0376 test 2023-02-07 10:42:56 +01:00
ggunullu
5dfc8b2e0a test 2023-02-07 10:42:56 +01:00
ggunullu
6961361cf8 test 2023-02-07 10:42:56 +01:00
ggunullu
c105057b91 test 2023-02-07 10:42:56 +01:00
ggunullu
29b20753e9 test 2023-02-07 10:42:56 +01:00
ggunullu
f0b93dc7fe test 2023-02-07 10:42:56 +01:00
ggunullu
dd2b054b35 set back vmware-explorer test 2023-02-07 10:42:56 +01:00
ggunullu
bc09387f5e ignore vmware-explorer 2023-02-07 10:42:56 +01:00
ggunullu
6e8e725a94 chore(test): remove vhd-util check 2023-02-07 10:42:56 +01:00
4 changed files with 28 additions and 4 deletions

View File

@@ -4,6 +4,9 @@ import { FOOTER_SIZE } from 'vhd-lib/_constants.js'
import { notEqual, strictEqual } from 'node:assert'
import { unpackFooter, unpackHeader } from 'vhd-lib/Vhd/_utils.js'
import { VhdAbstract } from 'vhd-lib'
import { createLogger } from '@xen-orchestra/log'
const { debug } = createLogger('xen-orchestra:vmware-explorer:vhdesxisesparse')
// from https://github.com/qemu/qemu/commit/98eb9733f4cf2eeab6d12db7e758665d2fd5367b#
@@ -88,6 +91,9 @@ export default class VhdEsxiSeSparse extends VhdAbstract {
async readHeaderAndFooter() {
const buffer = await this.#read(0, 2048)
strictEqual(buffer.readBigInt64LE(0), 0xcafebaben)
for (let i = 0; i < 2048 / 8; i++) {
debug(i, '> ', buffer.readBigInt64LE(8 * i).toString(16), buffer.readBigInt64LE(8 * i))
}
strictEqual(readInt64(buffer, 1), 0x200000001) // version 2.1
@@ -98,6 +104,14 @@ export default class VhdEsxiSeSparse extends VhdAbstract {
const grain_tables_size = readInt64(buffer, 19)
this.#grainOffset = readInt64(buffer, 24)
debug({
capacity,
grain_size,
grain_tables_offset,
grain_tables_size,
grainSize: this.#grainSize,
})
this.#grainSize = grain_size * 512 // 8 sectors / 4KB default
this.#grainTableOffset = grain_tables_offset * 512
this.#grainTableSize = grain_tables_size * 512
@@ -112,10 +126,12 @@ export default class VhdEsxiSeSparse extends VhdAbstract {
}
async readBlockAllocationTable() {
debug('READ BLOCK ALLOCATION', this.#grainTableSize)
const CHUNK_SIZE = 64 * 512
strictEqual(this.#grainTableSize % CHUNK_SIZE, 0)
debug(' will read ', this.#grainTableSize / CHUNK_SIZE, 'table')
for (let chunkIndex = 0, grainIndex = 0; chunkIndex < this.#grainTableSize / CHUNK_SIZE; chunkIndex++) {
process.stdin.write('.')
const start = chunkIndex * CHUNK_SIZE + this.#grainTableOffset
@@ -130,11 +146,15 @@ export default class VhdEsxiSeSparse extends VhdAbstract {
break
}
if (entry > 3n) {
const intIndex = +(((entry & 0x0fff000000000000n) >> 48n) | ((entry & 0x0000ffffffffffffn) << 12n))
const pos = intIndex * this.#grainSize + CHUNK_SIZE * chunkIndex + this.#grainOffset
debug({ indexInChunk, grainIndex, intIndex, pos })
this.#grainMap.set(grainIndex)
grainIndex++
}
}
}
debug('found', this.#grainMap.size)
// read grain directory and the grain tables
const nbBlocks = this.header.maxTableEntries

View File

@@ -0,0 +1,5 @@
import Esxi from './esxi.mjs'
import openDeltaVmdkasVhd from './openDeltaVmdkAsVhd.mjs'
import VhdEsxiRaw from './VhdEsxiRaw.mjs'
export { openDeltaVmdkasVhd, Esxi, VhdEsxiRaw }

View File

@@ -4,8 +4,9 @@
"version": "0.0.3",
"name": "@xen-orchestra/vmware-explorer",
"dependencies": {
"@vates/task": "^0.0.1",
"@vates/read-chunk": "^1.0.1",
"@vates/task": "^0.0.1",
"@xen-orchestra/log": "^0.6.0",
"lodash": "^4.17.21",
"node-fetch": "^3.3.0",
"node-vsphere-soap": "^0.0.2-5",

View File

@@ -6,10 +6,8 @@ import { Task } from '@xen-orchestra/mixins/Tasks.mjs'
import { v4 as generateUuid } from 'uuid'
import { VDI_FORMAT_VHD } from '@xen-orchestra/xapi'
import asyncMapSettled from '@xen-orchestra/async-map/legacy.js'
import Esxi from '@xen-orchestra/vmware-explorer/esxi.mjs'
import openDeltaVmdkasVhd from '@xen-orchestra/vmware-explorer/openDeltaVmdkAsVhd.mjs'
import { openDeltaVmdkasVhd, Esxi, VhdEsxiRaw } from '@xen-orchestra/vmware-explorer'
import OTHER_CONFIG_TEMPLATE from '../xapi/other-config-template.mjs'
import VhdEsxiRaw from '@xen-orchestra/vmware-explorer/VhdEsxiRaw.mjs'
export default class MigrateVm {
constructor(app) {