Files
Xen-Orchestra-xen-orchestra…/@xen-orchestra/vmware-explorer/DatastoreXoRemote.mjs
Florent Beauchamp 3939c4f021 feat(vmware-explorer): Use NFS datastore from XO Remote to bypass VMFS6 lock
- Migrate VM to NFS on VMWare side
- mount NFS in XO , named [VMWARE]{datastoreName}
- launch import and it will read through the direct NFS instead of using the soap access layer
2024-03-28 10:10:31 +01:00

23 lines
698 B
JavaScript

import assert from 'node:assert'
import { Datastore } from './_Datastore.mjs'
export const DatastoreXoRemote = class DatastoreXoRemote extends Datastore {
#handler
constructor(datastoreName, { handler, ...otherOptions }) {
super(datastoreName, otherOptions)
this.#handler = handler
}
async getStream(path, start, end) {
return this.#handler.createReadStream(path, { start, end })
}
async getBuffer(path, start, end) {
const buffer = Buffer.alloc(end - start)
const { bytesRead } = await this.#handler.read(path, buffer, start)
assert.strictEqual(bytesRead, end - start)
return buffer
}
async getSize(path) {
return this.#handler.getSize(path)
}
}