providers/hyperv: style
This commit is contained in:
parent
af4bc18c14
commit
d1bdfe492b
|
@ -81,8 +81,7 @@ If ($dynamicmemory) {
|
||||||
$more_vm_params.Add("DynamicMemory",$True)
|
$more_vm_params.Add("DynamicMemory",$True)
|
||||||
$more_vm_params.Add("MemoryMinimumBytes",$MemoryMinimumBytes)
|
$more_vm_params.Add("MemoryMinimumBytes",$MemoryMinimumBytes)
|
||||||
$more_vm_params.Add("MemoryMaximumBytes", $MemoryMaximumBytes)
|
$more_vm_params.Add("MemoryMaximumBytes", $MemoryMaximumBytes)
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$more_vm_params.Add("StaticMemory",$True)
|
$more_vm_params.Add("StaticMemory",$True)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,16 +94,17 @@ $vm | Set-VM @more_vm_params -Passthru
|
||||||
|
|
||||||
# Add drives to the virtual machine
|
# Add drives to the virtual machine
|
||||||
$controllers = Select-Xml -xml $vmconfig -xpath "//*[starts-with(name(.),'controller')]"
|
$controllers = Select-Xml -xml $vmconfig -xpath "//*[starts-with(name(.),'controller')]"
|
||||||
|
|
||||||
# A regular expression pattern to pull the number from controllers
|
# A regular expression pattern to pull the number from controllers
|
||||||
[regex]$rx="\d"
|
[regex]$rx="\d"
|
||||||
|
|
||||||
foreach ($controller in $controllers) {
|
foreach ($controller in $controllers) {
|
||||||
$node = $controller.Node
|
$node = $controller.Node
|
||||||
|
|
||||||
# Check for SCSI
|
# Check for SCSI
|
||||||
if ($node.ParentNode.ChannelInstanceGuid) {
|
if ($node.ParentNode.ChannelInstanceGuid) {
|
||||||
$ControllerType = "SCSI"
|
$ControllerType = "SCSI"
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$ControllerType = "IDE"
|
$ControllerType = "IDE"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,6 +117,7 @@ foreach ($controller in $controllers) {
|
||||||
ControllerNumber = $rx.Match($controller.node.name).value
|
ControllerNumber = $rx.Match($controller.node.name).value
|
||||||
Path = $vhdx_path
|
Path = $vhdx_path
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($drive.pool_id."#text") {
|
if ($drive.pool_id."#text") {
|
||||||
$ResourcePoolName = $drive.pool_id."#text"
|
$ResourcePoolName = $drive.pool_id."#text"
|
||||||
$addDriveParam.Add("ResourcePoolname",$ResourcePoolName)
|
$addDriveParam.Add("ResourcePoolname",$ResourcePoolName)
|
||||||
|
@ -134,5 +135,6 @@ $resultHash = @{
|
||||||
name = $vm_name
|
name = $vm_name
|
||||||
id = $vm_id
|
id = $vm_id
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = ConvertTo-Json $resultHash
|
$result = ConvertTo-Json $resultHash
|
||||||
Write-Output-Message $result
|
Write-Output-Message $result
|
||||||
|
|
Loading…
Reference in New Issue