Compare commits
37 Commits
vm-backup-
...
cleanup_vm
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a15428ac88 | ||
|
|
85a23c68f2 | ||
|
|
c16c1f8eb9 | ||
|
|
8af95b41fd | ||
|
|
d0e3603663 | ||
|
|
2e755ec083 | ||
|
|
724195d66d | ||
|
|
b132ff4fd0 | ||
|
|
6f1054e2d1 | ||
|
|
60c59a0529 | ||
|
|
d382f262fd | ||
|
|
f6baef3bd6 | ||
|
|
4a27fd35bf | ||
|
|
edd37be295 | ||
|
|
e38f00c18b | ||
|
|
24b08037f9 | ||
|
|
1d9bc390bb | ||
|
|
44ba19990e | ||
|
|
5571a1c262 | ||
|
|
9617241b6d | ||
|
|
4b5eadcf88 | ||
|
|
c76295e5c9 | ||
|
|
b61ab4c79a | ||
|
|
2d01192204 | ||
|
|
eb6763b0bb | ||
|
|
2bb935e9ca | ||
|
|
1e72e9d749 | ||
|
|
59700834cc | ||
|
|
95d6ed0376 | ||
|
|
5dfc8b2e0a | ||
|
|
6961361cf8 | ||
|
|
c105057b91 | ||
|
|
29b20753e9 | ||
|
|
f0b93dc7fe | ||
|
|
dd2b054b35 | ||
|
|
bc09387f5e | ||
|
|
6e8e725a94 |
@@ -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
|
||||
|
||||
5
@xen-orchestra/vmware-explorer/index.mjs
Normal file
5
@xen-orchestra/vmware-explorer/index.mjs
Normal file
@@ -0,0 +1,5 @@
|
||||
import Esxi from './esxi.mjs'
|
||||
import openDeltaVmdkasVhd from './openDeltaVmdkAsVhd.mjs'
|
||||
import VhdEsxiRaw from './VhdEsxiRaw.mjs'
|
||||
|
||||
export { openDeltaVmdkasVhd, Esxi, VhdEsxiRaw }
|
||||
@@ -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",
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user