VMware Cloud Community
VishnuN87
Contributor
Contributor

Script for performing test for vMotion of VMs on each hosts in multiple clusters

Hi all,

We are preforming upgrades of esxi to 7.0 in our environment and we need to verify if the VMs on each host can be vMotion'ed or there  will be some issues (Like multi writer with CBT , CPU UUID mask  etc) which put restrictions of VMs vmotion. 

We will have to then plan for downtime for those VMs.

If some one can point in  direction to automate this as the count of hosts are high

Thanks in advance.

Reply
0 Kudos
8 Replies
scott28tt
VMware Employee
VMware Employee

Would you consider using PowerCLI for this?

 


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
Reply
0 Kudos
VishnuN87
Contributor
Contributor

Yes scott if any powercli command or script are available , will test that to check the feasability.

Reply
0 Kudos
scott28tt
VMware Employee
VMware Employee

I've reported your thread to moderators asking them to move it to the area for PowerCLI.

You should search that area for existing scripts or snippets which you can combine.

 


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
Reply
0 Kudos
LucD
Leadership
Leadership

No cmdlet, but you can call the CheckMigrate method from PowerCLI.

There are a number of parameters you can vary, like $pool and $state.
But basically the code could look something like this

$vmName = 'MyVM'
$esxName = 'Target-ESXi-Node'

$vm = Get-VM -Name $vmName
$esx = Get-VMHost -Name $esxName
$pool = $null
$state = [VMware.Vim.VirtualMachinePowerState]::poweredOn
$tests = $null

$si = Get-View ServiceInstance
$VmProvCheck = Get-View $si.Content.VmProvisioningChecker
$result = $vmProvCheck.CheckMigrate($vm.ExtensionData.MoRef, $esx.Extensiondata.MoRef, $pool, $state, $tests)

$result[0].Error | Select-Object LocalizedMessage
$result[0].Warning  | Select-Object LocalizedMessage

You will need to look at the errors and warnings.
If none are there, the vMotion can happen without issues.


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

Reply
0 Kudos
VishnuN87
Contributor
Contributor

Thanks LucD ,but how can i automate it on cluster level and make VMs tested on the other hosts than the one it resides on.

 

Sorry I am new at scripting and will need the same soon , Thanks for your understanding and support always

Reply
0 Kudos
LucD
Leadership
Leadership

Before this becomes one of those threads where requirements are added as we go, can you reflect on what exactly you want to test?
Your original request mentioned testing powered on VMs, which answers the State value (poweredon).

But what about the target ESXi nodes?
Is that for all nodes in the target cluster?

There is also the question of the pool.
Are there the same resourcepools defined in the target cluster?


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

Reply
0 Kudos
VishnuN87
Contributor
Contributor

Hi LucD,

We have around 30-40 clusters with most of them running with 2-3 hosts and will have around minimum of 7-8 Vms .

We need to test the vmotion comaptability of all these VMs as we are planning to migrate this hosts to 7.0 and if any VM require downtime we get downtime before the upgrade. Like issue with scsi bus sharing ,multi writer CBT ,CD/DVD issue errors , and need the error report for each VMs

There are no pools created on this clusters and powered on VMs only have to be validated .

Also checking each VM individually will take lot of time so need some script which can be tested for all VMs or on cluster level. when the vMotion is tested script should not check on the same host which it resides on.

hope this clarifies the requirement

Thanks in advance for your support.

Reply
0 Kudos
LucD
Leadership
Leadership

Not really, as you are able to see from my snippet above, you need to specify a target ESXi node for the vMotion.
How does the script know which VM goes to which cluster or ESXi node?
Also, if the target is a cluster, shall the script test against all ESXi nodes in that target cluster?


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