mirror of
https://github.com/vatesfr/xen-orchestra.git
synced 2026-11-09 17:06:13 -06:00
14 lines
392 B
JavaScript
14 lines
392 B
JavaScript
import fromCallback from 'promise-toolbox/fromCallback'
|
|
import { execFile } from 'node:child_process'
|
|
|
|
export async function getCurrentVmUuid() {
|
|
const vm = (await read('vm')).trim()
|
|
const i = vm.lastIndexOf('/')
|
|
if (i === -1) {
|
|
throw new Error('incorrect XenStore VM entry: ' + vm)
|
|
}
|
|
return vm.slice(i + 1)
|
|
}
|
|
|
|
const read = key => fromCallback(execFile, 'xenstore-read', [key])
|