From f26051a7daee713f2a8e002a786af847f43229d2 Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Thu, 20 Dec 2018 13:09:32 -0800 Subject: [PATCH] code comments yo --- common/powershell/hyperv/hyperv.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/powershell/hyperv/hyperv.go b/common/powershell/hyperv/hyperv.go index f7f4e3d91..15aa495b3 100644 --- a/common/powershell/hyperv/hyperv.go +++ b/common/powershell/hyperv/hyperv.go @@ -243,6 +243,7 @@ func getCreateVMScript(vmName string, path string, harddrivePath string, ram int vhdx = vmName + ".vhd" } + // Create VHD templateString := `$vhdPath = Join-Path -Path {{ .Path }} -ChildPath {{ .VHDX }}` + "\n" if harddrivePath != "" { if diffDisks { @@ -252,13 +253,15 @@ func getCreateVMScript(vmName string, path string, harddrivePath string, ram int } } else { if fixedVHD { - // We only end up in here with generation 1 vms, because gen 2 doesn't support VHDs templateString = templateString + `Hyper-V\New-VHD -Path $vhdPath -Fixed -SizeBytes {{ .NewVHDSizeBytes }}` + "\n" } else { templateString = templateString + `Hyper-V\New-VHD -Path $vhdPath -SizeBytes {{ .NewVHDSizeBytes }} -BlockSizeBytes {{ .VHDBlockSizeBytes }}` + "\n" } } + + // Create new VM using the VHD you just made templateString = templateString + `Hyper-V\New-VM -Name {{ .VMName }} -Path {{ .Path }} -MemoryStartupBytes {{ .MemoryStartupBytes }} -VHDPath $vhdPath -SwitchName {{ .SwitchName }}` + // Add optional tags to the end of the VM creation command if generation == 2 { templateString = templateString + ` -Generation {{ .Generation }}` }