Merge pull request #9932 from chrisroberts/e-hyperv-maxmem-chk

Validate maxmemory setting within Hyper-V provider
This commit is contained in:
Chris Roberts 2018-06-13 14:52:09 -07:00 committed by GitHub
commit 3919455f08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -368,6 +368,12 @@ function Set-VagrantVMMemory {
}
if($DynamicMemory) {
if($MemoryMaximumBytes < $MemoryMinimumBytes) {
throw "Maximum memory value is less than required minimum memory value."
} else if ($MemoryMaximumBytes < $MemoryStartupBytes) {
throw "Maximum memory value is less than configured startup memory value."
}
Hyper-V\Set-VM -VM $VM -DynamicMemory
Hyper-V\Set-VM -VM $VM -MemoryMinimumBytes $MemoryMinimumBytes -MemoryMaximumBytes `
$MemoryMaximumBytes -MemoryStartupBytes $MemoryStartupBytes