fmt && generate

This commit is contained in:
William Brooks 2020-02-21 01:07:58 -06:00
parent d7300f4635
commit 5e1e4ec701
8 changed files with 36 additions and 30 deletions

View File

@ -97,7 +97,7 @@ type FlatConfig struct {
SkipCompaction *bool `mapstructure:"skip_compaction" required:"false" cty:"skip_compaction"`
SkipExport *bool `mapstructure:"skip_export" required:"false" cty:"skip_export"`
Headless *bool `mapstructure:"headless" required:"false" cty:"headless"`
LegacyGen1BootOrder *bool `mapstructure:"legacy_gen1_boot_order" required:"false" cty:"legacy_gen1_boot_order"`
FirstBootDevice *string `mapstructure:"first_boot_device" required:"false" cty:"first_boot_device"`
ShutdownCommand *string `mapstructure:"shutdown_command" required:"false" cty:"shutdown_command"`
ShutdownTimeout *string `mapstructure:"shutdown_timeout" required:"false" cty:"shutdown_timeout"`
DiskSize *uint `mapstructure:"disk_size" required:"false" cty:"disk_size"`
@ -206,7 +206,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec {
"skip_compaction": &hcldec.AttrSpec{Name: "skip_compaction", Type: cty.Bool, Required: false},
"skip_export": &hcldec.AttrSpec{Name: "skip_export", Type: cty.Bool, Required: false},
"headless": &hcldec.AttrSpec{Name: "headless", Type: cty.Bool, Required: false},
"legacy_gen1_boot_order": &hcldec.AttrSpec{Name: "legacy_gen1_boot_order", Type: cty.Bool, Required: false},
"first_boot_device": &hcldec.AttrSpec{Name: "first_boot_device", Type: cty.String, Required: false},
"shutdown_command": &hcldec.AttrSpec{Name: "shutdown_command", Type: cty.String, Required: false},
"shutdown_timeout": &hcldec.AttrSpec{Name: "shutdown_timeout", Type: cty.String, Required: false},
"disk_size": &hcldec.AttrSpec{Name: "disk_size", Type: cty.Number, Required: false},

View File

@ -97,7 +97,7 @@ type FlatConfig struct {
SkipCompaction *bool `mapstructure:"skip_compaction" required:"false" cty:"skip_compaction"`
SkipExport *bool `mapstructure:"skip_export" required:"false" cty:"skip_export"`
Headless *bool `mapstructure:"headless" required:"false" cty:"headless"`
LegacyGen1BootOrder *bool `mapstructure:"legacy_gen1_boot_order" required:"false" cty:"legacy_gen1_boot_order"`
FirstBootDevice *string `mapstructure:"first_boot_device" required:"false" cty:"first_boot_device"`
ShutdownCommand *string `mapstructure:"shutdown_command" required:"false" cty:"shutdown_command"`
ShutdownTimeout *string `mapstructure:"shutdown_timeout" required:"false" cty:"shutdown_timeout"`
CloneFromVMCXPath *string `mapstructure:"clone_from_vmcx_path" cty:"clone_from_vmcx_path"`
@ -208,7 +208,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec {
"skip_compaction": &hcldec.AttrSpec{Name: "skip_compaction", Type: cty.Bool, Required: false},
"skip_export": &hcldec.AttrSpec{Name: "skip_export", Type: cty.Bool, Required: false},
"headless": &hcldec.AttrSpec{Name: "headless", Type: cty.Bool, Required: false},
"legacy_gen1_boot_order": &hcldec.AttrSpec{Name: "legacy_gen1_boot_order", Type: cty.Bool, Required: false},
"first_boot_device": &hcldec.AttrSpec{Name: "first_boot_device", Type: cty.String, Required: false},
"shutdown_command": &hcldec.AttrSpec{Name: "shutdown_command", Type: cty.String, Required: false},
"shutdown_timeout": &hcldec.AttrSpec{Name: "shutdown_timeout", Type: cty.String, Required: false},
"clone_from_vmcx_path": &hcldec.AttrSpec{Name: "clone_from_vmcx_path", Type: cty.String, Required: false},

View File

@ -188,7 +188,7 @@ func SetFirstBootDeviceGen1(vmName string, controllerType string) error {
// controllerType must be 'NET', 'DVD', 'IDE' or 'FLOPPY' (case sensitive)
// The 'NET' value is always replaced with 'LegacyNetworkAdapter'
if (controllerType == "NET") {
if controllerType == "NET" {
controllerType = "LegacyNetworkAdapter"
}
@ -205,18 +205,16 @@ param([string] $vmName, [string] $controllerType)
func SetFirstBootDeviceGen2(vmName string, controllerType string, controllerNumber uint, controllerLocation uint) error {
// script := `
// param([string]$vmName,[int]$controllerNumber,[int]$controllerLocation)
// $vmDvdDrive = Hyper-V\Get-VMDvdDrive -VMName $vmName -ControllerNumber $controllerNumber -ControllerLocation $controllerLocation
// if (!$vmDvdDrive) {throw 'unable to find dvd drive'}
// Hyper-V\Set-VMFirmware -VMName $vmName -FirstBootDevice $vmDvdDrive -ErrorAction SilentlyContinue
// `
// script := `
// param([string]$vmName,[int]$controllerNumber,[int]$controllerLocation)
// $vmDvdDrive = Hyper-V\Get-VMDvdDrive -VMName $vmName -ControllerNumber $controllerNumber -ControllerLocation $controllerLocation
// if (!$vmDvdDrive) {throw 'unable to find dvd drive'}
// Hyper-V\Set-VMFirmware -VMName $vmName -FirstBootDevice $vmDvdDrive -ErrorAction SilentlyContinue
// `
// script := `
// param([string] $vmName, [string] $controllerType, )
//`
// script := `
// param([string] $vmName, [string] $controllerType, )
//`
return nil
}

View File

@ -110,10 +110,18 @@
built. When this value is set to true, the machine will start without a
console.
- `legacy_gen1_boot_order` (bool) - Over time the Hyper-V builder has been modified to change the original
boot order that is used when an ISO is mounted. Hyper-V's default is to
boot from the CD first, the original Hyper-V builder included code to
codify this setting when the primary ISO is mounted, that code was eventually
modified to place the IDE adapter before the the CD (only in generation 1).
Setting this value to true, forces the original method of operation.
- `first_boot_device` (string) - When configured, determines the device or device type that is given preferential
treatment when choosing a boot device.
For Generation 1:
- `IDE`
- `CD` *or* `DVD`
- `Floppy`
- `NET`
For Generation 2:
- `IDE:x:y`
- `SCSI:x:y`
- `CD` *or* `DVD`
- `NET`