code comments yo

This commit is contained in:
Megan Marsh 2018-12-20 13:09:32 -08:00
parent 24d2cc34e5
commit f26051a7da
1 changed files with 4 additions and 1 deletions

View File

@ -243,6 +243,7 @@ func getCreateVMScript(vmName string, path string, harddrivePath string, ram int
vhdx = vmName + ".vhd" vhdx = vmName + ".vhd"
} }
// Create VHD
templateString := `$vhdPath = Join-Path -Path {{ .Path }} -ChildPath {{ .VHDX }}` + "\n" templateString := `$vhdPath = Join-Path -Path {{ .Path }} -ChildPath {{ .VHDX }}` + "\n"
if harddrivePath != "" { if harddrivePath != "" {
if diffDisks { if diffDisks {
@ -252,13 +253,15 @@ func getCreateVMScript(vmName string, path string, harddrivePath string, ram int
} }
} else { } else {
if fixedVHD { 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" templateString = templateString + `Hyper-V\New-VHD -Path $vhdPath -Fixed -SizeBytes {{ .NewVHDSizeBytes }}` + "\n"
} else { } else {
templateString = templateString + `Hyper-V\New-VHD -Path $vhdPath -SizeBytes {{ .NewVHDSizeBytes }} -BlockSizeBytes {{ .VHDBlockSizeBytes }}` + "\n" 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 }}` 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 { if generation == 2 {
templateString = templateString + ` -Generation {{ .Generation }}` templateString = templateString + ` -Generation {{ .Generation }}`
} }