@nosana/node 1.1.84-rc → 1.1.85-rc

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/dist/.env +2 -1
  2. package/dist/package.json +1 -1
  3. package/dist/packages/job-runtime/src/host/HostClient.d.ts +20 -4
  4. package/dist/packages/job-runtime/src/host/HostClient.js +35 -2
  5. package/dist/packages/job-runtime/src/host/contract.d.ts +27 -7
  6. package/dist/packages/job-runtime/src/host/contract.js +43 -7
  7. package/dist/packages/job-runtime/src/runtime/runJob.d.ts +8 -5
  8. package/dist/packages/job-runtime/src/runtime/runJob.js +44 -17
  9. package/dist/packages/vm-orchestrator/src/CidRegistry.d.ts +67 -0
  10. package/dist/packages/vm-orchestrator/src/CidRegistry.js +168 -0
  11. package/dist/packages/vm-orchestrator/src/GpuPool.d.ts +27 -0
  12. package/dist/packages/vm-orchestrator/src/GpuPool.js +41 -0
  13. package/dist/packages/vm-orchestrator/src/Hypervisor.d.ts +66 -0
  14. package/dist/packages/vm-orchestrator/src/Hypervisor.js +7 -0
  15. package/dist/packages/vm-orchestrator/src/QemuHypervisor.d.ts +62 -0
  16. package/dist/packages/vm-orchestrator/src/QemuHypervisor.js +185 -0
  17. package/dist/packages/vm-orchestrator/src/QemuHypervisorConfig.d.ts +61 -0
  18. package/dist/packages/vm-orchestrator/src/QemuHypervisorConfig.js +37 -0
  19. package/dist/packages/vm-orchestrator/src/QemuVmInstance.d.ts +37 -0
  20. package/dist/packages/vm-orchestrator/src/QemuVmInstance.js +44 -0
  21. package/dist/packages/vm-orchestrator/src/QmpClient.d.ts +43 -0
  22. package/dist/packages/vm-orchestrator/src/QmpClient.js +103 -0
  23. package/dist/packages/vm-orchestrator/src/VmSpec.d.ts +21 -0
  24. package/dist/packages/vm-orchestrator/src/VmSpec.js +30 -0
  25. package/dist/packages/vm-orchestrator/src/VmStateManager.d.ts +16 -0
  26. package/dist/packages/vm-orchestrator/src/VmStateManager.js +30 -0
  27. package/dist/packages/vm-orchestrator/src/bootAttempt.d.ts +31 -0
  28. package/dist/packages/vm-orchestrator/src/bootAttempt.js +193 -0
  29. package/dist/packages/vm-orchestrator/src/bootErrors.d.ts +33 -0
  30. package/dist/packages/vm-orchestrator/src/bootErrors.js +67 -0
  31. package/dist/packages/vm-orchestrator/src/buildCloudInit.d.ts +33 -0
  32. package/dist/packages/vm-orchestrator/src/buildCloudInit.js +55 -0
  33. package/dist/packages/vm-orchestrator/src/buildQemuArgs.d.ts +33 -0
  34. package/dist/packages/vm-orchestrator/src/buildQemuArgs.js +127 -0
  35. package/dist/packages/vm-orchestrator/src/diskSizing.d.ts +18 -0
  36. package/dist/packages/vm-orchestrator/src/diskSizing.js +41 -0
  37. package/dist/packages/vm-orchestrator/src/firmware.d.ts +5 -0
  38. package/dist/packages/vm-orchestrator/src/firmware.js +18 -0
  39. package/dist/packages/vm-orchestrator/src/hostAccess/VmHostAccess.d.ts +22 -0
  40. package/dist/packages/vm-orchestrator/src/hostAccess/VmHostAccess.js +33 -0
  41. package/dist/packages/vm-orchestrator/src/hostAccess/deviceProblems.d.ts +3 -0
  42. package/dist/packages/vm-orchestrator/src/hostAccess/deviceProblems.js +17 -0
  43. package/dist/packages/vm-orchestrator/src/hostAccess/findVmHostAccessProblems.d.ts +9 -0
  44. package/dist/packages/vm-orchestrator/src/hostAccess/findVmHostAccessProblems.js +17 -0
  45. package/dist/packages/vm-orchestrator/src/hostAccess/gpuProblems.d.ts +6 -0
  46. package/dist/packages/vm-orchestrator/src/hostAccess/gpuProblems.js +42 -0
  47. package/dist/packages/vm-orchestrator/src/hostAccess/index.d.ts +1 -0
  48. package/dist/packages/vm-orchestrator/src/hostAccess/index.js +1 -0
  49. package/dist/packages/vm-orchestrator/src/hostAccess/memlockProblems.d.ts +6 -0
  50. package/dist/packages/vm-orchestrator/src/hostAccess/memlockProblems.js +18 -0
  51. package/dist/packages/vm-orchestrator/src/hostAccess/workRootProblems.d.ts +7 -0
  52. package/dist/packages/vm-orchestrator/src/hostAccess/workRootProblems.js +30 -0
  53. package/dist/packages/vm-orchestrator/src/hostDevices.d.ts +12 -0
  54. package/dist/packages/vm-orchestrator/src/hostDevices.js +12 -0
  55. package/dist/packages/vm-orchestrator/src/hostTools.d.ts +25 -0
  56. package/dist/packages/vm-orchestrator/src/hostTools.js +39 -0
  57. package/dist/packages/vm-orchestrator/src/imageCache.d.ts +25 -0
  58. package/dist/packages/vm-orchestrator/src/imageCache.js +73 -0
  59. package/dist/packages/vm-orchestrator/src/imageDownload.d.ts +31 -0
  60. package/dist/packages/vm-orchestrator/src/imageDownload.js +85 -0
  61. package/dist/packages/vm-orchestrator/src/index.d.ts +19 -0
  62. package/dist/packages/vm-orchestrator/src/index.js +15 -0
  63. package/dist/packages/vm-orchestrator/src/memlockLimit.d.ts +5 -0
  64. package/dist/packages/vm-orchestrator/src/memlockLimit.js +23 -0
  65. package/dist/packages/vm-orchestrator/src/nvidiaHolders.d.ts +11 -0
  66. package/dist/packages/vm-orchestrator/src/nvidiaHolders.js +74 -0
  67. package/dist/packages/vm-orchestrator/src/pciNuma.d.ts +7 -0
  68. package/dist/packages/vm-orchestrator/src/pciNuma.js +18 -0
  69. package/dist/packages/vm-orchestrator/src/pciSysfs.d.ts +21 -0
  70. package/dist/packages/vm-orchestrator/src/pciSysfs.js +47 -0
  71. package/dist/packages/vm-orchestrator/src/processes.d.ts +37 -0
  72. package/dist/packages/vm-orchestrator/src/processes.js +102 -0
  73. package/dist/packages/vm-orchestrator/src/sockets.d.ts +21 -0
  74. package/dist/packages/vm-orchestrator/src/sockets.js +58 -0
  75. package/dist/packages/vm-orchestrator/src/sweepVmImageCache.d.ts +19 -0
  76. package/dist/packages/vm-orchestrator/src/sweepVmImageCache.js +132 -0
  77. package/dist/packages/vm-orchestrator/src/util.d.ts +14 -0
  78. package/dist/packages/vm-orchestrator/src/util.js +33 -0
  79. package/dist/packages/vm-orchestrator/src/vfioBinding.d.ts +27 -0
  80. package/dist/packages/vm-orchestrator/src/vfioBinding.js +163 -0
  81. package/dist/packages/vm-orchestrator/src/vmImageResolver.d.ts +20 -0
  82. package/dist/packages/vm-orchestrator/src/vmImageResolver.js +62 -0
  83. package/dist/packages/vm-orchestrator/src/vsockBridge.d.ts +20 -0
  84. package/dist/packages/vm-orchestrator/src/vsockBridge.js +27 -0
  85. package/dist/packages/vm-orchestrator/src/workDirs.d.ts +49 -0
  86. package/dist/packages/vm-orchestrator/src/workDirs.js +79 -0
  87. package/dist/src/NodeManager/configs/configs.d.ts +4 -0
  88. package/dist/src/NodeManager/configs/configs.js +3 -0
  89. package/dist/src/NodeManager/db/index.d.ts +10 -0
  90. package/dist/src/NodeManager/db/index.js +4 -0
  91. package/dist/src/NodeManager/monitoring/log/NodeLog.d.ts +2 -0
  92. package/dist/src/NodeManager/monitoring/log/NodeLog.js +21 -0
  93. package/dist/src/NodeManager/monitoring/log/console/ConsoleLogger.d.ts +8 -0
  94. package/dist/src/NodeManager/monitoring/log/console/ConsoleLogger.js +29 -5
  95. package/dist/src/NodeManager/monitoring/log/vmSetupLog.d.ts +11 -0
  96. package/dist/src/NodeManager/monitoring/log/vmSetupLog.js +33 -0
  97. package/dist/src/NodeManager/node/Node.d.ts +2 -0
  98. package/dist/src/NodeManager/node/Node.js +12 -5
  99. package/dist/src/NodeManager/node/job/ContainerJobRuntime.d.ts +141 -0
  100. package/dist/src/NodeManager/node/job/ContainerJobRuntime.js +419 -0
  101. package/dist/src/NodeManager/node/job/JobRuntimeEnvironment.d.ts +74 -0
  102. package/dist/src/NodeManager/node/job/JobRuntimeEnvironment.js +1 -0
  103. package/dist/src/NodeManager/node/job/JobRuntimeHost.d.ts +6 -2
  104. package/dist/src/NodeManager/node/job/JobRuntimeHost.js +13 -2
  105. package/dist/src/NodeManager/node/job/JobRuntimeSession.d.ts +12 -9
  106. package/dist/src/NodeManager/node/job/JobRuntimeSession.js +42 -71
  107. package/dist/src/NodeManager/node/job/VmJobRuntime.d.ts +109 -0
  108. package/dist/src/NodeManager/node/job/VmJobRuntime.js +258 -0
  109. package/dist/src/NodeManager/node/job/VmJobRuntimeConfig.d.ts +33 -0
  110. package/dist/src/NodeManager/node/job/VmJobRuntimeConfig.js +1 -0
  111. package/dist/src/NodeManager/node/job/buildJobRuntimeEnv.d.ts +41 -0
  112. package/dist/src/NodeManager/node/job/buildJobRuntimeEnv.js +25 -0
  113. package/dist/src/NodeManager/node/job/followFile.d.ts +14 -0
  114. package/dist/src/NodeManager/node/job/followFile.js +57 -0
  115. package/dist/src/NodeManager/node/job/jobHandler.d.ts +3 -3
  116. package/dist/src/NodeManager/node/job/jobHandler.js +7 -7
  117. package/dist/src/NodeManager/node/job/keepFailedConsole.d.ts +7 -0
  118. package/dist/src/NodeManager/node/job/keepFailedConsole.js +52 -0
  119. package/dist/src/NodeManager/node/job/selectJobRuntimeEnvironment.d.ts +50 -0
  120. package/dist/src/NodeManager/node/job/selectJobRuntimeEnvironment.js +117 -0
  121. package/dist/src/NodeManager/node/market/benchmark.d.ts +3 -3
  122. package/dist/src/NodeManager/node/market/benchmark.js +3 -3
  123. package/dist/src/NodeManager/node/market/marketHandler.d.ts +3 -3
  124. package/dist/src/NodeManager/node/market/marketHandler.js +3 -3
  125. package/dist/src/NodeManager/node/resource/resourceManager.d.ts +1 -1
  126. package/dist/src/NodeManager/node/resource/resourceManager.js +1 -1
  127. package/dist/src/NodeManager/provider/Provider.d.ts +3 -121
  128. package/dist/src/NodeManager/provider/Provider.js +3 -369
  129. package/dist/src/NodeManager/provider/vmHost/VmNodeOptions.d.ts +14 -0
  130. package/dist/src/NodeManager/provider/vmHost/VmNodeOptions.js +1 -0
  131. package/dist/src/NodeManager/provider/vmHost/capacity.d.ts +16 -0
  132. package/dist/src/NodeManager/provider/vmHost/capacity.js +47 -0
  133. package/dist/src/NodeManager/provider/vmHost/gpus.d.ts +19 -0
  134. package/dist/src/NodeManager/provider/vmHost/gpus.js +83 -0
  135. package/dist/src/NodeManager/provider/vmHost/index.d.ts +5 -0
  136. package/dist/src/NodeManager/provider/vmHost/index.js +4 -0
  137. package/dist/src/NodeManager/provider/vmHost/readVmSpec.d.ts +11 -0
  138. package/dist/src/NodeManager/provider/vmHost/readVmSpec.js +22 -0
  139. package/dist/src/NodeManager/provider/vmHost/setup/PrepareVmHostSystem.d.ts +27 -0
  140. package/dist/src/NodeManager/provider/vmHost/setup/PrepareVmHostSystem.js +25 -0
  141. package/dist/src/NodeManager/provider/vmHost/setup/fileOwnership.d.ts +6 -0
  142. package/dist/src/NodeManager/provider/vmHost/setup/fileOwnership.js +22 -0
  143. package/dist/src/NodeManager/provider/vmHost/setup/hostUser.d.ts +15 -0
  144. package/dist/src/NodeManager/provider/vmHost/setup/hostUser.js +25 -0
  145. package/dist/src/NodeManager/provider/vmHost/setup/index.d.ts +2 -0
  146. package/dist/src/NodeManager/provider/vmHost/setup/index.js +2 -0
  147. package/dist/src/NodeManager/provider/vmHost/setup/memlockLimits.d.ts +6 -0
  148. package/dist/src/NodeManager/provider/vmHost/setup/memlockLimits.js +12 -0
  149. package/dist/src/NodeManager/provider/vmHost/setup/prepareVmHost.d.ts +17 -0
  150. package/dist/src/NodeManager/provider/vmHost/setup/prepareVmHost.js +90 -0
  151. package/dist/src/NodeManager/provider/vmHost/setup/sudoCaller.d.ts +5 -0
  152. package/dist/src/NodeManager/provider/vmHost/setup/sudoCaller.js +35 -0
  153. package/dist/src/NodeManager/provider/vmHost/vmHostEnv.d.ts +20 -0
  154. package/dist/src/NodeManager/provider/vmHost/vmHostEnv.js +24 -0
  155. package/dist/src/NodeManager/provider/vmHost/workRoot.d.ts +14 -0
  156. package/dist/src/NodeManager/provider/vmHost/workRoot.js +84 -0
  157. package/dist/src/NodeManager/repository/NodeRepository.d.ts +12 -2
  158. package/dist/src/NodeManager/repository/NodeRepository.js +21 -1
  159. package/dist/src/cli/commands/prune/command.js +2 -1
  160. package/dist/src/cli/commands/run/action.d.ts +2 -2
  161. package/dist/src/cli/commands/run/action.js +15 -34
  162. package/dist/src/cli/commands/run/command.js +7 -2
  163. package/dist/src/cli/commands/sharedOptions/--config.d.ts +2 -0
  164. package/dist/src/cli/commands/sharedOptions/--config.js +2 -0
  165. package/dist/src/cli/commands/sharedOptions/--environment.d.ts +6 -0
  166. package/dist/src/cli/commands/sharedOptions/--environment.js +6 -0
  167. package/dist/src/cli/commands/sharedOptions/--gpu.js +5 -2
  168. package/dist/src/cli/commands/sharedOptions/--node-limits.d.ts +9 -0
  169. package/dist/src/cli/commands/sharedOptions/--node-limits.js +24 -0
  170. package/dist/src/cli/commands/sharedOptions/index.d.ts +3 -0
  171. package/dist/src/cli/commands/sharedOptions/index.js +3 -0
  172. package/dist/src/cli/commands/start/command.js +7 -2
  173. package/dist/src/cli/commands/vm-setup/action.d.ts +10 -0
  174. package/dist/src/cli/commands/vm-setup/action.js +14 -0
  175. package/dist/src/cli/commands/vm-setup/command.d.ts +3 -0
  176. package/dist/src/cli/commands/vm-setup/command.js +11 -0
  177. package/dist/src/cli/createNosanaCli.d.ts +1 -0
  178. package/dist/src/cli/createNosanaCli.js +4 -1
  179. package/npm-shrinkwrap.json +10 -2
  180. package/package.json +1 -1
@@ -0,0 +1,33 @@
1
+ /** Where the guest finds the job's directory (the sidecar's `/nosana-host`). */
2
+ export declare const GUEST_HOST_DIR = "/var/lib/nosana/host";
3
+ /** The job-runtime seed in the guest's job directory. */
4
+ export declare const GUEST_SEED_PATH = "/var/lib/nosana/host/seed.json";
5
+ /** The sidecar's environment, read by the guest launcher (`--env-file`). */
6
+ export declare const GUEST_RUNTIME_ENV_PATH = "/var/lib/nosana/runtime.env";
7
+ /** The two files of a cloud-init NoCloud seed. */
8
+ export interface CloudInitFiles {
9
+ /** `#cloud-config` that writes the job's directory into the guest. */
10
+ userData: string;
11
+ /** The instance id and hostname. */
12
+ metaData: string;
13
+ }
14
+ /** What cloud-init writes into the guest. */
15
+ export interface CloudInitOptions {
16
+ /** The job-runtime seed, as the JSON text the node wrote to the job dir. */
17
+ seed: string;
18
+ /**
19
+ * The sidecar environment (see docs/job-runtime-sidecar.md), with the guest's
20
+ * own keys (`JOB_RUNTIME_IMAGE`, `GPU_POWER_LIMIT`) set by the node.
21
+ */
22
+ env: Record<string, string>;
23
+ /** The host vsock port the guest bridges its `host.sock` to. */
24
+ hostVsockPort: number;
25
+ }
26
+ /**
27
+ * Build the cloud-init NoCloud user-data + meta-data that writes the job's
28
+ * directory into the guest: the seed at {@link GUEST_SEED_PATH} and the
29
+ * runtime's environment at {@link GUEST_RUNTIME_ENV_PATH}. The golden image's
30
+ * units are gated on the seed, so writing the files is all a boot needs. Pure:
31
+ * packaging them into the seed ISO is the hypervisor's job.
32
+ */
33
+ export declare function buildCloudInitSeed(opts: CloudInitOptions): CloudInitFiles;
@@ -0,0 +1,55 @@
1
+ /** Where the guest finds the job's directory (the sidecar's `/nosana-host`). */
2
+ export const GUEST_HOST_DIR = '/var/lib/nosana/host';
3
+ /** The job-runtime seed in the guest's job directory. */
4
+ export const GUEST_SEED_PATH = `${GUEST_HOST_DIR}/seed.json`;
5
+ /** The sidecar's environment, read by the guest launcher (`--env-file`). */
6
+ export const GUEST_RUNTIME_ENV_PATH = '/var/lib/nosana/runtime.env';
7
+ /** NoCloud meta-data, the same for every VM. */
8
+ const META_DATA = 'instance-id: nosana-vm\nlocal-hostname: nosana-vm\n';
9
+ /** A variable name Docker and systemd both accept. */
10
+ const ENV_NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
11
+ /**
12
+ * Build the cloud-init NoCloud user-data + meta-data that writes the job's
13
+ * directory into the guest: the seed at {@link GUEST_SEED_PATH} and the
14
+ * runtime's environment at {@link GUEST_RUNTIME_ENV_PATH}. The golden image's
15
+ * units are gated on the seed, so writing the files is all a boot needs. Pure:
16
+ * packaging them into the seed ISO is the hypervisor's job.
17
+ */
18
+ export function buildCloudInitSeed(opts) {
19
+ const { seed, env, hostVsockPort } = opts;
20
+ const runtimeEnv = { ...env, HOST_VSOCK_PORT: String(hostVsockPort) };
21
+ const userData = [
22
+ '#cloud-config',
23
+ 'write_files:',
24
+ ...writeFileEntry(GUEST_SEED_PATH, seed),
25
+ ...writeFileEntry(GUEST_RUNTIME_ENV_PATH, formatEnvFile(runtimeEnv)),
26
+ '',
27
+ ].join('\n');
28
+ return { userData, metaData: META_DATA };
29
+ }
30
+ /** A cloud-init `write_files` entry, its content base64 so no payload needs YAML escaping. */
31
+ function writeFileEntry(path, content) {
32
+ return [
33
+ ` - path: ${path}`,
34
+ " permissions: '0600'",
35
+ ' encoding: b64',
36
+ ` content: ${Buffer.from(content, 'utf8').toString('base64')}`,
37
+ ];
38
+ }
39
+ /**
40
+ * `KEY=value` lines, one per variable, as Docker's `--env-file` and systemd's
41
+ * `EnvironmentFile` both read them. Docker takes the value literally (no
42
+ * quoting), so a value cannot carry a newline: refused, as is a bad name.
43
+ */
44
+ function formatEnvFile(env) {
45
+ return Object.entries(env)
46
+ .map(([name, value]) => formatEnvLine(name, value))
47
+ .join('');
48
+ }
49
+ function formatEnvLine(name, value) {
50
+ if (!ENV_NAME_PATTERN.test(name))
51
+ throw new Error(`invalid env name: "${name}"`);
52
+ if (/[\r\n]/.test(value))
53
+ throw new Error(`env ${name} must not contain a newline`);
54
+ return `${name}=${value}\n`;
55
+ }
@@ -0,0 +1,33 @@
1
+ import type { VmSpec } from './VmSpec.js';
2
+ /** The guest port the job runtime serves its API on, forwarded to a host port. */
3
+ export declare const JOB_RUNTIME_GUEST_PORT = 8080;
4
+ /** The accelerator a VM runs under unless told otherwise. */
5
+ export declare const DEFAULT_ACCEL = "kvm";
6
+ /** The files and sockets in the work dir a VM is wired to. */
7
+ export interface QemuPaths {
8
+ /** Per-run qcow2 overlay backing the (immutable) base image. */
9
+ overlay: string;
10
+ /** cloud-init NoCloud seed ISO carrying user-data/meta-data. */
11
+ seedIso: string;
12
+ /** Unix socket QEMU opens for QMP control. */
13
+ qmpSocket: string;
14
+ /** Unix socket the guest serial console is wired to (our log stream). */
15
+ serialSocket: string;
16
+ }
17
+ /** The devices and host wiring a VM is booted with. */
18
+ export interface QemuOptions {
19
+ /** Accelerator: 'kvm' (default) on a Linux host; 'tcg' for emulation in tests/CI. */
20
+ accel?: string;
21
+ /** Host port forwarded to the job runtime's API ({@link JOB_RUNTIME_GUEST_PORT}). */
22
+ apiHostPort?: number;
23
+ /** Guest CID of a virtio-vsock device, the guest's `host.sock` channel; none when omitted. */
24
+ guestCid?: number;
25
+ /** OVMF/UEFI firmware, booted only when GPUs are passed through (see firmwareArgs). */
26
+ biosPath?: string;
27
+ }
28
+ /**
29
+ * The `qemu-system-x86_64` argument vector for a {@link VmSpec}, its GPUs attached as VFIO
30
+ * passthrough devices. Pure, so the whole QEMU command surface is unit-testable; the
31
+ * hypervisor picks the binary and applies NUMA pinning at spawn.
32
+ */
33
+ export declare function buildQemuArgs(spec: VmSpec, paths: QemuPaths, opts?: QemuOptions): string[];
@@ -0,0 +1,127 @@
1
+ /** The guest port the job runtime serves its API on, forwarded to a host port. */
2
+ export const JOB_RUNTIME_GUEST_PORT = 8080;
3
+ /** The accelerator a VM runs under unless told otherwise. */
4
+ export const DEFAULT_ACCEL = 'kvm';
5
+ /** Machine type. q35 is required for PCI passthrough (GPUs). */
6
+ const MACHINE = 'q35';
7
+ /** CPU model. 'host' passes the host CPU through (needed under KVM). */
8
+ const CPU_MODEL = 'host';
9
+ /**
10
+ * The `qemu-system-x86_64` argument vector for a {@link VmSpec}, its GPUs attached as VFIO
11
+ * passthrough devices. Pure, so the whole QEMU command surface is unit-testable; the
12
+ * hypervisor picks the binary and applies NUMA pinning at spawn.
13
+ */
14
+ export function buildQemuArgs(spec, paths, opts = {}) {
15
+ const { accel = DEFAULT_ACCEL, apiHostPort, guestCid, biosPath } = opts;
16
+ return [
17
+ ...machineArgs(spec, accel),
18
+ ...firmwareArgs(biosPath, spec.gpus),
19
+ ...diskArgs(paths),
20
+ ...networkArgs(apiHostPort),
21
+ ...consoleArgs(paths),
22
+ ...vsockArgs(guestCid),
23
+ ...vfioArgs(spec.gpus),
24
+ ];
25
+ }
26
+ /**
27
+ * Machine, CPU and memory, headless: `-display none` with the console on a
28
+ * socket (see consoleArgs) rather than `-nographic`, which would multiplex
29
+ * serial and monitor onto stdio. `-no-reboot` makes a guest `poweroff` exit
30
+ * QEMU instead of rebooting.
31
+ */
32
+ function machineArgs(spec, accel) {
33
+ return [
34
+ '-machine',
35
+ `${MACHINE},accel=${accel}`,
36
+ '-cpu',
37
+ CPU_MODEL,
38
+ '-smp',
39
+ String(spec.vcpus),
40
+ '-m',
41
+ String(spec.memoryMiB),
42
+ '-display',
43
+ 'none',
44
+ '-no-reboot',
45
+ ];
46
+ }
47
+ /**
48
+ * A GPU VM boots UEFI (OVMF): the q35 default (SeaBIOS) can't place several
49
+ * large 64-bit GPU BARs, so only ~2 of N GPUs initialise, while OVMF sizes the
50
+ * 64-bit MMIO window to fit them all. A VM without GPUs keeps the default
51
+ * firmware, so a BIOS-only image boots as before.
52
+ */
53
+ function firmwareArgs(biosPath, gpus) {
54
+ if (!biosPath || gpus.length === 0)
55
+ return [];
56
+ return ['-bios', biosPath];
57
+ }
58
+ /**
59
+ * The root disk and the cloud-init seed. The overlay bypasses the host page
60
+ * cache (cache=none): the guest already caches its own disk, and a host copy
61
+ * of every guest write only competes with guest RAM for memory.
62
+ */
63
+ function diskArgs(paths) {
64
+ return [
65
+ '-drive',
66
+ `file=${paths.overlay},if=virtio,format=qcow2,cache=none`,
67
+ '-drive',
68
+ `file=${paths.seedIso},if=virtio,format=raw,readonly=on`,
69
+ ];
70
+ }
71
+ /**
72
+ * User-mode networking, with a hostfwd that makes the job API reachable at
73
+ * 127.0.0.1:<apiHostPort> on the node with no bridge, tap or privileges. IPv4
74
+ * only: user-net otherwise hands the guest an IPv6 address and route that go
75
+ * nowhere on an IPv4-only host, so a lookup that returns only AAAA fails as
76
+ * "network is unreachable" instead of using IPv4.
77
+ */
78
+ function networkArgs(apiHostPort) {
79
+ const hostfwd = apiHostPort === undefined
80
+ ? ''
81
+ : `,hostfwd=tcp:127.0.0.1:${apiHostPort}-:${JOB_RUNTIME_GUEST_PORT}`;
82
+ return ['-netdev', `user,id=net0,ipv6=off${hostfwd}`, '-device', 'virtio-net-pci,netdev=net0'];
83
+ }
84
+ /** The guest serial console on the socket VmStateManager streams, and the QMP socket. */
85
+ function consoleArgs(paths) {
86
+ return [
87
+ '-chardev',
88
+ `socket,id=serial0,path=${paths.serialSocket},server=on,wait=off`,
89
+ '-serial',
90
+ 'chardev:serial0',
91
+ '-qmp',
92
+ `unix:${paths.qmpSocket},server=on,wait=off`,
93
+ ];
94
+ }
95
+ /** virtio-vsock: the guest bridges its `host.sock` out to the host (CID 2), no network involved. */
96
+ function vsockArgs(guestCid) {
97
+ if (guestCid === undefined)
98
+ return [];
99
+ return ['-device', `vhost-vsock-pci,guest-cid=${guestCid}`];
100
+ }
101
+ /**
102
+ * GPU passthrough via the iommufd backend: one shared iommufd object, then a
103
+ * pcie-root-port per GPU with the vfio-pci device behind it. `romfile=`
104
+ * suppresses the option ROM (the guest driver drives the GPU, and a ROM BAR
105
+ * can block passthrough). Each root port needs a unique `chassis`: it defaults
106
+ * to 0, so a second port collides and QEMU aborts with "Can't add chassis
107
+ * slot, error -16".
108
+ *
109
+ * The 64-bit MMIO window (X-PciMmio64Mb / pci-hole64-size) is deliberately not
110
+ * pinned: QEMU/OVMF size it to fit even eight 128 GiB-BAR GPUs, while an
111
+ * explicit size placed the BARs where the guest driver couldn't bring the GPUs
112
+ * up (verified against raw QEMU).
113
+ */
114
+ function vfioArgs(gpus) {
115
+ if (gpus.length === 0)
116
+ return [];
117
+ return [
118
+ '-object',
119
+ 'iommufd,id=iommufd0',
120
+ ...gpus.flatMap((bdf, i) => [
121
+ '-device',
122
+ `pcie-root-port,id=pcie.gpu${i},bus=pcie.0,chassis=${i + 1}`,
123
+ '-device',
124
+ `vfio-pci,host=${bdf},bus=pcie.gpu${i},iommufd=iommufd0,romfile=`,
125
+ ]),
126
+ ];
127
+ }
@@ -0,0 +1,18 @@
1
+ /** Filesystem capacity (MiB) of the volume holding a directory. */
2
+ export interface FsCapacity {
3
+ freeMiB: number;
4
+ totalMiB: number;
5
+ }
6
+ /** Probe a directory's filesystem capacity. Injectable for tests. */
7
+ export type FreeSpaceLike = (dir: string) => Promise<FsCapacity>;
8
+ /** Free and total space via fs.statfs, in MiB (bavail: space usable without root). */
9
+ export declare function statfsCapacity(dir: string): Promise<FsCapacity>;
10
+ /**
11
+ * The size (MiB) to grow a VM's disk to: `diskMiB` bounded by the space free (the qcow2
12
+ * virtual size is a limit the guest cannot write past, so several nodes can split one disk),
13
+ * or without it the free space minus max(10 GiB, 10% of the filesystem). The overlay is thin,
14
+ * so this is a write ceiling, not an upfront allocation; probing at boot means a second VM
15
+ * sees the disk the first one already left. Undefined leaves the overlay at the base image's
16
+ * size (probe failed, nothing free).
17
+ */
18
+ export declare function resolveAutoDiskMiB(freeSpace: FreeSpaceLike, dir: string, diskMiB: number | undefined): Promise<number | undefined>;
@@ -0,0 +1,41 @@
1
+ import fs from 'fs/promises';
2
+ const MIB_BYTES = 1024 * 1024;
3
+ /** Disk kept free on the work root when auto-sizing: at least this, or 10% of the fs. */
4
+ const MIN_DISK_RESERVE_MIB = 10 * 1024;
5
+ const DISK_RESERVE_FRACTION = 0.1;
6
+ /** Free and total space via fs.statfs, in MiB (bavail: space usable without root). */
7
+ export async function statfsCapacity(dir) {
8
+ const stats = await fs.statfs(dir);
9
+ return {
10
+ freeMiB: Math.floor((stats.bavail * stats.bsize) / MIB_BYTES),
11
+ totalMiB: Math.floor((stats.blocks * stats.bsize) / MIB_BYTES),
12
+ };
13
+ }
14
+ /**
15
+ * The size (MiB) to grow a VM's disk to: `diskMiB` bounded by the space free (the qcow2
16
+ * virtual size is a limit the guest cannot write past, so several nodes can split one disk),
17
+ * or without it the free space minus max(10 GiB, 10% of the filesystem). The overlay is thin,
18
+ * so this is a write ceiling, not an upfront allocation; probing at boot means a second VM
19
+ * sees the disk the first one already left. Undefined leaves the overlay at the base image's
20
+ * size (probe failed, nothing free).
21
+ */
22
+ export async function resolveAutoDiskMiB(freeSpace, dir, diskMiB) {
23
+ const capacity = await probeCapacity(freeSpace, dir);
24
+ if (!capacity)
25
+ return undefined;
26
+ const target = diskMiB === undefined
27
+ ? capacity.freeMiB - reserveMiB(capacity)
28
+ : Math.min(diskMiB, capacity.freeMiB);
29
+ return target > 0 ? target : undefined;
30
+ }
31
+ async function probeCapacity(freeSpace, dir) {
32
+ try {
33
+ return await freeSpace(dir);
34
+ }
35
+ catch {
36
+ return undefined;
37
+ }
38
+ }
39
+ function reserveMiB(capacity) {
40
+ return Math.max(MIN_DISK_RESERVE_MIB, Math.floor(capacity.totalMiB * DISK_RESERVE_FRACTION));
41
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * The OVMF (UEFI) firmware a GPU VM boots as `-bios`, the first of `candidates` present; or
3
+ * undefined, and VMs keep the default firmware (see buildQemuArgs).
4
+ */
5
+ export declare function discoverUefiBios(candidates?: string[]): string | undefined;
@@ -0,0 +1,18 @@
1
+ import { existsSync } from 'fs';
2
+ /**
3
+ * Well-known monolithic OVMF firmware locations, in priority order: a GPU VM boots a single
4
+ * `-bios OVMF.fd`, not the split CODE/VARS pflash pair.
5
+ */
6
+ const OVMF_CANDIDATES = [
7
+ '/usr/share/ovmf/OVMF.fd',
8
+ '/usr/share/OVMF/OVMF.fd',
9
+ '/usr/share/qemu/OVMF.fd',
10
+ '/usr/share/edk2/ovmf/OVMF.fd',
11
+ ];
12
+ /**
13
+ * The OVMF (UEFI) firmware a GPU VM boots as `-bios`, the first of `candidates` present; or
14
+ * undefined, and VMs keep the default firmware (see buildQemuArgs).
15
+ */
16
+ export function discoverUefiBios(candidates = OVMF_CANDIDATES) {
17
+ return candidates.find((firmware) => existsSync(firmware));
18
+ }
@@ -0,0 +1,22 @@
1
+ /** What the node's user may do on the host; tests inject a fake one. */
2
+ export interface VmHostAccess {
3
+ /** Whether the node runs as root, which may bind GPUs, load modules and lock any memory. */
4
+ isRoot: boolean;
5
+ /** The sysfs PCI root (`/sys/bus/pci`). */
6
+ pciRoot: string;
7
+ kvmDevice: string;
8
+ vsockDevice: string;
9
+ iommufdDevice: string;
10
+ /** Where the kernel puts each vfio-pci device's node (`/dev/vfio/devices`). */
11
+ vfioDevicesDir: string;
12
+ /** Whether the node's user may access `file` in `mode` (fs.constants R_OK, W_OK, X_OK). */
13
+ canAccess: (file: string, mode: number) => boolean;
14
+ /** The soft locked-memory limit in bytes; Infinity unlimited, undefined unknown. */
15
+ memlockLimitBytes: () => number | undefined;
16
+ }
17
+ /** The real host, as the node's user. */
18
+ export declare function defaultVmHostAccess(): VmHostAccess;
19
+ /** Whether the user may open a device for reading and writing, as QEMU does. */
20
+ export declare function canOpen(host: VmHostAccess, device: string): boolean;
21
+ /** A device that exists but the user cannot open, and how to let it. */
22
+ export declare function cannotOpenMessage(device: string, owner?: string): string;
@@ -0,0 +1,33 @@
1
+ import fs from 'fs';
2
+ import { IOMMUFD_DEVICE, KVM_DEVICE, SYSFS_PCI_ROOT, VFIO_DEVICES_DIR, VSOCK_DEVICE, } from '../hostDevices.js';
3
+ import { readMemlockLimit } from '../memlockLimit.js';
4
+ /** The real host, as the node's user. */
5
+ export function defaultVmHostAccess() {
6
+ return {
7
+ isRoot: process.geteuid?.() === 0,
8
+ pciRoot: SYSFS_PCI_ROOT,
9
+ kvmDevice: KVM_DEVICE,
10
+ vsockDevice: VSOCK_DEVICE,
11
+ iommufdDevice: IOMMUFD_DEVICE,
12
+ vfioDevicesDir: VFIO_DEVICES_DIR,
13
+ canAccess,
14
+ memlockLimitBytes: () => readMemlockLimit(),
15
+ };
16
+ }
17
+ /** Whether the user may open a device for reading and writing, as QEMU does. */
18
+ export function canOpen(host, device) {
19
+ return host.canAccess(device, fs.constants.R_OK | fs.constants.W_OK);
20
+ }
21
+ /** A device that exists but the user cannot open, and how to let it. */
22
+ export function cannotOpenMessage(device, owner = '') {
23
+ return `cannot open ${device}${owner}: give the kvm group read-write access to it`;
24
+ }
25
+ function canAccess(file, mode) {
26
+ try {
27
+ fs.accessSync(file, mode);
28
+ return true;
29
+ }
30
+ catch {
31
+ return false;
32
+ }
33
+ }
@@ -0,0 +1,3 @@
1
+ import { type VmHostAccess } from './VmHostAccess.js';
2
+ /** What stops the user from opening the devices every VM needs: KVM and vhost-vsock. */
3
+ export declare function deviceProblems(host: VmHostAccess): string[];
@@ -0,0 +1,17 @@
1
+ import fs from 'fs';
2
+ import { canOpen, cannotOpenMessage } from './VmHostAccess.js';
3
+ /** What stops the user from opening the devices every VM needs: KVM and vhost-vsock. */
4
+ export function deviceProblems(host) {
5
+ const problems = [];
6
+ // A missing /dev/kvm is refused before this, with how to enable KVM.
7
+ if (fs.existsSync(host.kvmDevice) && !canOpen(host, host.kvmDevice)) {
8
+ problems.push(`cannot open ${host.kvmDevice}: add this user to the kvm group`);
9
+ }
10
+ if (!fs.existsSync(host.vsockDevice)) {
11
+ problems.push(`${host.vsockDevice} is missing: load the vhost_vsock kernel module`);
12
+ }
13
+ else if (!canOpen(host, host.vsockDevice)) {
14
+ problems.push(cannotOpenMessage(host.vsockDevice));
15
+ }
16
+ return problems;
17
+ }
@@ -0,0 +1,9 @@
1
+ import type { VmSpec } from '../VmSpec.js';
2
+ import { type VmHostAccess } from './VmHostAccess.js';
3
+ /**
4
+ * What stops the node's user from booting VMs of `spec` under `workRoot`, one line each; none
5
+ * when it can. Root may do anything here but find a device missing; a user needs the devices
6
+ * QEMU opens, GPUs already on vfio-pci (binding them needs root), a locked-memory limit that
7
+ * holds the guest's RAM, and to own what an earlier run left in the work root.
8
+ */
9
+ export declare function findVmHostAccessProblems(spec: VmSpec, workRoot: string, host?: VmHostAccess): string[];
@@ -0,0 +1,17 @@
1
+ import { deviceProblems } from './deviceProblems.js';
2
+ import { gpuProblems } from './gpuProblems.js';
3
+ import { memlockProblems } from './memlockProblems.js';
4
+ import { defaultVmHostAccess } from './VmHostAccess.js';
5
+ import { workRootProblems } from './workRootProblems.js';
6
+ /**
7
+ * What stops the node's user from booting VMs of `spec` under `workRoot`, one line each; none
8
+ * when it can. Root may do anything here but find a device missing; a user needs the devices
9
+ * QEMU opens, GPUs already on vfio-pci (binding them needs root), a locked-memory limit that
10
+ * holds the guest's RAM, and to own what an earlier run left in the work root.
11
+ */
12
+ export function findVmHostAccessProblems(spec, workRoot, host = defaultVmHostAccess()) {
13
+ const gpuVmProblems = spec.gpus.length > 0
14
+ ? [...gpuProblems(spec.gpus, host), ...memlockProblems(spec.memoryMiB, host)]
15
+ : [];
16
+ return [...deviceProblems(host), ...gpuVmProblems, ...workRootProblems(workRoot, host)];
17
+ }
@@ -0,0 +1,6 @@
1
+ import { type VmHostAccess } from './VmHostAccess.js';
2
+ /**
3
+ * What stops the user from passing the GPUs through. Root binds them as the VM boots; a user
4
+ * needs them on vfio-pci already, their VFIO nodes and iommufd open to it.
5
+ */
6
+ export declare function gpuProblems(gpus: string[], host: VmHostAccess): string[];
@@ -0,0 +1,42 @@
1
+ import fs from 'fs';
2
+ import { VFIO_DRIVER } from '../hostDevices.js';
3
+ import { missingVfioNodeMessage, readSlotFunctions, readVfioDeviceNodes } from '../pciSysfs.js';
4
+ import { canOpen, cannotOpenMessage } from './VmHostAccess.js';
5
+ /**
6
+ * What stops the user from passing the GPUs through. Root binds them as the VM boots; a user
7
+ * needs them on vfio-pci already, their VFIO nodes and iommufd open to it.
8
+ */
9
+ export function gpuProblems(gpus, host) {
10
+ return [...gpus.flatMap((gpu) => problemsOfGpu(gpu, host)), ...iommufdProblems(host)];
11
+ }
12
+ function problemsOfGpu(gpu, host) {
13
+ const offVfio = readSlotFunctions(host.pciRoot, gpu).filter(({ driver }) => driver !== VFIO_DRIVER);
14
+ if (offVfio.length > 0) {
15
+ if (host.isRoot)
16
+ return [];
17
+ const drivers = offVfio.map(({ device, driver }) => `${device} on ${driver ?? 'no driver'}`);
18
+ return [
19
+ `GPU ${gpu} is not on vfio-pci (${drivers.join(', ')}), and binding it needs root: ` +
20
+ 'bind it to vfio-pci beforehand',
21
+ ];
22
+ }
23
+ const nodes = readVfioDeviceNodes(host.pciRoot, host.vfioDevicesDir, gpu);
24
+ if (nodes.length === 0)
25
+ return [missingVfioNodeMessage(gpu)];
26
+ return nodes
27
+ .filter((node) => !canOpen(host, node))
28
+ .map((node) => cannotOpenMessage(node, ` (GPU ${gpu})`));
29
+ }
30
+ function iommufdProblems(host) {
31
+ const device = host.iommufdDevice;
32
+ if (!fs.existsSync(device)) {
33
+ // Root loads the module as the VM boots.
34
+ if (host.isRoot)
35
+ return [];
36
+ return [
37
+ `${device} is missing, and loading the iommufd module needs root: load it as root ` +
38
+ '(modprobe iommufd)',
39
+ ];
40
+ }
41
+ return canOpen(host, device) ? [] : [cannotOpenMessage(device)];
42
+ }
@@ -0,0 +1 @@
1
+ export { findVmHostAccessProblems } from './findVmHostAccessProblems.js';
@@ -0,0 +1 @@
1
+ export { findVmHostAccessProblems } from './findVmHostAccessProblems.js';
@@ -0,0 +1,6 @@
1
+ import type { VmHostAccess } from './VmHostAccess.js';
2
+ /**
3
+ * Whether the user may lock the guest's RAM, which GPU passthrough pins. Root may lock any
4
+ * amount; so may a user whose limit is unknown, which QEMU then reports itself.
5
+ */
6
+ export declare function memlockProblems(memoryMiB: number, host: VmHostAccess): string[];
@@ -0,0 +1,18 @@
1
+ const BYTES_PER_MIB = 1024 * 1024;
2
+ /**
3
+ * Whether the user may lock the guest's RAM, which GPU passthrough pins. Root may lock any
4
+ * amount; so may a user whose limit is unknown, which QEMU then reports itself.
5
+ */
6
+ export function memlockProblems(memoryMiB, host) {
7
+ if (host.isRoot)
8
+ return [];
9
+ const limit = host.memlockLimitBytes();
10
+ if (limit === undefined || limit >= memoryMiB * BYTES_PER_MIB)
11
+ return [];
12
+ const limitMiB = Math.floor(limit / BYTES_PER_MIB);
13
+ return [
14
+ `the locked-memory limit (${limitMiB} MiB) is below the VM's ${memoryMiB} MiB, which ` +
15
+ 'GPU passthrough pins: raise memlock for this user (/etc/security/limits.d, or ' +
16
+ 'LimitMEMLOCK=infinity in its systemd unit)',
17
+ ];
18
+ }
@@ -0,0 +1,7 @@
1
+ import type { VmHostAccess } from './VmHostAccess.js';
2
+ /**
3
+ * Whether the user may write the work root, its dirs (the VMs' and the image cache) and the
4
+ * cache's image dirs: a run as another user (root) leaves dirs this one can neither download
5
+ * into nor sweep.
6
+ */
7
+ export declare function workRootProblems(workRoot: string, host: VmHostAccess): string[];
@@ -0,0 +1,30 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { VM_IMAGE_CACHE_DIR } from '../imageCache.js';
4
+ /**
5
+ * Whether the user may write the work root, its dirs (the VMs' and the image cache) and the
6
+ * cache's image dirs: a run as another user (root) leaves dirs this one can neither download
7
+ * into nor sweep.
8
+ */
9
+ export function workRootProblems(workRoot, host) {
10
+ const cacheDir = path.join(workRoot, VM_IMAGE_CACHE_DIR);
11
+ const dirs = [workRoot, ...subDirs(workRoot), ...subDirs(cacheDir)];
12
+ const unwritable = dirs.filter((dir) => !host.canAccess(dir, fs.constants.W_OK | fs.constants.X_OK));
13
+ if (unwritable.length === 0)
14
+ return [];
15
+ return [
16
+ `cannot write ${unwritable.join(', ')}, left by a run as another user: chown ` +
17
+ `${workRoot} to this user`,
18
+ ];
19
+ }
20
+ function subDirs(dir) {
21
+ try {
22
+ return fs
23
+ .readdirSync(dir, { withFileTypes: true })
24
+ .filter((entry) => entry.isDirectory())
25
+ .map((entry) => path.join(dir, entry.name));
26
+ }
27
+ catch {
28
+ return [];
29
+ }
30
+ }
@@ -0,0 +1,12 @@
1
+ /** Where sysfs lists PCI devices and their drivers. */
2
+ export declare const SYSFS_PCI_ROOT = "/sys/bus/pci";
3
+ /** The KVM device QEMU runs the guest on. */
4
+ export declare const KVM_DEVICE = "/dev/kvm";
5
+ /** The vhost-vsock device behind the guest's vsock (see buildQemuArgs). */
6
+ export declare const VSOCK_DEVICE = "/dev/vhost-vsock";
7
+ /** The iommufd device QEMU's GPU passthrough opens (see buildQemuArgs). */
8
+ export declare const IOMMUFD_DEVICE = "/dev/iommu";
9
+ /** Where the kernel puts each vfio-pci device's node, which iommufd passthrough opens. */
10
+ export declare const VFIO_DEVICES_DIR = "/dev/vfio/devices";
11
+ /** The driver a passed-through device must be bound to. */
12
+ export declare const VFIO_DRIVER = "vfio-pci";
@@ -0,0 +1,12 @@
1
+ /** Where sysfs lists PCI devices and their drivers. */
2
+ export const SYSFS_PCI_ROOT = '/sys/bus/pci';
3
+ /** The KVM device QEMU runs the guest on. */
4
+ export const KVM_DEVICE = '/dev/kvm';
5
+ /** The vhost-vsock device behind the guest's vsock (see buildQemuArgs). */
6
+ export const VSOCK_DEVICE = '/dev/vhost-vsock';
7
+ /** The iommufd device QEMU's GPU passthrough opens (see buildQemuArgs). */
8
+ export const IOMMUFD_DEVICE = '/dev/iommu';
9
+ /** Where the kernel puts each vfio-pci device's node, which iommufd passthrough opens. */
10
+ export const VFIO_DEVICES_DIR = '/dev/vfio/devices';
11
+ /** The driver a passed-through device must be bound to. */
12
+ export const VFIO_DRIVER = 'vfio-pci';
@@ -0,0 +1,25 @@
1
+ import { type PciNumaNodeReader } from './pciNuma.js';
2
+ import type { VmSpec } from './VmSpec.js';
3
+ /** QEMU's x86-64 system emulator: the VM itself. */
4
+ export declare const QEMU_BINARY = "qemu-system-x86_64";
5
+ /** Creates and resizes the qcow2 overlays, and reads their backing files. */
6
+ export declare const QEMU_IMG_BINARY = "qemu-img";
7
+ /** Bridges the guest's vsock connections to the node's `host.sock`. */
8
+ export declare const SOCAT_BINARY = "socat";
9
+ /** Packs the cloud-init NoCloud seed ISO. */
10
+ export declare const ISO_BINARY = "genisoimage";
11
+ /** Pins a VM to its GPU's NUMA node; needed only when that GPU has one. */
12
+ export declare const NUMA_TOOL = "numactl";
13
+ /**
14
+ * The host binaries a VM of `spec` needs: QEMU's tools, and numactl when its first GPU is on
15
+ * a NUMA node (the boot pins the VM there), so a node can refuse to start without them.
16
+ */
17
+ export declare function requiredHostTools(spec: VmSpec, readNumaNode?: PciNumaNodeReader): string[];
18
+ /** Runs a host binary and answers its stdout; throws when it cannot run or fails. */
19
+ export type RunSync = (command: string, args: string[]) => string;
20
+ /**
21
+ * Whether the host's QEMU can pass GPUs through as the VMs do, by its iommufd backend
22
+ * (QEMU 9.0 or newer): its list of creatable objects names `iommufd`. False when QEMU cannot
23
+ * run.
24
+ */
25
+ export declare function qemuSupportsIommufd(run?: RunSync): boolean;