From 69e31bc126bbc861d32c7f9bbfd796b10f3a525b Mon Sep 17 00:00:00 2001 From: Vladislav Rassokhin Date: Tue, 16 Jul 2019 23:23:17 +0300 Subject: [PATCH] A bit debugging for CD-ROM creation problems --- driver/vm.go | 2 ++ iso/step_add_cdrom.go | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/driver/vm.go b/driver/vm.go index 35ab3ffc0..d177b20ba 100644 --- a/driver/vm.go +++ b/driver/vm.go @@ -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) } diff --git a/iso/step_add_cdrom.go b/iso/step_add_cdrom.go index ea06724ef..b329d02dd 100644 --- a/iso/step_add_cdrom.go +++ b/iso/step_add_cdrom.go @@ -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 } }