1. Packages
  2. libvirt
  3. API Docs
  4. Pool
libvirt v0.4.5 published on Thursday, Mar 21, 2024 by Pulumi

libvirt.Pool

Explore with Pulumi AI

libvirt logo
libvirt v0.4.5 published on Thursday, Mar 21, 2024 by Pulumi

    Manages a storage pool in libvirt. Currently only directory-based storage pool are supported. For more information on storage pools in libvirt, see the official documentation.

    WARNING: This is experimental API and may change in the future.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as libvirt from "@pulumi/libvirt";
    
    // A pool for all cluster volumes
    const cluster = new libvirt.Pool("cluster", {
        type: "dir",
        path: "/home/user/cluster_storage",
    });
    const opensuseLeap = new libvirt.Volume("opensuseLeap", {
        pool: cluster.name,
        source: "http://download.opensuse.org/repositories/Cloud:/Images:/Leap_42.1/images/openSUSE-Leap-42.1-OpenStack.x86_64.qcow2",
    });
    
    import pulumi
    import pulumi_libvirt as libvirt
    
    # A pool for all cluster volumes
    cluster = libvirt.Pool("cluster",
        type="dir",
        path="/home/user/cluster_storage")
    opensuse_leap = libvirt.Volume("opensuseLeap",
        pool=cluster.name,
        source="http://download.opensuse.org/repositories/Cloud:/Images:/Leap_42.1/images/openSUSE-Leap-42.1-OpenStack.x86_64.qcow2")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-libvirt/sdk/go/libvirt"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// A pool for all cluster volumes
    		cluster, err := libvirt.NewPool(ctx, "cluster", &libvirt.PoolArgs{
    			Type: pulumi.String("dir"),
    			Path: pulumi.String("/home/user/cluster_storage"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = libvirt.NewVolume(ctx, "opensuseLeap", &libvirt.VolumeArgs{
    			Pool:   cluster.Name,
    			Source: pulumi.String("http://download.opensuse.org/repositories/Cloud:/Images:/Leap_42.1/images/openSUSE-Leap-42.1-OpenStack.x86_64.qcow2"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Libvirt = Pulumi.Libvirt;
    
    return await Deployment.RunAsync(() => 
    {
        // A pool for all cluster volumes
        var cluster = new Libvirt.Pool("cluster", new()
        {
            Type = "dir",
            Path = "/home/user/cluster_storage",
        });
    
        var opensuseLeap = new Libvirt.Volume("opensuseLeap", new()
        {
            Pool = cluster.Name,
            Source = "http://download.opensuse.org/repositories/Cloud:/Images:/Leap_42.1/images/openSUSE-Leap-42.1-OpenStack.x86_64.qcow2",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.libvirt.Pool;
    import com.pulumi.libvirt.PoolArgs;
    import com.pulumi.libvirt.Volume;
    import com.pulumi.libvirt.VolumeArgs;
    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) {
            var cluster = new Pool("cluster", PoolArgs.builder()        
                .type("dir")
                .path("/home/user/cluster_storage")
                .build());
    
            var opensuseLeap = new Volume("opensuseLeap", VolumeArgs.builder()        
                .pool(cluster.name())
                .source("http://download.opensuse.org/repositories/Cloud:/Images:/Leap_42.1/images/openSUSE-Leap-42.1-OpenStack.x86_64.qcow2")
                .build());
    
        }
    }
    
    resources:
      # A pool for all cluster volumes
      cluster:
        type: libvirt:Pool
        properties:
          type: dir
          path: /home/user/cluster_storage
      opensuseLeap:
        type: libvirt:Volume
        properties:
          pool: ${cluster.name}
          source: http://download.opensuse.org/repositories/Cloud:/Images:/Leap_42.1/images/openSUSE-Leap-42.1-OpenStack.x86_64.qcow2
    

    Create Pool Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Pool(name: string, args: PoolArgs, opts?: CustomResourceOptions);
    @overload
    def Pool(resource_name: str,
             args: PoolArgs,
             opts: Optional[ResourceOptions] = None)
    
    @overload
    def Pool(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             type: Optional[str] = None,
             allocation: Optional[int] = None,
             available: Optional[int] = None,
             capacity: Optional[int] = None,
             name: Optional[str] = None,
             path: Optional[str] = None,
             xml: Optional[PoolXmlArgs] = None)
    func NewPool(ctx *Context, name string, args PoolArgs, opts ...ResourceOption) (*Pool, error)
    public Pool(string name, PoolArgs args, CustomResourceOptions? opts = null)
    public Pool(String name, PoolArgs args)
    public Pool(String name, PoolArgs args, CustomResourceOptions options)
    
    type: libvirt:Pool
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args PoolArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args PoolArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args PoolArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args PoolArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args PoolArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var poolResource = new Libvirt.Pool("poolResource", new()
    {
        Type = "string",
        Allocation = 0,
        Available = 0,
        Capacity = 0,
        Name = "string",
        Path = "string",
        Xml = new Libvirt.Inputs.PoolXmlArgs
        {
            Xslt = "string",
        },
    });
    
    example, err := libvirt.NewPool(ctx, "poolResource", &libvirt.PoolArgs{
    	Type:       pulumi.String("string"),
    	Allocation: pulumi.Int(0),
    	Available:  pulumi.Int(0),
    	Capacity:   pulumi.Int(0),
    	Name:       pulumi.String("string"),
    	Path:       pulumi.String("string"),
    	Xml: &libvirt.PoolXmlArgs{
    		Xslt: pulumi.String("string"),
    	},
    })
    
    var poolResource = new Pool("poolResource", PoolArgs.builder()        
        .type("string")
        .allocation(0)
        .available(0)
        .capacity(0)
        .name("string")
        .path("string")
        .xml(PoolXmlArgs.builder()
            .xslt("string")
            .build())
        .build());
    
    pool_resource = libvirt.Pool("poolResource",
        type="string",
        allocation=0,
        available=0,
        capacity=0,
        name="string",
        path="string",
        xml=libvirt.PoolXmlArgs(
            xslt="string",
        ))
    
    const poolResource = new libvirt.Pool("poolResource", {
        type: "string",
        allocation: 0,
        available: 0,
        capacity: 0,
        name: "string",
        path: "string",
        xml: {
            xslt: "string",
        },
    });
    
    type: libvirt:Pool
    properties:
        allocation: 0
        available: 0
        capacity: 0
        name: string
        path: string
        type: string
        xml:
            xslt: string
    

    Pool Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The Pool resource accepts the following input properties:

    Type string
    The type of the pool. Currently, only "dir" supported.
    Allocation int
    Available int
    Capacity int
    Name string
    A unique name for the resource, required by libvirt.
    Path string
    The directory where the pool will keep all its volumes. This is only relevant to (and required by) the "dir" type pools.
    Xml PoolXml
    Type string
    The type of the pool. Currently, only "dir" supported.
    Allocation int
    Available int
    Capacity int
    Name string
    A unique name for the resource, required by libvirt.
    Path string
    The directory where the pool will keep all its volumes. This is only relevant to (and required by) the "dir" type pools.
    Xml PoolXmlArgs
    type String
    The type of the pool. Currently, only "dir" supported.
    allocation Integer
    available Integer
    capacity Integer
    name String
    A unique name for the resource, required by libvirt.
    path String
    The directory where the pool will keep all its volumes. This is only relevant to (and required by) the "dir" type pools.
    xml PoolXml
    type string
    The type of the pool. Currently, only "dir" supported.
    allocation number
    available number
    capacity number
    name string
    A unique name for the resource, required by libvirt.
    path string
    The directory where the pool will keep all its volumes. This is only relevant to (and required by) the "dir" type pools.
    xml PoolXml
    type str
    The type of the pool. Currently, only "dir" supported.
    allocation int
    available int
    capacity int
    name str
    A unique name for the resource, required by libvirt.
    path str
    The directory where the pool will keep all its volumes. This is only relevant to (and required by) the "dir" type pools.
    xml PoolXmlArgs
    type String
    The type of the pool. Currently, only "dir" supported.
    allocation Number
    available Number
    capacity Number
    name String
    A unique name for the resource, required by libvirt.
    path String
    The directory where the pool will keep all its volumes. This is only relevant to (and required by) the "dir" type pools.
    xml Property Map

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Pool resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Pool Resource

    Get an existing Pool resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: PoolState, opts?: CustomResourceOptions): Pool
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            allocation: Optional[int] = None,
            available: Optional[int] = None,
            capacity: Optional[int] = None,
            name: Optional[str] = None,
            path: Optional[str] = None,
            type: Optional[str] = None,
            xml: Optional[PoolXmlArgs] = None) -> Pool
    func GetPool(ctx *Context, name string, id IDInput, state *PoolState, opts ...ResourceOption) (*Pool, error)
    public static Pool Get(string name, Input<string> id, PoolState? state, CustomResourceOptions? opts = null)
    public static Pool get(String name, Output<String> id, PoolState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Allocation int
    Available int
    Capacity int
    Name string
    A unique name for the resource, required by libvirt.
    Path string
    The directory where the pool will keep all its volumes. This is only relevant to (and required by) the "dir" type pools.
    Type string
    The type of the pool. Currently, only "dir" supported.
    Xml PoolXml
    Allocation int
    Available int
    Capacity int
    Name string
    A unique name for the resource, required by libvirt.
    Path string
    The directory where the pool will keep all its volumes. This is only relevant to (and required by) the "dir" type pools.
    Type string
    The type of the pool. Currently, only "dir" supported.
    Xml PoolXmlArgs
    allocation Integer
    available Integer
    capacity Integer
    name String
    A unique name for the resource, required by libvirt.
    path String
    The directory where the pool will keep all its volumes. This is only relevant to (and required by) the "dir" type pools.
    type String
    The type of the pool. Currently, only "dir" supported.
    xml PoolXml
    allocation number
    available number
    capacity number
    name string
    A unique name for the resource, required by libvirt.
    path string
    The directory where the pool will keep all its volumes. This is only relevant to (and required by) the "dir" type pools.
    type string
    The type of the pool. Currently, only "dir" supported.
    xml PoolXml
    allocation int
    available int
    capacity int
    name str
    A unique name for the resource, required by libvirt.
    path str
    The directory where the pool will keep all its volumes. This is only relevant to (and required by) the "dir" type pools.
    type str
    The type of the pool. Currently, only "dir" supported.
    xml PoolXmlArgs
    allocation Number
    available Number
    capacity Number
    name String
    A unique name for the resource, required by libvirt.
    path String
    The directory where the pool will keep all its volumes. This is only relevant to (and required by) the "dir" type pools.
    type String
    The type of the pool. Currently, only "dir" supported.
    xml Property Map

    Supporting Types

    PoolXml, PoolXmlArgs

    Xslt string
    Xslt string
    xslt String
    xslt string
    xslt str
    xslt String

    Package Details

    Repository
    libvirt pulumi/pulumi-libvirt
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the libvirt Terraform Provider.
    libvirt logo
    libvirt v0.4.5 published on Thursday, Mar 21, 2024 by Pulumi