A bit debugging for CD-ROM creation problems

This commit is contained in:
Vladislav Rassokhin 2019-07-16 23:23:17 +03:00
parent 483df213fd
commit 69e31bc126
2 changed files with 4 additions and 2 deletions

View File

@ -7,6 +7,7 @@ import (
"github.com/vmware/govmomi/object"
"github.com/vmware/govmomi/vim25/mo"
"github.com/vmware/govmomi/vim25/types"
"log"
"strings"
"time"
)
@ -575,6 +576,7 @@ func (vm *VirtualMachine) AddCdrom(controllerType string, isoPath string) error
devices.InsertIso(cdrom, isoPath)
}
log.Printf("Creating CD-ROM on controller '%v' with iso '%v'", controller, isoPath)
return vm.addDevice(cdrom)
}

View File

@ -45,7 +45,7 @@ func (s *StepAddCDRom) Run(_ context.Context, state multistep.StateBag) multiste
if len(s.Config.ISOPaths) > 0 {
for _, path := range s.Config.ISOPaths {
if err := vm.AddCdrom(s.Config.CdromType, path); err != nil {
state.Put("error", fmt.Errorf("error mounting an image: %v", err))
state.Put("error", fmt.Errorf("error mounting an image '%v': %v", path, err))
return multistep.ActionHalt
}
}
@ -53,7 +53,7 @@ func (s *StepAddCDRom) Run(_ context.Context, state multistep.StateBag) multiste
if path, ok := state.GetOk("iso_remote_path"); ok {
if err := vm.AddCdrom(s.Config.CdromType, path.(string)); err != nil {
state.Put("error", fmt.Errorf("error mounting an image: %v", err))
state.Put("error", fmt.Errorf("error mounting an image '%v': %v", path, err))
return multistep.ActionHalt
}
}