builder/parallels: Added setting the boot order

CD/DVD drive with installation ISO should be exactly the 2nd device in the VM boot order.
This ensures that VM will boot from this ISO at the first boot time only.
This commit is contained in:
Mikhail Zholobov 2014-09-17 17:42:01 +04:00 committed by Rickard von Essen
parent 280c3c52de
commit 13251ced49
1 changed files with 13 additions and 1 deletions

View File

@ -29,7 +29,6 @@ func (s *stepAttachISO) Run(state multistep.StateBag) multistep.StepAction {
// Attach the disk to the controller
ui.Say("Attaching ISO to the new CD/DVD drive...")
cdrom, err := driver.DeviceAddCdRom(vmName, isoPath)
if err != nil {
@ -39,6 +38,19 @@ func (s *stepAttachISO) Run(state multistep.StateBag) multistep.StepAction {
return multistep.ActionHalt
}
ui.Say("Setting the boot order...")
command := []string{
"set", vmName,
"--device-bootorder", fmt.Sprintf("hdd0 %s cdrom0 net0", cdrom),
}
if err := driver.Prlctl(command...); err != nil {
err := fmt.Errorf("Error setting the boot order: %s", err)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
}
// Track the device name so that we can can delete later
s.cdromDevice = cdrom