jvm2016
Hot Shot
Hot Shot

setting storage cluster_powercli

Jump to solution

hi luc,

i am in process of implementing datastorecluster .

i found that it should be enabled at datacenter level only  and we cant mix nfs and vmfs datastores.is that correct?

can yu please check the orange lines as

1:its not prompting me to enter datastorecluster name .i think we can define second prameter in same param block .

2:what should be the correct suntax if we want to use datastores to start rebalincing once they utilize 90 percent of free space.

set-datastorecluster

function set-storagecluster_utilities

{

    [cmdletbinding()]

    param (

        [parameter(mandatory = $true,

            valuefrompipeline = $true,

            valuefrompipelinebypropertyname = $true)]

        [string]$datacenter,

        [string]$datastoreclustername

       

       

       

    )

   $dc=get-datacenter -name $datacenter

   $sum0f_datastores=get-datastore -RelatedObject $dc|Measure-Object -Property capacityGB -sum|select -ExpandProperty sum

   $sumof_provisionedspace_vms= get-vm -Location $dc|Measure-Object -Property provisionedspaceGb -sum|select -ExpandProperty sum

$res=Read-Host "do yu wnt to create datastore cluster y/n"

if($res -eq 'y')

{

$output = New-Object -TypeName PSObject

            $output|Add-Member -MemberType NoteProperty -Name 'sumof_datastoresGB' -Value ([math]::Round($sum0f_datastores))

            $output|Add-Member -MemberType NoteProperty -Name 'sumofvmsprovisionedspaceGB' -Value ([math]::Round($sumof_provisionedspace_vms))

            $output

New-DatastoreCluster -name $datastoreclustername -Location $datacenter -WhatIf

Set-DatastoreCluster -DatastoreCluster $datastoreclustername -whatif

}

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
  • If you want to get prompted, you will have to make the parameter Mandatory

function set-storagecluster_utilities

{

    [cmdletbinding()]

    param(

        [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]

        [string]$datacenter,

        [Parameter(Mandatory=$true)]

        [string]$datastoreclustername

    )

   $dc = Get-Datacenter -Name $datacenter

   $sum0f_datastores = Get-Datastore -RelatedObject $dc | Measure-Object -Property capacityGB -Sum | select -ExpandProperty sum

   $sumof_provisionedspace_vms = Get-VM -Location $dc | Measure-Object -Property provisionedspaceGb -Sum | select -ExpandProperty sum

    $res = Read-Host "do yu wnt to create datastore cluster y/n"

    if($res -eq 'y')

    {

        $output = New-Object -TypeName PSObject

        $output | Add-Member -MemberType NoteProperty -Name 'sumof_datastoresGB' -Value ([math]::Round($sum0f_datastores))

        $output | Add-Member -MemberType NoteProperty -Name 'sumofvmsprovisionedspaceGB' -Value ([math]::Round($sumof_provisionedspace_vms))

        $output

        New-DatastoreCluster -Name $datastoreclustername -Location $datacenter -WhatIf

        Set-DatastoreCluster -DatastoreCluster $datastoreclustername -whatif

    }

}

  • You can use something like this to set it to 90%

Get-DatastoreCluster -Name MyDSC |

Set-DatastoreCluster -SpaceUtilizationThresholdPercent 90 -Confirm:$false


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
4 Replies
LucD
Leadership
Leadership
  • If you want to get prompted, you will have to make the parameter Mandatory

function set-storagecluster_utilities

{

    [cmdletbinding()]

    param(

        [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]

        [string]$datacenter,

        [Parameter(Mandatory=$true)]

        [string]$datastoreclustername

    )

   $dc = Get-Datacenter -Name $datacenter

   $sum0f_datastores = Get-Datastore -RelatedObject $dc | Measure-Object -Property capacityGB -Sum | select -ExpandProperty sum

   $sumof_provisionedspace_vms = Get-VM -Location $dc | Measure-Object -Property provisionedspaceGb -Sum | select -ExpandProperty sum

    $res = Read-Host "do yu wnt to create datastore cluster y/n"

    if($res -eq 'y')

    {

        $output = New-Object -TypeName PSObject

        $output | Add-Member -MemberType NoteProperty -Name 'sumof_datastoresGB' -Value ([math]::Round($sum0f_datastores))

        $output | Add-Member -MemberType NoteProperty -Name 'sumofvmsprovisionedspaceGB' -Value ([math]::Round($sumof_provisionedspace_vms))

        $output

        New-DatastoreCluster -Name $datastoreclustername -Location $datacenter -WhatIf

        Set-DatastoreCluster -DatastoreCluster $datastoreclustername -whatif

    }

}

  • You can use something like this to set it to 90%

Get-DatastoreCluster -Name MyDSC |

Set-DatastoreCluster -SpaceUtilizationThresholdPercent 90 -Confirm:$false


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
jvm2016
Hot Shot
Hot Shot

Thanks  Luc.

i see few more options to be configured

pastedImage_0.png

i am putting sdrsautomationlevel  to fullyautomatic.

could you suggest something about first two

i/olatencythresholdmillisecond and ioloadbalanceenabled.

0 Kudos
LucD
Leadership
Leadership

First you need to decide if the IOLatency settings should be enabled yes or no.

I would advise to consult with your storage supplier, since this varies from vendor to vendor and from unittype to unittype.

For the IO latency, when I use it, I mostly left it to the default 15 ms.
But again it's better to consult with your storage vendor, or check in that storage Best Practices guide.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
jvm2016
Hot Shot
Hot Shot

Thanks Luc.

0 Kudos