1. Packages
  2. vSphere
  3. API Docs
  4. getVmfsDisks
vSphere v4.10.1 published on Friday, May 10, 2024 by Pulumi

vsphere.getVmfsDisks

Explore with Pulumi AI

vsphere logo
vSphere v4.10.1 published on Friday, May 10, 2024 by Pulumi

    The vsphere.getVmfsDisks data source can be used to discover the storage devices available on an ESXi host. This data source can be combined with the vsphere.VmfsDatastore resource to create VMFS datastores based off a set of discovered disks.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as vsphere from "@pulumi/vsphere";
    
    const datacenter = vsphere.getDatacenter({
        name: "dc-01",
    });
    const host = datacenter.then(datacenter => vsphere.getHost({
        name: "esxi-01.example.com",
        datacenterId: datacenter.id,
    }));
    const vmfsDisks = host.then(host => vsphere.getVmfsDisks({
        hostSystemId: host.id,
        rescan: true,
        filter: "mpx.vmhba1:C0:T[12]:L0",
    }));
    
    import pulumi
    import pulumi_vsphere as vsphere
    
    datacenter = vsphere.get_datacenter(name="dc-01")
    host = vsphere.get_host(name="esxi-01.example.com",
        datacenter_id=datacenter.id)
    vmfs_disks = vsphere.get_vmfs_disks(host_system_id=host.id,
        rescan=True,
        filter="mpx.vmhba1:C0:T[12]:L0")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{
    			Name: pulumi.StringRef("dc-01"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		host, err := vsphere.LookupHost(ctx, &vsphere.LookupHostArgs{
    			Name:         pulumi.StringRef("esxi-01.example.com"),
    			DatacenterId: datacenter.Id,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = vsphere.GetVmfsDisks(ctx, &vsphere.GetVmfsDisksArgs{
    			HostSystemId: host.Id,
    			Rescan:       pulumi.BoolRef(true),
    			Filter:       pulumi.StringRef("mpx.vmhba1:C0:T[12]:L0"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using VSphere = Pulumi.VSphere;
    
    return await Deployment.RunAsync(() => 
    {
        var datacenter = VSphere.GetDatacenter.Invoke(new()
        {
            Name = "dc-01",
        });
    
        var host = VSphere.GetHost.Invoke(new()
        {
            Name = "esxi-01.example.com",
            DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id),
        });
    
        var vmfsDisks = VSphere.GetVmfsDisks.Invoke(new()
        {
            HostSystemId = host.Apply(getHostResult => getHostResult.Id),
            Rescan = true,
            Filter = "mpx.vmhba1:C0:T[12]:L0",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vsphere.VsphereFunctions;
    import com.pulumi.vsphere.inputs.GetDatacenterArgs;
    import com.pulumi.vsphere.inputs.GetHostArgs;
    import com.pulumi.vsphere.inputs.GetVmfsDisksArgs;
    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) {
            final var datacenter = VsphereFunctions.getDatacenter(GetDatacenterArgs.builder()
                .name("dc-01")
                .build());
    
            final var host = VsphereFunctions.getHost(GetHostArgs.builder()
                .name("esxi-01.example.com")
                .datacenterId(datacenter.applyValue(getDatacenterResult -> getDatacenterResult.id()))
                .build());
    
            final var vmfsDisks = VsphereFunctions.getVmfsDisks(GetVmfsDisksArgs.builder()
                .hostSystemId(host.applyValue(getHostResult -> getHostResult.id()))
                .rescan(true)
                .filter("mpx.vmhba1:C0:T[12]:L0")
                .build());
    
        }
    }
    
    variables:
      datacenter:
        fn::invoke:
          Function: vsphere:getDatacenter
          Arguments:
            name: dc-01
      host:
        fn::invoke:
          Function: vsphere:getHost
          Arguments:
            name: esxi-01.example.com
            datacenterId: ${datacenter.id}
      vmfsDisks:
        fn::invoke:
          Function: vsphere:getVmfsDisks
          Arguments:
            hostSystemId: ${host.id}
            rescan: true
            filter: mpx.vmhba1:C0:T[12]:L0
    

    Using getVmfsDisks

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getVmfsDisks(args: GetVmfsDisksArgs, opts?: InvokeOptions): Promise<GetVmfsDisksResult>
    function getVmfsDisksOutput(args: GetVmfsDisksOutputArgs, opts?: InvokeOptions): Output<GetVmfsDisksResult>
    def get_vmfs_disks(filter: Optional[str] = None,
                       host_system_id: Optional[str] = None,
                       rescan: Optional[bool] = None,
                       opts: Optional[InvokeOptions] = None) -> GetVmfsDisksResult
    def get_vmfs_disks_output(filter: Optional[pulumi.Input[str]] = None,
                       host_system_id: Optional[pulumi.Input[str]] = None,
                       rescan: Optional[pulumi.Input[bool]] = None,
                       opts: Optional[InvokeOptions] = None) -> Output[GetVmfsDisksResult]
    func GetVmfsDisks(ctx *Context, args *GetVmfsDisksArgs, opts ...InvokeOption) (*GetVmfsDisksResult, error)
    func GetVmfsDisksOutput(ctx *Context, args *GetVmfsDisksOutputArgs, opts ...InvokeOption) GetVmfsDisksResultOutput

    > Note: This function is named GetVmfsDisks in the Go SDK.

    public static class GetVmfsDisks 
    {
        public static Task<GetVmfsDisksResult> InvokeAsync(GetVmfsDisksArgs args, InvokeOptions? opts = null)
        public static Output<GetVmfsDisksResult> Invoke(GetVmfsDisksInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetVmfsDisksResult> getVmfsDisks(GetVmfsDisksArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: vsphere:index/getVmfsDisks:getVmfsDisks
      arguments:
        # arguments dictionary

    The following arguments are supported:

    HostSystemId string
    The managed object ID of the host to look for disks on.
    Filter string

    A regular expression to filter the disks against. Only disks with canonical names that match will be included.

    NOTE: Using a filter is recommended if there is any chance the host will have any specific storage devices added to it that may affect the order of the output disks attribute below, which is lexicographically sorted.

    Rescan bool
    Whether or not to rescan storage adapters before searching for disks. This may lengthen the time it takes to perform the search. Default: false.
    HostSystemId string
    The managed object ID of the host to look for disks on.
    Filter string

    A regular expression to filter the disks against. Only disks with canonical names that match will be included.

    NOTE: Using a filter is recommended if there is any chance the host will have any specific storage devices added to it that may affect the order of the output disks attribute below, which is lexicographically sorted.

    Rescan bool
    Whether or not to rescan storage adapters before searching for disks. This may lengthen the time it takes to perform the search. Default: false.
    hostSystemId String
    The managed object ID of the host to look for disks on.
    filter String

    A regular expression to filter the disks against. Only disks with canonical names that match will be included.

    NOTE: Using a filter is recommended if there is any chance the host will have any specific storage devices added to it that may affect the order of the output disks attribute below, which is lexicographically sorted.

    rescan Boolean
    Whether or not to rescan storage adapters before searching for disks. This may lengthen the time it takes to perform the search. Default: false.
    hostSystemId string
    The managed object ID of the host to look for disks on.
    filter string

    A regular expression to filter the disks against. Only disks with canonical names that match will be included.

    NOTE: Using a filter is recommended if there is any chance the host will have any specific storage devices added to it that may affect the order of the output disks attribute below, which is lexicographically sorted.

    rescan boolean
    Whether or not to rescan storage adapters before searching for disks. This may lengthen the time it takes to perform the search. Default: false.
    host_system_id str
    The managed object ID of the host to look for disks on.
    filter str

    A regular expression to filter the disks against. Only disks with canonical names that match will be included.

    NOTE: Using a filter is recommended if there is any chance the host will have any specific storage devices added to it that may affect the order of the output disks attribute below, which is lexicographically sorted.

    rescan bool
    Whether or not to rescan storage adapters before searching for disks. This may lengthen the time it takes to perform the search. Default: false.
    hostSystemId String
    The managed object ID of the host to look for disks on.
    filter String

    A regular expression to filter the disks against. Only disks with canonical names that match will be included.

    NOTE: Using a filter is recommended if there is any chance the host will have any specific storage devices added to it that may affect the order of the output disks attribute below, which is lexicographically sorted.

    rescan Boolean
    Whether or not to rescan storage adapters before searching for disks. This may lengthen the time it takes to perform the search. Default: false.

    getVmfsDisks Result

    The following output properties are available:

    Disks List<string>
    A lexicographically sorted list of devices discovered by the operation, matching the supplied filter, if provided.
    HostSystemId string
    Id string
    The provider-assigned unique ID for this managed resource.
    Filter string
    Rescan bool
    Disks []string
    A lexicographically sorted list of devices discovered by the operation, matching the supplied filter, if provided.
    HostSystemId string
    Id string
    The provider-assigned unique ID for this managed resource.
    Filter string
    Rescan bool
    disks List<String>
    A lexicographically sorted list of devices discovered by the operation, matching the supplied filter, if provided.
    hostSystemId String
    id String
    The provider-assigned unique ID for this managed resource.
    filter String
    rescan Boolean
    disks string[]
    A lexicographically sorted list of devices discovered by the operation, matching the supplied filter, if provided.
    hostSystemId string
    id string
    The provider-assigned unique ID for this managed resource.
    filter string
    rescan boolean
    disks Sequence[str]
    A lexicographically sorted list of devices discovered by the operation, matching the supplied filter, if provided.
    host_system_id str
    id str
    The provider-assigned unique ID for this managed resource.
    filter str
    rescan bool
    disks List<String>
    A lexicographically sorted list of devices discovered by the operation, matching the supplied filter, if provided.
    hostSystemId String
    id String
    The provider-assigned unique ID for this managed resource.
    filter String
    rescan Boolean

    Package Details

    Repository
    vSphere pulumi/pulumi-vsphere
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the vsphere Terraform Provider.
    vsphere logo
    vSphere v4.10.1 published on Friday, May 10, 2024 by Pulumi