Volume

Manages a storage volume in libvirt. For more information see the official documentation.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Libvirt = Pulumi.Libvirt;

class MyStack : Stack
{
    public MyStack()
    {
        // Base OS image to use to create a cluster of different
        // nodes
        var opensuseLeap = new Libvirt.Volume("opensuseLeap", new Libvirt.VolumeArgs
        {
            Source = "http://download.opensuse.org/repositories/Cloud:/Images:/Leap_42.1/images/openSUSE-Leap-42.1-OpenStack.x86_64.qcow2",
        });
        // volume to attach to the "master" domain as main disk
        var master = new Libvirt.Volume("master", new Libvirt.VolumeArgs
        {
            BaseVolumeId = opensuseLeap.Id,
        });
        // volumes to attach to the "workers" domains as main disk
        var worker = new List<Libvirt.Volume>();
        for (var rangeIndex = 0; rangeIndex < @var.Workers_count; rangeIndex++)
        {
            var range = new { Value = rangeIndex };
            worker.Add(new Libvirt.Volume($"worker-{range.Value}", new Libvirt.VolumeArgs
            {
                BaseVolumeId = opensuseLeap.Id,
            }));
        }
    }

}
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 {
		opensuseLeap, err := libvirt.NewVolume(ctx, "opensuseLeap", &libvirt.VolumeArgs{
			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
		}
		_, err = libvirt.NewVolume(ctx, "master", &libvirt.VolumeArgs{
			BaseVolumeId: opensuseLeap.ID(),
		})
		if err != nil {
			return err
		}
		var worker []*libvirt.Volume
		for key0, _ := range _var.Workers_count {
			__res, err := libvirt.NewVolume(ctx, fmt.Sprintf("worker-%v", key0), &libvirt.VolumeArgs{
				BaseVolumeId: opensuseLeap.ID(),
			})
			if err != nil {
				return err
			}
			worker = append(worker, __res)
		}
		return nil
	})
}
import pulumi
import pulumi_libvirt as libvirt

# Base OS image to use to create a cluster of different
# nodes
opensuse_leap = libvirt.Volume("opensuseLeap", source="http://download.opensuse.org/repositories/Cloud:/Images:/Leap_42.1/images/openSUSE-Leap-42.1-OpenStack.x86_64.qcow2")
# volume to attach to the "master" domain as main disk
master = libvirt.Volume("master", base_volume_id=opensuse_leap.id)
# volumes to attach to the "workers" domains as main disk
worker = []
for range in [{"value": i} for i in range(0, var.workers_count)]:
    worker.append(libvirt.Volume(f"worker-{range['value']}", base_volume_id=opensuse_leap.id))
import * as pulumi from "@pulumi/pulumi";
import * as libvirt from "@pulumi/libvirt";

// Base OS image to use to create a cluster of different
// nodes
const opensuseLeap = new libvirt.Volume("opensuseLeap", {source: "http://download.opensuse.org/repositories/Cloud:/Images:/Leap_42.1/images/openSUSE-Leap-42.1-OpenStack.x86_64.qcow2"});
// volume to attach to the "master" domain as main disk
const master = new libvirt.Volume("master", {baseVolumeId: opensuseLeap.id});
// volumes to attach to the "workers" domains as main disk
const worker: libvirt.Volume[];
for (const range = {value: 0}; range.value < _var.workers_count; range.value++) {
    worker.push(new libvirt.Volume(`worker-${range.value}`, {baseVolumeId: opensuseLeap.id}));
}

Create a Volume Resource

new Volume(name: string, args?: VolumeArgs, opts?: CustomResourceOptions);
@overload
def Volume(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           base_volume_id: Optional[str] = None,
           base_volume_name: Optional[str] = None,
           base_volume_pool: Optional[str] = None,
           format: Optional[str] = None,
           name: Optional[str] = None,
           pool: Optional[str] = None,
           size: Optional[int] = None,
           source: Optional[str] = None,
           xml: Optional[VolumeXmlArgs] = None)
@overload
def Volume(resource_name: str,
           args: Optional[VolumeArgs] = None,
           opts: Optional[ResourceOptions] = None)
func NewVolume(ctx *Context, name string, args *VolumeArgs, opts ...ResourceOption) (*Volume, error)
public Volume(string name, VolumeArgs? args = null, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args VolumeArgs
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 VolumeArgs
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 VolumeArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args VolumeArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Volume Resource Properties

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

Inputs

The Volume resource accepts the following input properties:

BaseVolumeId string
The backing volume (CoW) to use for this volume.
BaseVolumeName string
The name of the backing volume (CoW) to use for this volume. Note well: when base_volume_pool is not specified the volume is going to be searched inside of pool.
BaseVolumePool string
The name of the storage pool containing the volume defined by base_volume_name.
Format string
Name string
A unique name for the resource, required by libvirt. Changing this forces a new resource to be created.
Pool string
The storage pool where the resource will be created. If not given, the default storage pool will be used.
Size int
Source string
Xml VolumeXmlArgs
BaseVolumeId string
The backing volume (CoW) to use for this volume.
BaseVolumeName string
The name of the backing volume (CoW) to use for this volume. Note well: when base_volume_pool is not specified the volume is going to be searched inside of pool.
BaseVolumePool string
The name of the storage pool containing the volume defined by base_volume_name.
Format string
Name string
A unique name for the resource, required by libvirt. Changing this forces a new resource to be created.
Pool string
The storage pool where the resource will be created. If not given, the default storage pool will be used.
Size int
Source string
Xml VolumeXml
baseVolumeId string
The backing volume (CoW) to use for this volume.
baseVolumeName string
The name of the backing volume (CoW) to use for this volume. Note well: when base_volume_pool is not specified the volume is going to be searched inside of pool.
baseVolumePool string
The name of the storage pool containing the volume defined by base_volume_name.
format string
name string
A unique name for the resource, required by libvirt. Changing this forces a new resource to be created.
pool string
The storage pool where the resource will be created. If not given, the default storage pool will be used.
size number
source string
xml VolumeXmlArgs
base_volume_id str
The backing volume (CoW) to use for this volume.
base_volume_name str
The name of the backing volume (CoW) to use for this volume. Note well: when base_volume_pool is not specified the volume is going to be searched inside of pool.
base_volume_pool str
The name of the storage pool containing the volume defined by base_volume_name.
format str
name str
A unique name for the resource, required by libvirt. Changing this forces a new resource to be created.
pool str
The storage pool where the resource will be created. If not given, the default storage pool will be used.
size int
source str
xml VolumeXmlArgs

Outputs

All input properties are implicitly available as output properties. Additionally, the Volume 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 str
The provider-assigned unique ID for this managed resource.

Look up an Existing Volume Resource

Get an existing Volume 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?: VolumeState, opts?: CustomResourceOptions): Volume
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        base_volume_id: Optional[str] = None,
        base_volume_name: Optional[str] = None,
        base_volume_pool: Optional[str] = None,
        format: Optional[str] = None,
        name: Optional[str] = None,
        pool: Optional[str] = None,
        size: Optional[int] = None,
        source: Optional[str] = None,
        xml: Optional[VolumeXmlArgs] = None) -> Volume
func GetVolume(ctx *Context, name string, id IDInput, state *VolumeState, opts ...ResourceOption) (*Volume, error)
public static Volume Get(string name, Input<string> id, VolumeState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

BaseVolumeId string
The backing volume (CoW) to use for this volume.
BaseVolumeName string
The name of the backing volume (CoW) to use for this volume. Note well: when base_volume_pool is not specified the volume is going to be searched inside of pool.
BaseVolumePool string
The name of the storage pool containing the volume defined by base_volume_name.
Format string
Name string
A unique name for the resource, required by libvirt. Changing this forces a new resource to be created.
Pool string
The storage pool where the resource will be created. If not given, the default storage pool will be used.
Size int
Source string
Xml VolumeXmlArgs
BaseVolumeId string
The backing volume (CoW) to use for this volume.
BaseVolumeName string
The name of the backing volume (CoW) to use for this volume. Note well: when base_volume_pool is not specified the volume is going to be searched inside of pool.
BaseVolumePool string
The name of the storage pool containing the volume defined by base_volume_name.
Format string
Name string
A unique name for the resource, required by libvirt. Changing this forces a new resource to be created.
Pool string
The storage pool where the resource will be created. If not given, the default storage pool will be used.
Size int
Source string
Xml VolumeXml
baseVolumeId string
The backing volume (CoW) to use for this volume.
baseVolumeName string
The name of the backing volume (CoW) to use for this volume. Note well: when base_volume_pool is not specified the volume is going to be searched inside of pool.
baseVolumePool string
The name of the storage pool containing the volume defined by base_volume_name.
format string
name string
A unique name for the resource, required by libvirt. Changing this forces a new resource to be created.
pool string
The storage pool where the resource will be created. If not given, the default storage pool will be used.
size number
source string
xml VolumeXmlArgs
base_volume_id str
The backing volume (CoW) to use for this volume.
base_volume_name str
The name of the backing volume (CoW) to use for this volume. Note well: when base_volume_pool is not specified the volume is going to be searched inside of pool.
base_volume_pool str
The name of the storage pool containing the volume defined by base_volume_name.
format str
name str
A unique name for the resource, required by libvirt. Changing this forces a new resource to be created.
pool str
The storage pool where the resource will be created. If not given, the default storage pool will be used.
size int
source str
xml VolumeXmlArgs

Supporting Types

VolumeXml

Xslt string
Xslt string
xslt string
xslt str

Package Details

Repository
https://github.com/pulumi/pulumi-libvirt
License
Apache-2.0
Notes
This Pulumi package is based on the libvirt Terraform Provider.