Show / Hide Table of Contents

Class VmfsDatastore

The vsphere..VmfsDatastore resource can be used to create and manage VMFS datastores on an ESXi host or a set of hosts. The resource supports using any SCSI device that can generally be used in a datastore, such as local disks, or disks presented to a host or multiple hosts over Fibre Channel or iSCSI. Devices can be specified manually, or discovered using the vsphere..getVmfsDisks data source.

Auto-Mounting of Datastores Within vCenter

Note that the current behaviour of this resource will auto-mount any created datastores to any other host within vCenter that has access to the same disk.

Example: You want to create a datastore with a iSCSI LUN that is visible on 3 hosts in a single vSphere cluster (esxi1, esxi2 and esxi3). When you create the datastore on esxi1, the datastore will be automatically mounted on esxi2 and esxi3, without the need to configure the resource on either of those two hosts.

Future versions of this resource may allow you to control the hosts that a datastore is mounted to, but currently, this automatic behaviour cannot be changed, so keep this in mind when writing your configurations and deploying your disks.

Increasing Datastore Size

To increase the size of a datastore, you must add additional disks to the disks attribute. Expanding the size of a datastore by increasing the size of an already provisioned disk is currently not supported (but may be in future versions of this resource).

NOTE: You cannot decrease the size of a datastore. If the resource detects disks removed from the configuration, the provider will give an error.

Example Usage

Addition of local disks on a single host

using Pulumi;
using VSphere = Pulumi.VSphere;

class MyStack : Stack
{
public MyStack()
{
    var datacenter = Output.Create(VSphere.GetDatacenter.InvokeAsync());
    var esxiHost = datacenter.Apply(datacenter => Output.Create(VSphere.GetHost.InvokeAsync(new VSphere.GetHostArgs
    {
        DatacenterId = datacenter.Id,
    })));
    var datastore = new VSphere.VmfsDatastore("datastore", new VSphere.VmfsDatastoreArgs
    {
        Disks = 
        {
            "mpx.vmhba1:C0:T1:L0",
            "mpx.vmhba1:C0:T2:L0",
            "mpx.vmhba1:C0:T2:L0",
        },
        HostSystemId = esxiHost.Apply(esxiHost => esxiHost.Id),
    });
}

}

Auto-detection of disks via vsphere..getVmfsDisks

using Pulumi;
using VSphere = Pulumi.VSphere;

class MyStack : Stack
{
public MyStack()
{
    var datacenter = Output.Create(VSphere.GetDatacenter.InvokeAsync(new VSphere.GetDatacenterArgs
    {
        Name = "dc1",
    }));
    var esxiHost = datacenter.Apply(datacenter => Output.Create(VSphere.GetHost.InvokeAsync(new VSphere.GetHostArgs
    {
        DatacenterId = datacenter.Id,
        Name = "esxi1",
    })));
    var available = esxiHost.Apply(esxiHost => Output.Create(VSphere.GetVmfsDisks.InvokeAsync(new VSphere.GetVmfsDisksArgs
    {
        Filter = "naa.60a98000",
        HostSystemId = esxiHost.Id,
        Rescan = true,
    })));
    var datastore = new VSphere.VmfsDatastore("datastore", new VSphere.VmfsDatastoreArgs
    {
        Disks = available.Apply(available => available.Disks),
        Folder = "datastore-folder",
        HostSystemId = esxiHost.Apply(esxiHost => esxiHost.Id),
    });
}

}
Inheritance
System.Object
Resource
CustomResource
VmfsDatastore
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.VSphere
Assembly: Pulumi.VSphere.dll
Syntax
public class VmfsDatastore : CustomResource

Constructors

View Source

VmfsDatastore(String, VmfsDatastoreArgs, CustomResourceOptions)

Create a VmfsDatastore resource with the given unique name, arguments, and options.

Declaration
public VmfsDatastore(string name, VmfsDatastoreArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

VmfsDatastoreArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

Accessible

The connectivity status of the datastore. If this is false, some other computed attributes may be out of date.

Declaration
public Output<bool> Accessible { get; }
Property Value
Type Description
Output<System.Boolean>
View Source

Capacity

Maximum capacity of the datastore, in megabytes.

Declaration
public Output<int> Capacity { get; }
Property Value
Type Description
Output<System.Int32>
View Source

CustomAttributes

Map of custom attribute ids to attribute value string to set on datastore resource.

Declaration
public Output<ImmutableDictionary<string, string>> CustomAttributes { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.String>>
View Source

DatastoreClusterId

The managed object ID of a datastore cluster to put this datastore in. Conflicts with folder.

Declaration
public Output<string> DatastoreClusterId { get; }
Property Value
Type Description
Output<System.String>
View Source

Disks

The disks to use with the datastore.

Declaration
public Output<ImmutableArray<string>> Disks { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.String>>
View Source

Folder

The relative path to a folder to put this datastore in. This is a path relative to the datacenter you are deploying the datastore to. Example: for the dc1 datacenter, and a provided folder of foo/bar, The provider will place a datastore named test in a datastore folder located at /dc1/datastore/foo/bar, with the final inventory path being /dc1/datastore/foo/bar/test. Conflicts with datastore_cluster_id.

Declaration
public Output<string> Folder { get; }
Property Value
Type Description
Output<System.String>
View Source

FreeSpace

Available space of this datastore, in megabytes.

Declaration
public Output<int> FreeSpace { get; }
Property Value
Type Description
Output<System.Int32>
View Source

HostSystemId

The managed object ID of the host to set the datastore up on. Note that this is not necessarily the only host that the datastore will be set up on - see here for more info. Forces a new resource if changed.

Declaration
public Output<string> HostSystemId { get; }
Property Value
Type Description
Output<System.String>
View Source

MaintenanceMode

The current maintenance mode state of the datastore.

Declaration
public Output<string> MaintenanceMode { get; }
Property Value
Type Description
Output<System.String>
View Source

MultipleHostAccess

If true, more than one host in the datacenter has been configured with access to the datastore.

Declaration
public Output<bool> MultipleHostAccess { get; }
Property Value
Type Description
Output<System.Boolean>
View Source

Name

The name of the datastore. Forces a new resource if changed.

Declaration
public Output<string> Name { get; }
Property Value
Type Description
Output<System.String>
View Source

Tags

The IDs of any tags to attach to this resource.

Declaration
public Output<ImmutableArray<string>> Tags { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.String>>
View Source

UncommittedSpace

Total additional storage space, in megabytes, potentially used by all virtual machines on this datastore.

Declaration
public Output<int> UncommittedSpace { get; }
Property Value
Type Description
Output<System.Int32>
View Source

Url

The unique locator for the datastore.

Declaration
public Output<string> Url { get; }
Property Value
Type Description
Output<System.String>

Methods

View Source

Get(String, Input<String>, VmfsDatastoreState, CustomResourceOptions)

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

Declaration
public static VmfsDatastore Get(string name, Input<string> id, VmfsDatastoreState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

VmfsDatastoreState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
VmfsDatastore
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.