@pulumi/libvirt
Version:
A Pulumi package for creating and managing libvirt cloud resources.
186 lines (185 loc) • 8.44 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "./types/input";
import * as outputs from "./types/output";
/**
* Manages a storage volume in libvirt. For more information see
* [the official documentation](https://libvirt.org/formatstorage.html).
*
* ## Example Usage
*
* ```typescript
* 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("opensuse_leap", {
* name: "opensuse_leap",
* 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", {
* name: "master.qcow2",
* baseVolumeId: opensuseLeap.id,
* });
* // volumes to attach to the "workers" domains as main disk
* const worker: libvirt.Volume[] = [];
* for (const range = {value: 0}; range.value < workersCount; range.value++) {
* worker.push(new libvirt.Volume(`worker-${range.value}`, {
* name: `worker_${range.value}.qcow2`,
* baseVolumeId: opensuseLeap.id,
* }));
* }
* ```
*
* > **Tip:** when provisioning multiple domains using the same base image, create
* a `libvirt.Volume` for the base image and then define the domain specific ones
* as based on it. This way the image will not be modified and no extra disk space
* is going to be used for the base image.
*/
export declare class Volume extends pulumi.CustomResource {
/**
* Get an existing Volume resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: VolumeState, opts?: pulumi.CustomResourceOptions): Volume;
/**
* Returns true if the given object is an instance of Volume. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is Volume;
/**
* The backing volume (CoW) to use for this volume.
*/
readonly baseVolumeId: pulumi.Output<string | undefined>;
/**
* The name of the backing volume (CoW) to use
* for this volume. Note well: when `baseVolumePool` is not specified the
* volume is going to be searched inside of `pool`.
*/
readonly baseVolumeName: pulumi.Output<string | undefined>;
/**
* The name of the storage pool containing the
* volume defined by `baseVolumeName`.
*/
readonly baseVolumePool: pulumi.Output<string | undefined>;
readonly format: pulumi.Output<string>;
/**
* A unique name for the resource, required by libvirt.
* Changing this forces a new resource to be created.
*/
readonly name: pulumi.Output<string>;
/**
* The storage pool where the resource will be created.
* If not given, the `default` storage pool will be used.
*/
readonly pool: pulumi.Output<string | undefined>;
/**
* The size of the volume in bytes (if you don't like this,
* help fix this issue.
* If `source` is specified, `size` will be set to the source image file size.
* `size` can be omitted if `source` is specified. `size` will then be set to the source image file size.
* `size` can be omitted if `baseVolumeId` or `baseVolumeName` is specified. `size` will then be set to the base volume size.
* If `size` is specified to be bigger than `baseVolumeId` or `baseVolumeName` size, you can use [cloudinit](https://cloudinit.readthedocs.io) if your OS supports it, with `libvirt.CloudInitDisk` and the [growpart](https://cloudinit.readthedocs.io/en/latest/topics/modules.html#growpart) module to resize the partition.
*/
readonly size: pulumi.Output<number>;
readonly source: pulumi.Output<string | undefined>;
readonly xml: pulumi.Output<outputs.VolumeXml | undefined>;
/**
* Create a Volume resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args?: VolumeArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering Volume resources.
*/
export interface VolumeState {
/**
* The backing volume (CoW) to use for this volume.
*/
baseVolumeId?: pulumi.Input<string>;
/**
* The name of the backing volume (CoW) to use
* for this volume. Note well: when `baseVolumePool` is not specified the
* volume is going to be searched inside of `pool`.
*/
baseVolumeName?: pulumi.Input<string>;
/**
* The name of the storage pool containing the
* volume defined by `baseVolumeName`.
*/
baseVolumePool?: pulumi.Input<string>;
format?: pulumi.Input<string>;
/**
* A unique name for the resource, required by libvirt.
* Changing this forces a new resource to be created.
*/
name?: pulumi.Input<string>;
/**
* The storage pool where the resource will be created.
* If not given, the `default` storage pool will be used.
*/
pool?: pulumi.Input<string>;
/**
* The size of the volume in bytes (if you don't like this,
* help fix this issue.
* If `source` is specified, `size` will be set to the source image file size.
* `size` can be omitted if `source` is specified. `size` will then be set to the source image file size.
* `size` can be omitted if `baseVolumeId` or `baseVolumeName` is specified. `size` will then be set to the base volume size.
* If `size` is specified to be bigger than `baseVolumeId` or `baseVolumeName` size, you can use [cloudinit](https://cloudinit.readthedocs.io) if your OS supports it, with `libvirt.CloudInitDisk` and the [growpart](https://cloudinit.readthedocs.io/en/latest/topics/modules.html#growpart) module to resize the partition.
*/
size?: pulumi.Input<number>;
source?: pulumi.Input<string>;
xml?: pulumi.Input<inputs.VolumeXml>;
}
/**
* The set of arguments for constructing a Volume resource.
*/
export interface VolumeArgs {
/**
* The backing volume (CoW) to use for this volume.
*/
baseVolumeId?: pulumi.Input<string>;
/**
* The name of the backing volume (CoW) to use
* for this volume. Note well: when `baseVolumePool` is not specified the
* volume is going to be searched inside of `pool`.
*/
baseVolumeName?: pulumi.Input<string>;
/**
* The name of the storage pool containing the
* volume defined by `baseVolumeName`.
*/
baseVolumePool?: pulumi.Input<string>;
format?: pulumi.Input<string>;
/**
* A unique name for the resource, required by libvirt.
* Changing this forces a new resource to be created.
*/
name?: pulumi.Input<string>;
/**
* The storage pool where the resource will be created.
* If not given, the `default` storage pool will be used.
*/
pool?: pulumi.Input<string>;
/**
* The size of the volume in bytes (if you don't like this,
* help fix this issue.
* If `source` is specified, `size` will be set to the source image file size.
* `size` can be omitted if `source` is specified. `size` will then be set to the source image file size.
* `size` can be omitted if `baseVolumeId` or `baseVolumeName` is specified. `size` will then be set to the base volume size.
* If `size` is specified to be bigger than `baseVolumeId` or `baseVolumeName` size, you can use [cloudinit](https://cloudinit.readthedocs.io) if your OS supports it, with `libvirt.CloudInitDisk` and the [growpart](https://cloudinit.readthedocs.io/en/latest/topics/modules.html#growpart) module to resize the partition.
*/
size?: pulumi.Input<number>;
source?: pulumi.Input<string>;
xml?: pulumi.Input<inputs.VolumeXml>;
}