libvirt.Pool
Explore with Pulumi AI
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", {
name: "cluster",
type: "dir",
target: {
path: "/home/user/cluster_storage",
},
});
const opensuseLeap = new libvirt.Volume("opensuse_leap", {
name: "opensuse_leap",
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",
name="cluster",
type="dir",
target={
"path": "/home/user/cluster_storage",
})
opensuse_leap = libvirt.Volume("opensuse_leap",
name="opensuse_leap",
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{
Name: pulumi.String("cluster"),
Type: pulumi.String("dir"),
Target: &libvirt.PoolTargetArgs{
Path: pulumi.String("/home/user/cluster_storage"),
},
})
if err != nil {
return err
}
_, err = libvirt.NewVolume(ctx, "opensuse_leap", &libvirt.VolumeArgs{
Name: pulumi.String("opensuse_leap"),
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()
{
Name = "cluster",
Type = "dir",
Target = new Libvirt.Inputs.PoolTargetArgs
{
Path = "/home/user/cluster_storage",
},
});
var opensuseLeap = new Libvirt.Volume("opensuse_leap", new()
{
Name = "opensuse_leap",
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.inputs.PoolTargetArgs;
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) {
// A pool for all cluster volumes
var cluster = new Pool("cluster", PoolArgs.builder()
.name("cluster")
.type("dir")
.target(PoolTargetArgs.builder()
.path("/home/user/cluster_storage")
.build())
.build());
var opensuseLeap = new Volume("opensuseLeap", VolumeArgs.builder()
.name("opensuse_leap")
.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:
name: cluster
type: dir
target:
path: /home/user/cluster_storage
opensuseLeap:
type: libvirt:Volume
name: opensuse_leap
properties:
name: opensuse_leap
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,
source: Optional[PoolSourceArgs] = None,
target: Optional[PoolTargetArgs] = 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)
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.
Constructor 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",
Source = new Libvirt.Inputs.PoolSourceArgs
{
Devices = new[]
{
new Libvirt.Inputs.PoolSourceDeviceArgs
{
Path = "string",
},
},
Name = "string",
},
Target = new Libvirt.Inputs.PoolTargetArgs
{
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"),
Source: &libvirt.PoolSourceArgs{
Devices: libvirt.PoolSourceDeviceArray{
&libvirt.PoolSourceDeviceArgs{
Path: pulumi.String("string"),
},
},
Name: pulumi.String("string"),
},
Target: &libvirt.PoolTargetArgs{
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")
.source(PoolSourceArgs.builder()
.devices(PoolSourceDeviceArgs.builder()
.path("string")
.build())
.name("string")
.build())
.target(PoolTargetArgs.builder()
.path("string")
.build())
.xml(PoolXmlArgs.builder()
.xslt("string")
.build())
.build());
pool_resource = libvirt.Pool("poolResource",
type="string",
allocation=0,
available=0,
capacity=0,
name="string",
source={
"devices": [{
"path": "string",
}],
"name": "string",
},
target={
"path": "string",
},
xml={
"xslt": "string",
})
const poolResource = new libvirt.Pool("poolResource", {
type: "string",
allocation: 0,
available: 0,
capacity: 0,
name: "string",
source: {
devices: [{
path: "string",
}],
name: "string",
},
target: {
path: "string",
},
xml: {
xslt: "string",
},
});
type: libvirt:Pool
properties:
allocation: 0
available: 0
capacity: 0
name: string
source:
devices:
- path: string
name: string
target:
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Pool resource accepts the following input properties:
- Type string
- The type of the pool. Currently, "dir" and "logical" are supported.
- Allocation int
- Available int
- Capacity int
- Name string
- A unique name for the resource, required by libvirt.
- Path string
- Deprecated (Optional) use
path
in thetarget
block. - Source
Pool
Source - Target
Pool
Target - Xml
Pool
Xml
- Type string
- The type of the pool. Currently, "dir" and "logical" are supported.
- Allocation int
- Available int
- Capacity int
- Name string
- A unique name for the resource, required by libvirt.
- Path string
- Deprecated (Optional) use
path
in thetarget
block. - Source
Pool
Source Args - Target
Pool
Target Args - Xml
Pool
Xml Args
- type String
- The type of the pool. Currently, "dir" and "logical" are supported.
- allocation Integer
- available Integer
- capacity Integer
- name String
- A unique name for the resource, required by libvirt.
- path String
- Deprecated (Optional) use
path
in thetarget
block. - source
Pool
Source - target
Pool
Target - xml
Pool
Xml
- type string
- The type of the pool. Currently, "dir" and "logical" are supported.
- allocation number
- available number
- capacity number
- name string
- A unique name for the resource, required by libvirt.
- path string
- Deprecated (Optional) use
path
in thetarget
block. - source
Pool
Source - target
Pool
Target - xml
Pool
Xml
- type str
- The type of the pool. Currently, "dir" and "logical" are supported.
- allocation int
- available int
- capacity int
- name str
- A unique name for the resource, required by libvirt.
- path str
- Deprecated (Optional) use
path
in thetarget
block. - source
Pool
Source Args - target
Pool
Target Args - xml
Pool
Xml Args
- type String
- The type of the pool. Currently, "dir" and "logical" are supported.
- allocation Number
- available Number
- capacity Number
- name String
- A unique name for the resource, required by libvirt.
- path String
- Deprecated (Optional) use
path
in thetarget
block. - source Property Map
- target Property Map
- 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,
source: Optional[PoolSourceArgs] = None,
target: Optional[PoolTargetArgs] = 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.
- Allocation int
- Available int
- Capacity int
- Name string
- A unique name for the resource, required by libvirt.
- Path string
- Deprecated (Optional) use
path
in thetarget
block. - Source
Pool
Source - Target
Pool
Target - Type string
- The type of the pool. Currently, "dir" and "logical" are supported.
- Xml
Pool
Xml
- Allocation int
- Available int
- Capacity int
- Name string
- A unique name for the resource, required by libvirt.
- Path string
- Deprecated (Optional) use
path
in thetarget
block. - Source
Pool
Source Args - Target
Pool
Target Args - Type string
- The type of the pool. Currently, "dir" and "logical" are supported.
- Xml
Pool
Xml Args
- allocation Integer
- available Integer
- capacity Integer
- name String
- A unique name for the resource, required by libvirt.
- path String
- Deprecated (Optional) use
path
in thetarget
block. - source
Pool
Source - target
Pool
Target - type String
- The type of the pool. Currently, "dir" and "logical" are supported.
- xml
Pool
Xml
- allocation number
- available number
- capacity number
- name string
- A unique name for the resource, required by libvirt.
- path string
- Deprecated (Optional) use
path
in thetarget
block. - source
Pool
Source - target
Pool
Target - type string
- The type of the pool. Currently, "dir" and "logical" are supported.
- xml
Pool
Xml
- allocation int
- available int
- capacity int
- name str
- A unique name for the resource, required by libvirt.
- path str
- Deprecated (Optional) use
path
in thetarget
block. - source
Pool
Source Args - target
Pool
Target Args - type str
- The type of the pool. Currently, "dir" and "logical" are supported.
- xml
Pool
Xml Args
- allocation Number
- available Number
- capacity Number
- name String
- A unique name for the resource, required by libvirt.
- path String
- Deprecated (Optional) use
path
in thetarget
block. - source Property Map
- target Property Map
- type String
- The type of the pool. Currently, "dir" and "logical" are supported.
- xml Property Map
Supporting Types
PoolSource, PoolSourceArgs
- Devices
List<Pool
Source Device> - Name string
- A unique name for the resource, required by libvirt.
- Devices
[]Pool
Source Device - Name string
- A unique name for the resource, required by libvirt.
- devices
List<Pool
Source Device> - name String
- A unique name for the resource, required by libvirt.
- devices
Pool
Source Device[] - name string
- A unique name for the resource, required by libvirt.
- devices
Sequence[Pool
Source Device] - name str
- A unique name for the resource, required by libvirt.
- devices List<Property Map>
- name String
- A unique name for the resource, required by libvirt.
PoolSourceDevice, PoolSourceDeviceArgs
- Path string
- Deprecated (Optional) use
path
in thetarget
block.
- Path string
- Deprecated (Optional) use
path
in thetarget
block.
- path String
- Deprecated (Optional) use
path
in thetarget
block.
- path string
- Deprecated (Optional) use
path
in thetarget
block.
- path str
- Deprecated (Optional) use
path
in thetarget
block.
- path String
- Deprecated (Optional) use
path
in thetarget
block.
PoolTarget, PoolTargetArgs
- Path string
- Deprecated (Optional) use
path
in thetarget
block.
- Path string
- Deprecated (Optional) use
path
in thetarget
block.
- path String
- Deprecated (Optional) use
path
in thetarget
block.
- path string
- Deprecated (Optional) use
path
in thetarget
block.
- path str
- Deprecated (Optional) use
path
in thetarget
block.
- path String
- Deprecated (Optional) use
path
in thetarget
block.
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.