libvirt.Volume
Explore with Pulumi AI
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;
return await Deployment.RunAsync(() =>
{
// Base OS image to use to create a cluster of different
// nodes
var opensuseLeap = new Libvirt.Volume("opensuseLeap", new()
{
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()
{
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()
{
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 index := 0; index < _var.Workers_count; index++ {
key0 := index
_ := index
__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
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.libvirt.Volume;
import com.pulumi.libvirt.VolumeArgs;
import com.pulumi.codegen.internal.KeyedValue;
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 opensuseLeap = new Volume("opensuseLeap", VolumeArgs.builder()
.source("http://download.opensuse.org/repositories/Cloud:/Images:/Leap_42.1/images/openSUSE-Leap-42.1-OpenStack.x86_64.qcow2")
.build());
var master = new Volume("master", VolumeArgs.builder()
.baseVolumeId(opensuseLeap.id())
.build());
for (var i = 0; i < var_.workers_count(); i++) {
new Volume("worker-" + i, VolumeArgs.builder()
.baseVolumeId(opensuseLeap.id())
.build());
}
}
}
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}));
}
resources:
# Base OS image to use to create a cluster of different
# nodes
opensuseLeap:
type: libvirt:Volume
properties:
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:
type: libvirt:Volume
properties:
baseVolumeId: ${opensuseLeap.id}
# volumes to attach to the "workers" domains as main disk
worker:
type: libvirt:Volume
properties:
baseVolumeId: ${opensuseLeap.id}
options: {}
Create 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)
public Volume(String name, VolumeArgs args)
public Volume(String name, VolumeArgs args, CustomResourceOptions options)
type: libvirt:Volume
properties: # The arguments to resource properties.
options: # 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.
- 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.
- name String
- The unique name of the resource.
- args VolumeArgs
- The arguments to resource properties.
- options 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 Architecture and Concepts docs.
Inputs
The Volume resource accepts the following input properties:
- Base
Volume stringId The backing volume (CoW) to use for this volume.
- Base
Volume stringName 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 ofpool
.- Base
Volume stringPool 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
Volume
Xml
- Base
Volume stringId The backing volume (CoW) to use for this volume.
- Base
Volume stringName 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 ofpool
.- Base
Volume stringPool 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
Volume
Xml Args
- base
Volume StringId The backing volume (CoW) to use for this volume.
- base
Volume StringName 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 ofpool
.- base
Volume StringPool 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 Integer
- source String
- xml
Volume
Xml
- base
Volume stringId The backing volume (CoW) to use for this volume.
- base
Volume stringName 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 ofpool
.- base
Volume stringPool 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
Volume
Xml
- base_
volume_ strid The backing volume (CoW) to use for this volume.
- base_
volume_ strname 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 ofpool
.- base_
volume_ strpool 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
Volume
Xml Args
- base
Volume StringId The backing volume (CoW) to use for this volume.
- base
Volume StringName 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 ofpool
.- base
Volume StringPool 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 Property Map
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 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 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)
public static Volume get(String name, Output<String> id, VolumeState 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.
- Base
Volume stringId The backing volume (CoW) to use for this volume.
- Base
Volume stringName 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 ofpool
.- Base
Volume stringPool 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
Volume
Xml
- Base
Volume stringId The backing volume (CoW) to use for this volume.
- Base
Volume stringName 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 ofpool
.- Base
Volume stringPool 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
Volume
Xml Args
- base
Volume StringId The backing volume (CoW) to use for this volume.
- base
Volume StringName 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 ofpool
.- base
Volume StringPool 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 Integer
- source String
- xml
Volume
Xml
- base
Volume stringId The backing volume (CoW) to use for this volume.
- base
Volume stringName 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 ofpool
.- base
Volume stringPool 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
Volume
Xml
- base_
volume_ strid The backing volume (CoW) to use for this volume.
- base_
volume_ strname 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 ofpool
.- base_
volume_ strpool 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
Volume
Xml Args
- base
Volume StringId The backing volume (CoW) to use for this volume.
- base
Volume StringName 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 ofpool
.- base
Volume StringPool 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 Property Map
Supporting Types
VolumeXml, VolumeXmlArgs
- 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.