mirror of
https://github.com/hashicorp/vagrant.git
synced 2026-02-03 20:39:27 -05:00
Fix HyperV XML: System.Xml.XmlElement & The minimum amount (#13691)
* Fix HyperV XML: System.Xml.XmlElement & The minimum amount
This commit is contained in:
parent
dc3934780a
commit
d3a14babf1
1 changed files with 8 additions and 8 deletions
|
|
@ -333,14 +333,14 @@ function New-VagrantVMXML {
|
|||
|
||||
# Apply original VM configuration to new VM instance
|
||||
|
||||
if($CPUCount -ne $null) {
|
||||
if($CPUCount -ne $null -and $CPUCount -gt 0) {
|
||||
$processors = $CPUCount
|
||||
} else {
|
||||
$processors = $VMConfig.configuration.settings.processors.count."#text"
|
||||
}
|
||||
$notes = (Select-Xml -XML $VMConfig -XPath "//notes").node."#text"
|
||||
$memory = (Select-Xml -XML $VMConfig -XPath "//memory").node.Bank
|
||||
if ($memory.dynamic_memory_enabled."#text" -eq "True") {
|
||||
$memoryNode = (Select-Xml -XML $VMConfig -XPath "//memory").node.bank
|
||||
if ($memoryNode.dynamic_memory_enabled."#text" -eq "True") {
|
||||
$dynamicmemory = $True
|
||||
}
|
||||
else {
|
||||
|
|
@ -348,17 +348,17 @@ function New-VagrantVMXML {
|
|||
}
|
||||
|
||||
|
||||
if($Memory -ne $null) {
|
||||
if($Memory -ne $null -and $Memory -gt 0) {
|
||||
$MemoryMaximumBytes = $Memory * 1MB
|
||||
$MemoryStartupBytes = $Memory * 1MB
|
||||
$MemoryMinimumBytes = $Memory * 1MB
|
||||
} else {
|
||||
$MemoryMaximumBytes = ($memory.limit."#text" -as [int]) * 1MB
|
||||
$MemoryStartupBytes = ($memory.size."#text" -as [int]) * 1MB
|
||||
$MemoryMinimumBytes = ($memory.reservation."#text" -as [int]) * 1MB
|
||||
$MemoryMaximumBytes = ($memoryNode.limit."#text" -as [int]) * 1MB
|
||||
$MemoryStartupBytes = ($memoryNode.size."#text" -as [int]) * 1MB
|
||||
$MemoryMinimumBytes = ($memoryNode.reservation."#text" -as [int]) * 1MB
|
||||
}
|
||||
|
||||
if($MaxMemory -ne $null) {
|
||||
if($MaxMemory -ne $null -and $MaxMemory -gt 0) {
|
||||
$dynamicmemory = $true
|
||||
$MemoryMaximumBytes = $MaxMemory * 1MB
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue