Skip to content

Commit c6147b1

Browse files
committed
feat: Make firmware configurable
I extracted the changes as-is from vatesfr#28.
1 parent c5e5a86 commit c6147b1

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

builder/xenserver/common/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ type Config struct {
3333
InstallTimeout time.Duration ``
3434
SourcePath string `mapstructure:"source_path"`
3535

36+
Firmware string `mapstructure:"firmware"`
37+
3638
ctx interpolate.Context
3739
}
3840

builder/xenserver/common/config.hcl2spec.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

builder/xenserver/common/step_start_vm_paused.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ func (self *StepStartVmPaused) Run(ctx context.Context, state multistep.StateBag
1616

1717
c := state.Get("client").(*Connection)
1818
ui := state.Get("ui").(packer.Ui)
19+
config := state.Get("config").(Config)
1920

2021
ui.Say("Step: Start VM Paused")
2122

@@ -34,7 +35,7 @@ func (self *StepStartVmPaused) Run(ctx context.Context, state multistep.StateBag
3435
return multistep.ActionHalt
3536
}
3637

37-
err = c.client.VM.SetHVMBootParams(c.session, instance, map[string]string{"order": "cd"})
38+
err = c.client.VM.SetHVMBootParams(c.session, instance, map[string]string{"order": "cd", "firmware": config.Firmware})
3839
if err != nil {
3940
ui.Error(fmt.Sprintf("Unable to set HVM boot params: %s", err.Error()))
4041
return multistep.ActionHalt

builder/xenserver/iso/builder.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ func (self *Builder) Prepare(raws ...interface{}) (params []string, warns []stri
7777
self.config.CloneTemplate = "Other install media"
7878
}
7979

80+
if self.config.Firmware == "" {
81+
self.config.Firmware = "bios"
82+
}
83+
8084
if len(self.config.PlatformArgs) == 0 {
8185
pargs := make(map[string]string)
8286
pargs["viridian"] = "false"

0 commit comments

Comments
 (0)