Merge pull request #5374 from PatrickLang/hyperv-checkpoint

Disabling automatic checkpoints in hyperv-iso builder
This commit is contained in:
Matthew Hooker 2017-10-09 14:05:16 -07:00 committed by GitHub
commit 150b1522f4
1 changed files with 17 additions and 0 deletions

View File

@ -213,10 +213,27 @@ New-VM -Name $vmName -Path $path -MemoryStartupBytes $memoryStartupBytes -NewVHD
return err return err
} }
err = DisableAutomaticCheckpoints(vmName)
if err != nil {
return err
}
return DeleteAllDvdDrives(vmName) return DeleteAllDvdDrives(vmName)
} }
} }
func DisableAutomaticCheckpoints(vmName string) error {
var script = `
param([string]$vmName)
if ((Get-Command Set-Vm).Parameters["AutomaticCheckpointsEnabled"]) {
Set-Vm -Name $vmName -AutomaticCheckpointsEnabled $false }
`
var ps powershell.PowerShellCmd
err := ps.Run(script, vmName)
return err
}
func SetVirtualMachineCpuCount(vmName string, cpu uint) error { func SetVirtualMachineCpuCount(vmName string, cpu uint) error {
var script = ` var script = `