Adding nested virtualization support
This commit is contained in:
parent
6342e1525d
commit
f94c2cd2f7
|
@ -72,7 +72,7 @@ type Driver interface {
|
|||
|
||||
DeleteVirtualMachine(string) error
|
||||
|
||||
SetVirtualMachineCpu(string, uint) error
|
||||
SetVirtualMachineCpu(string, uint, bool) error
|
||||
|
||||
SetSecureBoot(string, bool) error
|
||||
|
||||
|
|
|
@ -177,8 +177,8 @@ func (d *HypervPS4Driver) DeleteVirtualMachine(vmName string) error {
|
|||
return hyperv.DeleteVirtualMachine(vmName)
|
||||
}
|
||||
|
||||
func (d *HypervPS4Driver) SetVirtualMachineCpu(vmName string, cpu uint) error {
|
||||
return hyperv.SetVirtualMachineCpu(vmName, cpu)
|
||||
func (d *HypervPS4Driver) SetVirtualMachineCpu(vmName string, cpu uint, exposeVirtualizationExtensions bool) error {
|
||||
return hyperv.SetVirtualMachineCpu(vmName, cpu, exposeVirtualizationExtensions)
|
||||
}
|
||||
|
||||
func (d *HypervPS4Driver) SetSecureBoot(vmName string, enable bool) error {
|
||||
|
|
|
@ -22,6 +22,7 @@ type StepCreateVM struct {
|
|||
Generation uint
|
||||
Cpu uint
|
||||
EnableSecureBoot bool
|
||||
ExposeVirtualizationExtensions bool
|
||||
}
|
||||
|
||||
func (s *StepCreateVM) Run(state multistep.StateBag) multistep.StepAction {
|
||||
|
@ -46,7 +47,7 @@ func (s *StepCreateVM) Run(state multistep.StateBag) multistep.StepAction {
|
|||
return multistep.ActionHalt
|
||||
}
|
||||
|
||||
err = driver.SetVirtualMachineCpu(s.VMName, s.Cpu)
|
||||
err = driver.SetVirtualMachineCpu(s.VMName, s.Cpu, s.ExposeVirtualizationExtensions)
|
||||
if err != nil {
|
||||
err := fmt.Errorf("Error creating setting virtual machine cpu: %s", err)
|
||||
state.Put("error", err)
|
||||
|
|
|
@ -89,6 +89,7 @@ type Config struct {
|
|||
Cpu uint `mapstructure:"cpu"`
|
||||
Generation uint `mapstructure:"generation"`
|
||||
EnableSecureBoot bool `mapstructure:"enable_secure_boot"`
|
||||
EnableVirtualizationExtensions `mapstructure:"enable_virtualization_extensions`
|
||||
|
||||
Communicator string `mapstructure:"communicator"`
|
||||
|
||||
|
@ -298,6 +299,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||
Generation: b.config.Generation,
|
||||
Cpu: b.config.Cpu,
|
||||
EnableSecureBoot: b.config.EnableSecureBoot,
|
||||
EnableVirtualizationExtensions: b.config.EnableVirtualizationExtensions
|
||||
},
|
||||
&hypervcommon.StepEnableIntegrationService{},
|
||||
|
||||
|
|
|
@ -217,11 +217,11 @@ New-VM -Name $vmName -Path $path -MemoryStartupBytes $memoryStartupBytes -NewVHD
|
|||
}
|
||||
}
|
||||
|
||||
func SetVirtualMachineCpu(vmName string, cpu uint) error {
|
||||
func SetVirtualMachineCpu(vmName string, cpu uint, exposeVirtualizationExtensions bool) error {
|
||||
|
||||
var script = `
|
||||
param([string]$vmName, [int]$cpu)
|
||||
Set-VMProcessor -VMName $vmName -Count $cpu
|
||||
param([string]$vmName, [int]$cpu, [bool]$exposeVirtualizationExtensions)
|
||||
Set-VMProcessor -VMName $vmName -Count $cpu -exposeVirtualizationExtensions $exposeVirtualizationExtensions
|
||||
`
|
||||
|
||||
var ps powershell.PowerShellCmd
|
||||
|
|
Loading…
Reference in New Issue