VMware Cloud Community
Pilu1978
Enthusiast
Enthusiast
Jump to solution

SvMotion Report

Hi,

I have a requirement to storage vmotion VMs with size more than 500 GB from one cluster to another cluster . Before that I would like to create a report to check how many datastores in the destination cluster can accommodate how many 500+ GB size VMs.

Please help.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Like this you mean?

$vmNr = 1

$vmSizeGB = 500


Get-Cluster -Name cluster2 |

Get-Datastore -PipelineVariable ds |

where{$_.ExtensionData.Summary.MultipleHostAccess -and $_.FreeSpaceGB -ge $vmSizeGB} |

ForEach-Object -Process {

    $free = $ds.FreeSpaceGB

    1..[math]::floor($ds.FreeSpaceGB/$vmSizeGB) | %{

        '' | Select @{N='VMName';E={"VM$vmNr"}},

            @{N='VMSizeGB';E={$vmSizeGB}},

            @{N='Datastore';E={$ds.Name}},

            @{N='TotalFreeSpaceGB';E={[math]::Round($free)}},

            @{N='FreeSpaceGB_AfterMigration';E={[math]::Round($free - $vmSizeGB)}}

        $vmNr++

        $free -= $vmSizeGB

    }

}


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

View solution in original post

0 Kudos
6 Replies
LucD
Leadership
Leadership
Jump to solution

Try something like this

Get-Cluster -Name cluster2 |

Get-Datastore |

where{$_.ExtensionData.Summary.MultipleHostAccess -and $_.FreeSpaceGB -ge 500} |

Select Name,@{N='Number of VMs';E={[math]::Floor($_.FreeSpaceGB/500)}}


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

0 Kudos
Pilu1978
Enthusiast
Enthusiast
Jump to solution

Thanks LucD for your reply.

If I want to create the report like first 500 GB VM will go to first DS which has more than 500 GB freespace. After moving first VM if the datastore still has 500 + free space then the 2nd VM will move to same datastore otherwise to the next datastore.

Please let me know how to achieve the same.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

The script I gave tells you how many VMs can go to each datastore.
Is this now another question for doing the actual vMotion?


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

0 Kudos
Pilu1978
Enthusiast
Enthusiast
Jump to solution

Nope I just wanted that report in presentable format so that I can show it to the management.

 

VMNameVMSizeGBDatastoreTotalFreeSpaceGBFreeSpaceGB_AfterMigration
VM1500DS11200700
VM2500DS1700200
VM3500DS2700200
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Like this you mean?

$vmNr = 1

$vmSizeGB = 500


Get-Cluster -Name cluster2 |

Get-Datastore -PipelineVariable ds |

where{$_.ExtensionData.Summary.MultipleHostAccess -and $_.FreeSpaceGB -ge $vmSizeGB} |

ForEach-Object -Process {

    $free = $ds.FreeSpaceGB

    1..[math]::floor($ds.FreeSpaceGB/$vmSizeGB) | %{

        '' | Select @{N='VMName';E={"VM$vmNr"}},

            @{N='VMSizeGB';E={$vmSizeGB}},

            @{N='Datastore';E={$ds.Name}},

            @{N='TotalFreeSpaceGB';E={[math]::Round($free)}},

            @{N='FreeSpaceGB_AfterMigration';E={[math]::Round($free - $vmSizeGB)}}

        $vmNr++

        $free -= $vmSizeGB

    }

}


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

0 Kudos
Pilu1978
Enthusiast
Enthusiast
Jump to solution

Thanks a lot. Really appreciated.

0 Kudos