1. Packages
  2. Libvirt Provider
  3. API Docs
  4. getNodeInfo
libvirt 0.9.0 published on Saturday, Nov 8, 2025 by dmacvicar
libvirt logo
libvirt 0.9.0 published on Saturday, Nov 8, 2025 by dmacvicar

    Fetches information about the libvirt host node.

    This data source provides details about the host system’s hardware capabilities, including CPU model, memory, and processor topology.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as libvirt from "@pulumi/libvirt";
    
    const host = libvirt.getNodeInfo({});
    export const hostCpuModel = host.then(host => host.cpuModel);
    export const hostMemoryGb = host.then(host => host.memoryTotalKb / 1024 / 1024);
    export const hostCpuTopology = {
        sockets: host.then(host => host.cpuSockets),
        coresPerSocket: host.then(host => host.cpuCoresPerSocket),
        threadsPerCore: host.then(host => host.cpuThreadsPerCore),
        totalCores: host.then(host => host.cpuCoresTotal),
    };
    
    import pulumi
    import pulumi_libvirt as libvirt
    
    host = libvirt.get_node_info()
    pulumi.export("hostCpuModel", host.cpu_model)
    pulumi.export("hostMemoryGb", host.memory_total_kb / 1024 / 1024)
    pulumi.export("hostCpuTopology", {
        "sockets": host.cpu_sockets,
        "coresPerSocket": host.cpu_cores_per_socket,
        "threadsPerCore": host.cpu_threads_per_core,
        "totalCores": host.cpu_cores_total,
    })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/libvirt/libvirt"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		host, err := libvirt.GetNodeInfo(ctx, map[string]interface{}{}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("hostCpuModel", host.CpuModel)
    		ctx.Export("hostMemoryGb", pulumi.Float64(host.MemoryTotalKb/1024/1024))
    		ctx.Export("hostCpuTopology", pulumi.Float64Map{
    			"sockets":        host.CpuSockets,
    			"coresPerSocket": host.CpuCoresPerSocket,
    			"threadsPerCore": host.CpuThreadsPerCore,
    			"totalCores":     host.CpuCoresTotal,
    		})
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Libvirt = Pulumi.Libvirt;
    
    return await Deployment.RunAsync(() => 
    {
        var host = Libvirt.GetNodeInfo.Invoke();
    
        return new Dictionary<string, object?>
        {
            ["hostCpuModel"] = host.Apply(getNodeInfoResult => getNodeInfoResult.CpuModel),
            ["hostMemoryGb"] = host.Apply(getNodeInfoResult => getNodeInfoResult.MemoryTotalKb) / 1024 / 1024,
            ["hostCpuTopology"] = 
            {
                { "sockets", host.Apply(getNodeInfoResult => getNodeInfoResult.CpuSockets) },
                { "coresPerSocket", host.Apply(getNodeInfoResult => getNodeInfoResult.CpuCoresPerSocket) },
                { "threadsPerCore", host.Apply(getNodeInfoResult => getNodeInfoResult.CpuThreadsPerCore) },
                { "totalCores", host.Apply(getNodeInfoResult => getNodeInfoResult.CpuCoresTotal) },
            },
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.libvirt.LibvirtFunctions;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var host = LibvirtFunctions.getNodeInfo(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference);
    
            ctx.export("hostCpuModel", host.cpuModel());
            ctx.export("hostMemoryGb", host.memoryTotalKb() / 1024 / 1024);
            ctx.export("hostCpuTopology", Map.ofEntries(
                Map.entry("sockets", host.cpuSockets()),
                Map.entry("coresPerSocket", host.cpuCoresPerSocket()),
                Map.entry("threadsPerCore", host.cpuThreadsPerCore()),
                Map.entry("totalCores", host.cpuCoresTotal())
            ));
        }
    }
    
    Example coming soon!
    

    Using getNodeInfo

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getNodeInfo(opts?: InvokeOptions): Promise<GetNodeInfoResult>
    function getNodeInfoOutput(opts?: InvokeOptions): Output<GetNodeInfoResult>
    def get_node_info(opts: Optional[InvokeOptions] = None) -> GetNodeInfoResult
    def get_node_info_output(opts: Optional[InvokeOptions] = None) -> Output[GetNodeInfoResult]
    func GetNodeInfo(ctx *Context, opts ...InvokeOption) (*GetNodeInfoResult, error)
    func GetNodeInfoOutput(ctx *Context, opts ...InvokeOption) GetNodeInfoResultOutput

    > Note: This function is named GetNodeInfo in the Go SDK.

    public static class GetNodeInfo 
    {
        public static Task<GetNodeInfoResult> InvokeAsync(InvokeOptions? opts = null)
        public static Output<GetNodeInfoResult> Invoke(InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetNodeInfoResult> getNodeInfo(InvokeOptions options)
    public static Output<GetNodeInfoResult> getNodeInfo(InvokeOptions options)
    
    fn::invoke:
      function: libvirt:index/getNodeInfo:getNodeInfo
      arguments:
        # arguments dictionary

    getNodeInfo Result

    The following output properties are available:

    CpuCoresPerSocket double
    Number of CPU cores per socket.
    CpuCoresTotal double
    Total number of logical CPU cores available on the host.
    CpuModel string
    CPU model name (e.g., 'x86_64').
    CpuSockets double
    Number of CPU sockets on the host.
    CpuThreadsPerCore double
    Number of threads per CPU core (e.g., 2 for hyper-threading).
    Id string
    Internal identifier for this data source (hash of all values).
    MemoryTotalKb double
    Total memory available on the host in kilobytes.
    NumaNodes double
    Number of NUMA nodes on the host.
    CpuCoresPerSocket float64
    Number of CPU cores per socket.
    CpuCoresTotal float64
    Total number of logical CPU cores available on the host.
    CpuModel string
    CPU model name (e.g., 'x86_64').
    CpuSockets float64
    Number of CPU sockets on the host.
    CpuThreadsPerCore float64
    Number of threads per CPU core (e.g., 2 for hyper-threading).
    Id string
    Internal identifier for this data source (hash of all values).
    MemoryTotalKb float64
    Total memory available on the host in kilobytes.
    NumaNodes float64
    Number of NUMA nodes on the host.
    cpuCoresPerSocket Double
    Number of CPU cores per socket.
    cpuCoresTotal Double
    Total number of logical CPU cores available on the host.
    cpuModel String
    CPU model name (e.g., 'x86_64').
    cpuSockets Double
    Number of CPU sockets on the host.
    cpuThreadsPerCore Double
    Number of threads per CPU core (e.g., 2 for hyper-threading).
    id String
    Internal identifier for this data source (hash of all values).
    memoryTotalKb Double
    Total memory available on the host in kilobytes.
    numaNodes Double
    Number of NUMA nodes on the host.
    cpuCoresPerSocket number
    Number of CPU cores per socket.
    cpuCoresTotal number
    Total number of logical CPU cores available on the host.
    cpuModel string
    CPU model name (e.g., 'x86_64').
    cpuSockets number
    Number of CPU sockets on the host.
    cpuThreadsPerCore number
    Number of threads per CPU core (e.g., 2 for hyper-threading).
    id string
    Internal identifier for this data source (hash of all values).
    memoryTotalKb number
    Total memory available on the host in kilobytes.
    numaNodes number
    Number of NUMA nodes on the host.
    cpu_cores_per_socket float
    Number of CPU cores per socket.
    cpu_cores_total float
    Total number of logical CPU cores available on the host.
    cpu_model str
    CPU model name (e.g., 'x86_64').
    cpu_sockets float
    Number of CPU sockets on the host.
    cpu_threads_per_core float
    Number of threads per CPU core (e.g., 2 for hyper-threading).
    id str
    Internal identifier for this data source (hash of all values).
    memory_total_kb float
    Total memory available on the host in kilobytes.
    numa_nodes float
    Number of NUMA nodes on the host.
    cpuCoresPerSocket Number
    Number of CPU cores per socket.
    cpuCoresTotal Number
    Total number of logical CPU cores available on the host.
    cpuModel String
    CPU model name (e.g., 'x86_64').
    cpuSockets Number
    Number of CPU sockets on the host.
    cpuThreadsPerCore Number
    Number of threads per CPU core (e.g., 2 for hyper-threading).
    id String
    Internal identifier for this data source (hash of all values).
    memoryTotalKb Number
    Total memory available on the host in kilobytes.
    numaNodes Number
    Number of NUMA nodes on the host.

    Package Details

    Repository
    libvirt dmacvicar/terraform-provider-libvirt
    License
    Notes
    This Pulumi package is based on the libvirt Terraform Provider.
    libvirt logo
    libvirt 0.9.0 published on Saturday, Nov 8, 2025 by dmacvicar
      Meet Neo: Your AI Platform Teammate