Skip to main content

Truenas

@mccormick/truenasv2026.06.09.1· 1d agoMODELS
01README

Hypervisor-layer VM inventory for TrueNAS SCALE, via the JSON-RPC WebSocket API. TrueNAS SCALE 24.10+ runs guest VMs as Incus instances; earlier releases use libvirt. The @mccormick/truenas/inventory model asks TrueNAS for that guest state and turns it into a typed swamp inventory: one vm resource per guest (normalized state, vcpus, memory, disks, NICs, and MAC addresses) and a single summary roll-up (host, TrueNAS version, and running/stopped/other counts). The discover method fans out across every guest in one virt.instance.query (or legacy vm.query) call — no per-VM loop. Guests share the common name/state/vcpus/memoryMib/macs field contract with the Proxmox and Omni inventory providers, so a workflow report can join all three hypervisors into one fleet view. Read-only: the model issues only query and system.info calls and never mutates TrueNAS state. Transport is the JSON-RPC WebSocket API authenticated with an API key; the key is supplied through a vault, marked sensitive, and redacted from logs and error text. The companion @mccormick/truenas/vm model provisions guests from a ZFS zvol (create_zvol, create_vm, attach_disk, attach_nic, start/stop/ status/delete) over the same JSON-RPC transport — the TrueNAS half of the migrate-vm workflow. Every provisioning method is idempotent (queries before it writes), stamps a swamp marker into the VM description, and gates deletes on it. Read-only inventory and read-write provisioning are deliberately split across two models so the inventory safety story stays intact.

02Models2
@mccormick/truenas/inventoryv2026.06.09.1inventory.ts

Global Arguments

ArgumentTypeDescription
endpointstringTrueNAS host or base URL, e.g. truenas.example.net or
apiKeystringTrueNAS API key (read-only is sufficient); supply via
insecureSkipTlsVerifybooleanSkip TLS verification (limited support over WebSocket — prefer a
backendenumGuest backend: 'incus' (SCALE 24.10+), 'libvirt' (legacy), or 'auto'
timeoutSecsnumberPer-discovery WebSocket timeout in seconds
fn discover()
Query TrueNAS for every guest VM in one call and write one vm

Resources

vm(30d)— A TrueNAS-managed guest VM (Incus instance or libvirt VM)
summary(30d)— Roll-up of one TrueNAS inventory run
@mccormick/truenas/vmv2026.06.09.1vm.ts

Global Arguments

ArgumentTypeDescription
endpointstringTrueNAS host or base URL, e.g. truenas.example.net
apiKeystringTrueNAS API key (read-write — provisioning mutates VMs and datasets);
insecureSkipTlsVerifybooleanSkip TLS verification (limited over WebSocket — prefer a trusted CA)
timeoutSecsnumberPer-call WebSocket timeout in seconds
fn create_zvol(pool: string, sizeGib: number, sparse: boolean, blocksize?: string)
Create a sparse/thick ZFS volume to back a guest disk (idempotent;
ArgumentTypeDescription
poolstringZFS pool (e.g. Main)
sizeGibnumberProvisioned size in GiB
sparsebooleanThin-provision the volume
blocksize?stringvolblocksize (e.g. 16K); omit for the pool default
fn create_vm(vcpus: number, coresPerSocket?: number, memoryMib: number, bootloader: enum, autostart: boolean, description?: string)
Create a libvirt VM (idempotent on name). Stamps the swamp marker
ArgumentTypeDescription
vcpusnumberVirtual CPU count
coresPerSocket?number
memoryMibnumberMemory in MiB
bootloaderenumUEFI for ovmf guests; UEFI_CSM for legacy-BIOS/GRUB guests
autostartboolean
description?string
fn attach_disk(vmId: number, zvolPath: string, bus: enum, order?: number)
Attach a zvol to a VM as a DISK device (idempotent on the device path).
ArgumentTypeDescription
vmIdnumberOwning VM id
zvolPathstringBacking device, /dev/zvol/<pool>/<name>
busenum
order?numberBoot/attach order, if needed
fn attach_nic(vmId: number, mac: string, bridge: string, model: enum)
Attach a NIC to a VM with a fixed MAC (idempotent on the MAC). Pass
ArgumentTypeDescription
vmIdnumberOwning VM id
macstringMAC address (pass the source VM's MAC for a same-IP cutover)
bridgestringHost bridge to attach to (e.g. br0)
modelenum
fn start(vmId?: number, name?: string)
Start a VM and poll briefly for the running state.
ArgumentTypeDescription
vmId?number
name?string
fn stop(vmId?: number, name?: string, force: boolean)
Stop a VM (graceful, then force when requested).
ArgumentTypeDescription
vmId?number
name?string
forcebooleanHard power-off after graceful
fn status(vmId?: number, name?: string)
Read a VM's current state (read-only).
ArgumentTypeDescription
vmId?number
name?string
fn delete(vmId?: number, name?: string, deleteZvol: boolean, zvolPath?: string, force: boolean)
Delete a VM (and optionally its zvols). Refuses a VM lacking the
ArgumentTypeDescription
vmId?number
name?string
deleteZvolbooleanAlso delete the VM's zvols (attached, and zvolPath if given)
zvolPath?stringA dangling zvol device path to remove even if the VM is already gone
forcebooleanOverride the safety gate: delete even a VM lacking the swamp marker

Resources

zvol(infinite)— A ZFS volume backing a guest disk
vm_instance(infinite)— A TrueNAS libvirt VM created or observed by this model
vm_device(infinite)— A disk or NIC device attached to a VM
03Previous Versions3
2026.06.07.2Jun 7, 2026
2026.06.07.1Jun 7, 2026

Added 1 models

2026.06.04.1Jun 5, 2026
04Stats
A
100 / 100
Downloads
0
Archive size
40.3 KB
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit2/2earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License declared1/1earned
  • Verified public repository2/2earned
05Platforms
06Labels