VMware Cloud Community
congcongdu
Contributor
Contributor

After set the sev-es enable and reserve the memory, guest could not power up

Hello,
I write a sev-es scripts, after enable the sev-es and reserve the memory, the guest could not power up as "memory reservation (sched.mem.min) should be equal to memsize(xxxx)", actually all memory have reserved.

Could you help take look at the scripts? Thanks very much in advance!

$vmObj = Get-VMHost -Name $hvServer | Get-VM -Name $vmName
$sev = Set-VM -VM $vmObj -SEVEnabled $true -Confirm:$False
Get-VMResourceConfiguration -VM $vmObj | Set-VMResourceConfiguration -MemReservationMB $vmObj.MemoryMB

 

0 Kudos
5 Replies
LucD
Leadership
Leadership

Did you try setting the Latency Sensitivity from High to Normal?

$vm = Get-VM -Name $vmName

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.latencySensitivity = New-Object VMware.Vim.LatencySensitivity
$spec.LatencySensitivity.Level = [VMware.Vim.LatencySensitivitySensitivityLevel]::normal

$vm.ExtensionData.ReconfigVM($spec)


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

0 Kudos
congcongdu
Contributor
Contributor

Hi LucD,

Thanks very much for your reply! I checked the Latency Sensitivity was normal in the GUI before.

If I only run the reserve memory command the guest could boot up successfully, but after add the enable sev-es command , the guest could not boot up as the memory reserve error.

I just tried in the scripts to add the below commands to set the  Latency Sensitivity to normal, but it still have the error

 

 

$vm = Get-VM -Name $vmName

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.latencySensitivity = New-Object VMware.Vim.LatencySensitivity
$spec.LatencySensitivity.Level = [VMware.Vim.LatencySensitivitySensitivityLevel]::normal

$vm.ExtensionData.ReconfigVM($spec)

 

 

 The error like below:

 

 

Line |
 999 |          $startvmOut = Start-VM -VM $vmObj -Confirm:$false
     |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | 4/17/2024 9:02:57 PM Start-VM  The operation for the entity "Performance-A" failed with the
     | following message: "Invalid memory setting: memory reservation (sched.mem.min) should be equal to memsize(2048). ". Invalid memory setting:
     | memory reservation (sched.mem.min) should be equal to memsize(2048). An error occurred while parsing scheduler-specific configuration
     | parameters. Module MemSched power on failed. Failed to start the virtual machine.

 

 

0 Kudos
LucD
Leadership
Leadership

Try adding this line to my previous snippet

$spec.memoryReservationLockedToMax = $true


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

0 Kudos
congcongdu
Contributor
Contributor

Hi LucD,

After add "$spec.memoryReservationLockedToMax = $true" , the VM still could not power on, the error same as before. The memory display all memory reserved, please see the attachment screen shot.

0 Kudos
LucD
Leadership
Leadership

Since the MemReservationMB parameter is marked obsolete, can you try with the MemReservationGB parameter?

Set-VMResourceConfiguration -MemReservationGB $vmObj.MemoryGB

A long shot I know, but that is the last option I can think of.

  


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

0 Kudos