libvirt 0.9.0 published on Saturday, Nov 8, 2025 by dmacvicar
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 dictionarygetNodeInfo Result
The following output properties are available:
- Cpu
Cores doublePer Socket - Number of CPU cores per socket.
- Cpu
Cores doubleTotal - Total number of logical CPU cores available on the host.
- Cpu
Model string - CPU model name (e.g., 'x86_64').
- Cpu
Sockets double - Number of CPU sockets on the host.
- Cpu
Threads doublePer Core - Number of threads per CPU core (e.g., 2 for hyper-threading).
- Id string
- Internal identifier for this data source (hash of all values).
- Memory
Total doubleKb - Total memory available on the host in kilobytes.
- Numa
Nodes double - Number of NUMA nodes on the host.
- Cpu
Cores float64Per Socket - Number of CPU cores per socket.
- Cpu
Cores float64Total - Total number of logical CPU cores available on the host.
- Cpu
Model string - CPU model name (e.g., 'x86_64').
- Cpu
Sockets float64 - Number of CPU sockets on the host.
- Cpu
Threads float64Per Core - Number of threads per CPU core (e.g., 2 for hyper-threading).
- Id string
- Internal identifier for this data source (hash of all values).
- Memory
Total float64Kb - Total memory available on the host in kilobytes.
- Numa
Nodes float64 - Number of NUMA nodes on the host.
- cpu
Cores DoublePer Socket - Number of CPU cores per socket.
- cpu
Cores DoubleTotal - Total number of logical CPU cores available on the host.
- cpu
Model String - CPU model name (e.g., 'x86_64').
- cpu
Sockets Double - Number of CPU sockets on the host.
- cpu
Threads DoublePer Core - Number of threads per CPU core (e.g., 2 for hyper-threading).
- id String
- Internal identifier for this data source (hash of all values).
- memory
Total DoubleKb - Total memory available on the host in kilobytes.
- numa
Nodes Double - Number of NUMA nodes on the host.
- cpu
Cores numberPer Socket - Number of CPU cores per socket.
- cpu
Cores numberTotal - Total number of logical CPU cores available on the host.
- cpu
Model string - CPU model name (e.g., 'x86_64').
- cpu
Sockets number - Number of CPU sockets on the host.
- cpu
Threads numberPer Core - Number of threads per CPU core (e.g., 2 for hyper-threading).
- id string
- Internal identifier for this data source (hash of all values).
- memory
Total numberKb - Total memory available on the host in kilobytes.
- numa
Nodes number - Number of NUMA nodes on the host.
- cpu_
cores_ floatper_ socket - Number of CPU cores per socket.
- cpu_
cores_ floattotal - 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_ floatper_ core - 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_ floatkb - Total memory available on the host in kilobytes.
- numa_
nodes float - Number of NUMA nodes on the host.
- cpu
Cores NumberPer Socket - Number of CPU cores per socket.
- cpu
Cores NumberTotal - Total number of logical CPU cores available on the host.
- cpu
Model String - CPU model name (e.g., 'x86_64').
- cpu
Sockets Number - Number of CPU sockets on the host.
- cpu
Threads NumberPer Core - Number of threads per CPU core (e.g., 2 for hyper-threading).
- id String
- Internal identifier for this data source (hash of all values).
- memory
Total NumberKb - Total memory available on the host in kilobytes.
- numa
Nodes 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
libvirtTerraform Provider.
libvirt 0.9.0 published on Saturday, Nov 8, 2025 by dmacvicar
